Exists query is used to find the document that contains a non-null value for the field specified in the query. For example, if you want to find all the document that contain product reviews. The query looks like the following:
#Exists POST chapter6/product/_search { "query": { "exists" : { "field" : "reviews" } } }
If you want to find all the products that don't contain reviews, we can use the bool must_not query to find the documents that don't contain the field. The query looks like the following:
#Missing POST chapter6/product/_search { "query": { "bool": { "must_not": { "exists": { "field": "reviews" } } } } }