| 接口 | { "exists": { "field": "user" } } |
|---|---|
| 不匹配的情况 | 字段未写入、值为 null、数组为空 |
| 组合用法 | must_not + exists 查出缺字段的文档,便于补数据 |
示例
示例
GET /my-index/_search
{
"query": {
"bool": {
"must_not": [ { "exists": { "field": "email" } } ]
}
}
}object 类型的父字段只要有子字段写入就算存在;查 nested 字段存在性要放进 nested 查询里。