-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Elasticsearch 7.0 Cookbook
By :

In the previous recipe, we saw the has_child
query. Elasticsearch provides a query to search child documents based on the parent query, has_parent
.
You need an up and running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
To execute these commands, I suggest using the Kibana console, as this 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
commands, which is available in the online code. The index that's used in this recipe is mybooks-join
.
To execute the has_parent
query, we will perform the following steps:
author
of the parents book
that has the term joe
in the description
field. We can create this kind of query using the following code:POST /mybooks-join/_search { "query": { ...