Using parent-child relationships

In the previous section, we discussed the ability to index nested documents along with a parent one. However, even though the nested documents are indexed as separate documents in the index, we can't change a single nested document (unless we use the update API). However, ElasticSearch allows us to have a real parent-child relationship and we will look at it in the following sections.

Mappings and indexing

Let's use our previous example with the clothing store. However, what we would like to have is the ability to update sizes and colors without the need of indexing the whole document after each change. In order to do that, we will use the parent-child functionality of ElasticSearch.

Creating parent mappings

So now, ...

Get ElasticSearch Server now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.