You're viewing version 2.16 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.
Joining queries
OpenSearch is a distributed system in which data is spread across multiple nodes. Thus, running a SQL-like JOIN operation in OpenSearch is resource intensive. As an alternative, OpenSearch provides the following queries that perform join operations and are optimized for scaling across multiple nodes:
nestedqueries: Act as wrappers for other queries to search nested fields. The nested field objects are searched as though they were indexed as separate documents.has_childqueries: Search for parent documents whose child documents match the query.has_parentqueries: Search for child documents whose parent documents match the query.parent_idqueries: A join field type establishes a parent/child relationship between documents in the same index.parent_idqueries search for child documents that are joined to a specific parent document.
If search.allow_expensive_queries is set to false, then joining queries are not executed.