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:
| Query type | Description |
|---|---|
nested | Acts as a wrapper for other queries to search nested fields. The nested field objects are searched as though they were indexed as separate documents. |
has_child | Searches for parent documents whose child documents match the query. Requires a join field type. |
has_parent | Searches for child documents whose parent documents match the query. Requires a join field type. |
parent_id | Searches for child documents that are joined to a specific parent document. Requires a join field type. |
If search.allow_expensive_queries is set to false, then joining queries are not executed.