ES exists查询

今天有个同事说怀疑某个索引的一个字段是否有定义,因为查询结果中一直没有该字段。

我们可以使用exists来查询那些在特定字段有值的文档。

比如:

ec2-user@ip-172-31-31-122:~> curl -H "Content-Type: application/json" -XGET 'http://ip:9200/index_name/_search?pretty' -d '{"query":{"bool":{"must":[{"exists":{"field":"field_name.keyword"}}],"must_not":[],"should":[]}},"from":0,"size":10,"sort":[],"aggs":{}}'

posted @ 2021-04-03 19:33  LeoGIS  阅读(2049)  评论(0编辑  收藏  举报