joining-queries.asciidoc 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. [[joining-queries]]
  2. == Joining queries
  3. Performing full SQL-style joins in a distributed system like Elasticsearch is
  4. prohibitively expensive. Instead, Elasticsearch offers two forms of join
  5. which are designed to scale horizontally.
  6. <<query-dsl-nested-query,`nested` query>>::
  7. Documents may contains fields of type <<mapping-nested-type,`nested`>>. These
  8. fields are used to index arrays of objects, where each object can be queried
  9. (with the `nested` query) as an independent document.
  10. <<query-dsl-has-child-query,`has_child`>> and <<query-dsl-has-parent-query,`has_parent`>> queries::
  11. A <<mapping-parent-field,parent-child relationship>> can exist between two
  12. document types within a single index. The `has_child` query returns parent
  13. documents whose child documents match the specified query, while the
  14. `has_parent` query returns child documents whose parent document matches the
  15. specified query.
  16. Also see the <<query-dsl-terms-lookup,terms-lookup mechanism>> in the `terms`
  17. query, which allows you to build a `terms` query from values contained in
  18. another document.
  19. include::nested-query.asciidoc[]
  20. include::has-child-query.asciidoc[]
  21. include::has-parent-query.asciidoc[]