我有这样的文件:
{
"name": "Secret",
"tags": [
{
{ "key": "Project" },
{ "value": "X"}
},
{
{ "key": "Manager" },
{ "value": "David"}
}
]
}
tags
类型是嵌套类型。
我使用bool查询搜索文档有两个特定的标签:
{
"query": {
"nested": {
"path": "tags",
"query": {
"bool": {
"must": [
{ "match" : { "tags.key": "Project"}},
{ "match" : { "tags.value": "X"}}
],
"must": [
{ "match" : { "tags.key": "Manager"}},
{ "match" : { "tags.value": "David"}}
]
}
}
}
}
但它不起作用:
{
"took" : 4,
"timed_out" : false,
"_shards" : {
"total" : 10,
"successful" : 10,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
有什么不对吗?