Indexing data that is not flat

Not all data is flat like the examples we have used in the book until now. Most of the data you will encounter will have some structure and nested objects inside the root JSON object. Of course, if we are building our system that Elasticsearch will be a part of and we are in control of all the pieces of it, we can create a structure that is convenient for Elasticsearch. But even in such cases, flat data is not always an option. Thankfully, Elasticsearch allows us to index data that is not flat and this section will show us how to do that.

Data

Let's assume that we have the following data (we store it in the file called structured_data.json):

{ "author" : { "name" : { "firstName" : "Fyodor", "lastName" : "Dostoevsky" ...

Get Elasticsearch Server - Third Edition 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.