【发布时间】:2020-07-02 21:19:06
【问题描述】:
我正在尝试使用嵌套 JSON 来查询数据库记录。这是我的查询-
"query": {
"nested": {
"path": "metadata.technical",
"query": {
"bool": {
"must": [
{
"term": {
"metadata.technical.key": "techcolor"
}
},
{
"term": {
"metadata.technical.value": "red"
}
}
]
}
}
}
}
这是我的 mapping.json 中的这一部分 -
"metadata": {
"include_in_parent": true,
"properties": {
"technical": {
"type": "nested",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
我有一个包含“值”列的表格,它的内容是 -
{"technical":
{
"techname22": "test",
"techcolor":"red",
"techlocation": "usa"
}
}
为什么我不能得到任何结果?仅供参考,我使用的是 ES 1.7。感谢您的帮助。
【问题讨论】:
标签: json elasticsearch