Using an IDs query
It's a common scenario to search by ID on a document that is part of a parent/child relationship or a join one. In this case, the children are not stored in shards based on their ID hash but based on their parent ID hash: the standard GET
document doesn't work because a parent ID or routing value is required.
The ids
query allows you to match documents by their IDs, spreading the query in all the searchable shards.
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...