我的映射是:
"properties": {
"user": {
"type": "nested",
"properties": {
"id": {
"type": "integer"
},
"is_active": {
"type": "boolean",
"null_value": false
},
"username": {
"type": "string"
}
}
},
我想获取所有没有的文件user
field.
I tried:
GET /index/type/_search
{
"query": {
"bool": {
"must_not": [
{
"exists": {
"field": "user"
}
}
]
}
}
}
它返回所有文档。
基于ElasticSearch 2.x 存在嵌套字段过滤器不起作用 https://stackoverflow.com/questions/40475868/elasticsearch-2-x-exists-filter-for-nested-field-doesnt-work/40479451#40479451,我也尝试过:
GET /index/type/_search
{
"query": {
"nested": {
"path": "user",
"query": {
"bool": {
"must_not": [
{
"exists": {
"field": "user"
}
}
]
}
}
}
}
}
返回 0 个文档。
获取所有缺少以下内容的文档的正确查询是什么user
field?
我发现正确的语法应该是:
GET /index/type/_search
{
"query": {
"bool": {
"must_not": [
{
"nested": {
"path": "user",
"query": {
"exists": {
"field": "user"
}
}
}
}
]
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)