Using exists and missing filters
One of the main characteristics of ElasticSearch is its schema-less indexing capability. Records in ElasticSearch can have missing values. To manage them, two kinds of filters are supported:
- Exists filter: This checks whether a field exists in a document
- Missing filter: This checks whether a field is missing
Getting ready
You need a working ElasticSearch cluster and an index populated with the script chapter_05/populate_query.sh
, available in the code bundle for this book.
How to do it...
In order to execute existing and missing filters, perform the following steps:
- To search all the test-type documents that have a field called
parsedtext
, this will be the query:curl -XPOST 'http://127.0.0.1:9200/test-index/test-type/_search?pretty=true' ...
Get ElasticSearch Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.