【发布时间】:2018-01-21 12:41:18
【问题描述】:
我正在尝试获取缺少字段 "topic.description" 并匹配术语 "fundedUnder.programme": "ABC" 的文档。
映射:
...
"fundedUnder": {
"properties": {
"programme": {
"type": "string"
},
"subprogramme": {
"type": "string"
}
}
},
"topics": {
"type": "nested",
"include_in_parent": true,
"properties": {
"code": {
"type": "string",
"analyzer": "analyzer_keyword"
},
"description": {
"type": "string",
"analyzer": "analyzer_keyword"
},
"title": {
"type": "string",
"analyzer": "analyzer_keyword"
}
}
},
...
我的查询看起来像:
{
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"missing": {
"field": "topics.description"
}
},
{
"term": {
"fundedUnder.programme" : "ABC"
}
}
]
}
}
}
}
}
这个查询什么也没找到,那是错误的,因为我在索引中使用了 fundedUnder.programme == "ABC" 和缺少字段 topic.description 的很多文档。
提前致谢。
ElasticSearch 1.7.5 版
【问题讨论】:
标签: elasticsearch