June 2017
Beginner to intermediate
404 pages
8h 22m
English
Just like children aggregation, aggregation on nested documents is also supported. The product variations are stored as nested documents. A sample product document is as follows:
PUT chapter8/product/2?refresh=true { "product_name": "iPhone 7", "manufacturer": "Apple", "variations": [ #Nested documents { "color": "Rose Gold", "storage": "128GB", "unit_price": "900" }, { "color": "Rose Gold", "storage": "64GB", "unit_price": "800" } ] }
Suppose we want to find the storage options available for each color. First, we group the products by their color using terms aggregations and then aggregate using the storage. Just like children aggregation, to run aggregation on nested document, the path should be mentioned ...
Read now
Unlock full access