elasticsearch - 嵌套对象数组的 Elasticsearch 查询
问题描述
我正在努力解决 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
}
}
}
推荐阅读
- google-cloud-platform - Google Monitoring Query Language Metric 时间序列标识符列过多
- keras - Keras ValueError:尺寸必须相等 - 如何将标签相关值传递给自定义损失函数
- python - 关于 Python 中的方法退出需要的建议
- asp.net - 具有两个用户名的 Azure AD B2C 注册用户流
- docusignapi - 我们是否需要登录我们的帐户以获取授权码作为在 docusign 中创建令牌的第一步?
- python - pip install 不安装使用 install_requires 声明的必需依赖项
- php - 我必须使用 Php 解析来自 API 的 JSON 响应,但有些东西不起作用
- docker - AWS ECS FARGATE 一次性任务
- javascript - 如何通过 stringArray JS 中的 split 或 substring 方法获取所需的字符?
- git - 如何使用 git difftool 区分 docx 文件