Elasticsearch does not only support simple unrelated documents, it also lets you define a hierarchy based on parents and children. The has_child query allows you to query for parent documents of children by matching other queries.
Using the has_child query
Getting ready
As we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started, you need an up and running Elasticsearch installation to execute the current recipe code.
To execute the code in the following section, any HTTP client can be used. This includes curl (https://curl.haxx.se/), Postman (https://www.getpostman.com/), or other similar versions. I suggest using Kibana console, as this provides the code completion...