Can someone explain what is a difference between "object" and "nested" fields in documents in Elasticsearch?
I know by default field is defined as object. I also know that I can access object field with a dot like this: my_field.name, my_field.title etc.
Documentation for object: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-object-type.html Documentation for nestes:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-nested-type.html
but I still cant understand a difference...
The nested type is a specialised 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.
When a packed class contains an instance field that is a packed type, the data for that field is packed directly into the containing class. The field is known as a nested field . When reading from a nested field, a small object is created as a pointer to the data.
Nested queryedit. Wraps another query to search nested fields. The nested query searches nested field objects as if they were indexed as separate documents. If an object matches the search, the nested query returns the root parent document.
Nested data types are structured data types for some common data patterns. Nested data types support structs, arrays, and maps. A struct is similar to a relational table. It groups object properties together.
What your are calling "object" is probably "inner object" in elasticsearch.
Check this link to see the differences
https://web.archive.org/web/20140810095505/http://www.elasticsearch.org/blog/managing-relations-inside-elasticsearch/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With