es7102 join类型查询有哪几种方式
在ES 7.10.2中,join类型查询提供了以下几种方式:
-
Nested查询:使用nested查询可以在一个文档中查询嵌套的字段。 示例:
{ "query": { "nested": { "path": "nested_field", "query": { "bool": { "must": [ { "match": { "nested_field.name": "value" } } ] } } } } } -
Parent-Child查询:使用parent-child关系查询可以查询父文档或子文档。 示例:
{ "query": { "has_parent": { "parent_type": "parent_type", "query": { "match": { "field": "value" } } } } } -
Terms查询:使用terms查询可以查询具有指定关联关系的文档。 示例:
{ "query": { "terms": { "field": ["value1", "value2"], "index": "index_name", "path": "join_field" } } } -
Children查询:使用children查询可以查询具有指定关联关系的子文档。 示例:
{ "query": { "has_child": { "type": "child_type", "query": { "match": { "field": "value" } } } } }
这些是ES 7.10.2中join类型查询的几种常见方式,您可以根据具体的需求选择适合的查询方式
原文地址: https://www.cveoy.top/t/topic/hJs6 著作权归作者所有。请勿转载和采集!