IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Joining queries
editJoining queries
editPerforming full SQL-style joins in a distributed system like Elasticsearch is prohibitively expensive. Instead, Elasticsearch offers two forms of join which are designed to scale horizontally.
-
nested
query -
Documents may contains fields of type
nested
. These fields are used to index arrays of objects, where each object can be queried (with thenested
query) as an independent document. -
has_child
andhas_parent
queries -
A parent-child relationship can exist between two
document types within a single index. The
has_child
query returns parent documents whose child documents match the specified query, while thehas_parent
query returns child documents whose parent document matches the specified query.
Nested Query
editSee Nested Query
Has Child Query
editSee Has Child Query
Has Parent Query
editSee Has Parent