WARNING: Version 2.1 of Elasticsearch has passed its EOL date.
This documentation is no longer being maintained and may be removed. If you are running this version, we strongly advise you to upgrade. For the latest information, see the current release documentation.
Parent/Child changes
editParent/Child changes
editParent/child has been rewritten completely to reduce memory usage and to
execute has_child
and has_parent
queries faster and more efficient. The
_parent
field uses doc values by default. The refactored and improved
implementation is only active for indices created on or after version 2.0.
In order to benefit from all the performance and memory improvements, we
recommend reindexing all existing indices that use the _parent
field.
Parent type cannot pre-exist
editA mapping type is declared as a child of another mapping type by specifying
the _parent
meta field:
DELETE * PUT my_index { "mappings": { "my_parent": {}, "my_child": { "_parent": { "type": "my_parent" } } } }
The mapping for the parent type can be added at the same time as the mapping for the child type, but cannot be added before the child type.
top_children
query removed
editThe top_children
query has been removed in favour of the has_child
query.
It wasn’t always faster than the has_child
query and the results were usually
inaccurate. The total hits and any aggregations in the same search request
would be incorrect if top_children
was used.