June 2017
Beginner to intermediate
404 pages
8h 22m
English
As we discussed in the previous section, when we have an array of objects, the array is flattened due to which the object relations don't exist anymore. To solve this, Elasticsearch provides nested datatype. When you use nested datatype, each object in the array is indexed as a new document internally. Since the objects are handled internally as separate documents, you have to use a special type of query to query nested documents. We will discuss nested queries and sorting in the Handling document relations using nested section of Chapter 7, More than a search engine.
The mapping for the address field can be set as nested, as shown next:
{ "properties": { "id": { "type": "integer" }, "name": { "type": "keyword" }, "address_nested": ...Read now
Unlock full access