gpt4 book ai didi

elasticsearch - 对嵌套对象数组的Elasticsearch查询

转载 作者:行者123 更新时间:2023-12-02 22:16:21 30 4
gpt4 key购买 nike

我在ElasticSearch上遇到查询问题。
我记录了这种对象:

{
"obj_id": 1,
"label": "label obj 1",
"array_of_nested": [{
"nested_id": 1,
"label": "label nested obj1"
}, {
"nested_id": 2,
"label": "label nested obj2"
}
]
}, {
"obj_id": 2,
"label": "label obj 2",
"array_of_nested": [{
"nested_id": 3,
"label": "label nested obj1"
}, {
"nested_id": 4,
"label": "label nested obj2"
}
]
}
我正在尝试编写一个查询,以在array_of_nested属性中查找nested_id为2的所有对象,但到目前为止无法正常工作。 :/
谢谢 !

最佳答案

你可以试试这个吗?

{
"query": {
"match": {
"array_of_nested.nested_id": 2
}
}
}

关于elasticsearch - 对嵌套对象数组的Elasticsearch查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64445401/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com