June 2017
Beginner to intermediate
404 pages
8h 22m
English
Elasticsearch stores the parent and child documents in the same shard. Having both the parent and child documents in the same shard will make the has_parent and has_child queries possible. The parent ID is used to determine the shard to which the child document belongs to. To index or retrieve a child document, you need the parent ID. We index a child document (product_review) as shown here:
#Child Document POST chapter7/product_review/?parent=1 {"user_id" : "reviewer1", "comment" : "One of the best phones in the market"}
When using parent-child, you are trading indexing performance for query performance. Internally, Elasticsearch has to maintain a join between the parent documents and child documents. ...
Read now
Unlock full access