当我对同一路径有多个嵌套子查询时,结果似乎只包括最后一个嵌套子查询的内部匹配结果.有没有办法返回多个嵌套子查询的所有内部匹配结果?
When I have multiple nested sub-queries for the same path, it seems the result will only include the inner hits result of the last nested sub-query. Is there a way to return all of the inner hits results for the multiple nested sub-queries?
例如
{ "query": { "bool: { "must": [{ "nested": { "query": {...}, "path": "path_a", "inner_hits": {} } },{ "nested": { "query": {...}, "path": "path_a", "inner_hits": {} } }] } } } 推荐答案如果您在 inner_hits 中添加唯一的名称,则结果基本上将包含符合您的期望.
If you add a unique name to your inner_hits, then the result will basically contain a map of your inner hits as you're expecting.
注意:似乎内部匹配有时在 matched_queries 中包含额外的查询名称(来自其他嵌套查询),因此可能需要一些后处理
Note: It seems that sometimes the inner hits contains extra query names (from the other nested queries) in the matched_queries, so it may need some post-processing
更多推荐
如何在同一路径的多个嵌套子查询中返回多个内部匹配?
发布评论