Member-only story
Learn advanced CRUD and search queries for nested objects in Elasticsearch from practical examples
Elasticsearch can get complex but also powerful
In this article, some advanced CRUD and search queries for nested objects in Elasticsearch will be introduced. We will focus on nested objects, which are advanced topics in Elasticsearch. You can run this command in Kibana to create the index which will be used later.
In this example, the attributes
field is a nested field and contains the attribute_name
and attribure_value
fields as the sub-fields. The nested
type is a specialized version of the object
data type that allows arrays of objects to be indexed in a way that they can be queried independently of each other. We should always create a mapping for a nested field as demonstrated in this example because Elasticsearch has no concept of inner objects and would flatten object hierarchies into a simple list of field names and values, which is normally not what we want.