| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 | [[java-compound-queries]]=== Compound queriesCompound queries wrap other compound or leaf queries, either to combine theirresults and scores, to change their behaviour, or to switch from query tofilter context.The queries in this group are:<<java-query-dsl-constant-score-query,`constant_score` query>>::A query which wraps another query, but executes it in filter context.  Allmatching documents are given the same ``constant'' `_score`.<<java-query-dsl-bool-query,`bool` query>>::The default query for combining multiple leaf or compound query clauses, as`must`, `should`, `must_not`, or `filter` clauses.  The `must` and `should`clauses have their scores combined -- the more matching clauses, the better --while the `must_not` and `filter` clauses are executed in filter context.<<java-query-dsl-dis-max-query,`dis_max` query>>::A query which accepts multiple queries, and returns any documents which matchany of the query clauses.  While the `bool` query combines the scores from allmatching queries, the `dis_max` query uses the score of the single best-matching query clause.<<java-query-dsl-function-score-query,`function_score` query>>::Modify the scores returned by the main query with functions to take intoaccount factors like popularity, recency, distance, or custom algorithmsimplemented with scripting.<<java-query-dsl-boosting-query,`boosting` query>>::Return documents which match a `positive` query, but reduce the score ofdocuments which also match a `negative` query.include::constant-score-query.asciidoc[]include::bool-query.asciidoc[]include::dis-max-query.asciidoc[]include::function-score-query.asciidoc[]include::boosting-query.asciidoc[]
 |