Using the exists query
One of the main characteristics of Elasticsearch is its schema-less indexing capability. Records in Elasticsearch can have missing values. Due to its schema-less nature, two kinds of queries are required:
- Exists field: This is used to check whether a field exists in a document.
- Missing field: This is used to check whether a field is missing in a document.
Getting ready
You will need an up-and-running Elasticsearch installation, as described in the Downloading and installing Elasticsearch recipe of Chapter 1, Getting Started.
To execute the commands, any HTTP client can be used, such as curl
(https://curl.haxx.se/), postman
(https://www.getpostman.com/), or similar. I suggest you use the Kibana console as it provides code completion and better character escaping for Elasticsearch.
To correctly execute the following commands, you will need an index populated with the ch04/populate_kibana.txt
 command, which is ...