如何在同一路径的多个嵌套子查询中返回多个内部匹配?

编程入门 行业动态 更新时间:2024-10-07 05:20:54
本文介绍了如何在同一路径的多个嵌套子查询中返回多个内部匹配?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我对同一路径有多个嵌套子查询时,结果似乎只包括最后一个嵌套子查询的内部匹配结果.有没有办法返回多个嵌套子查询的所有内部匹配结果?

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

更多推荐

如何在同一路径的多个嵌套子查询中返回多个内部匹配?

本文发布于:2023-11-30 18:31:53,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1651076.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   嵌套   路径   在同一

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!