compound-queries.asciidoc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [[compound-queries]]
  2. == Compound queries
  3. Compound queries wrap other compound or leaf queries, either to combine their
  4. results and scores, to change their behaviour, or to switch from query to
  5. filter context.
  6. The queries in this group are:
  7. <<query-dsl-constant-score-query,`constant_score` query>>::
  8. A query which wraps another query, but executes it in filter context. All
  9. matching documents are given the same ``constant'' `_score`.
  10. <<query-dsl-bool-query,`bool` query>>::
  11. The default query for combining multiple leaf or compound query clauses, as
  12. `must`, `should`, `must_not`, or `filter` clauses. The `must` and `should`
  13. clauses have their scores combined -- the more matching clauses, the better --
  14. while the `must_not` and `filter` clauses are executed in filter context.
  15. <<query-dsl-dis-max-query,`dis_max` query>>::
  16. A query which accepts multiple queries, and returns any documents which match
  17. any of the query clauses. While the `bool` query combines the scores from all
  18. matching queries, the `dis_max` query uses the score of the single best-
  19. matching query clause.
  20. <<query-dsl-function-score-query,`function_score` query>>::
  21. Modify the scores returned by the main query with functions to take into
  22. account factors like popularity, recency, distance, or custom algorithms
  23. implemented with scripting.
  24. <<query-dsl-boosting-query,`boosting` query>>::
  25. Return documents which match a `positive` query, but reduce the score of
  26. documents which also match a `negative` query.
  27. include::constant-score-query.asciidoc[]
  28. include::bool-query.asciidoc[]
  29. include::dis-max-query.asciidoc[]
  30. include::function-score-query.asciidoc[]
  31. include::boosting-query.asciidoc[]