2015-06-03 19:59:22 -04:00
|
|
|
[[compound-queries]]
|
|
|
|
== Compound queries
|
|
|
|
|
|
|
|
Compound queries wrap other compound or leaf queries, either to combine their
|
|
|
|
results and scores, to change their behaviour, or to switch from query to
|
|
|
|
filter context.
|
|
|
|
|
|
|
|
The queries in this group are:
|
|
|
|
|
|
|
|
<<query-dsl-constant-score-query,`constant_score` query>>::
|
|
|
|
|
|
|
|
A query which wraps another query, but executes it in filter context. All
|
|
|
|
matching documents are given the same ``constant'' `_score`.
|
|
|
|
|
|
|
|
<<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.
|
|
|
|
|
|
|
|
<<query-dsl-dis-max-query,`dis_max` query>>::
|
|
|
|
|
|
|
|
A query which accepts multiple queries, and returns any documents which match
|
|
|
|
any of the query clauses. While the `bool` query combines the scores from all
|
|
|
|
matching queries, the `dis_max` query uses the score of the single best-
|
|
|
|
matching query clause.
|
|
|
|
|
|
|
|
<<query-dsl-function-score-query,`function_score` query>>::
|
|
|
|
|
|
|
|
Modify the scores returned by the main query with functions to take into
|
|
|
|
account factors like popularity, recency, distance, or custom algorithms
|
|
|
|
implemented with scripting.
|
|
|
|
|
|
|
|
<<query-dsl-boosting-query,`boosting` query>>::
|
|
|
|
|
|
|
|
Return documents which match a `positive` query, but reduce the score of
|
|
|
|
documents which also match a `negative` query.
|
|
|
|
|
|
|
|
<<query-dsl-indices-query,`indices` query>>::
|
|
|
|
|
|
|
|
Execute one query for the specified indices, and another for other indices.
|
|
|
|
|
|
|
|
<<query-dsl-and-query,`and`>>, <<query-dsl-or-query,`or`>>, <<query-dsl-not-query,`not`>>::
|
|
|
|
|
|
|
|
Synonyms for the `bool` query.
|
|
|
|
|
|
|
|
<<query-dsl-filtered-query,`filtered` query>>::
|
|
|
|
|
2015-08-14 04:51:09 -04:00
|
|
|
Combine a query clause in query context with another in filter context. deprecated[2.0.0-beta1,Use the `bool` query instead]
|
2015-06-03 19:59:22 -04:00
|
|
|
|
|
|
|
<<query-dsl-limit-query,`limit` query>>::
|
|
|
|
|
2015-08-14 04:51:09 -04:00
|
|
|
Limits the number of documents examined per shard.
|
2015-06-03 19:59:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
include::constant-score-query.asciidoc[]
|
|
|
|
include::bool-query.asciidoc[]
|
|
|
|
include::dis-max-query.asciidoc[]
|
|
|
|
include::function-score-query.asciidoc[]
|
|
|
|
include::boosting-query.asciidoc[]
|
|
|
|
include::indices-query.asciidoc[]
|
|
|
|
include::and-query.asciidoc[]
|
|
|
|
include::not-query.asciidoc[]
|
|
|
|
include::or-query.asciidoc[]
|
|
|
|
include::filtered-query.asciidoc[]
|
|
|
|
include::limit-query.asciidoc[]
|
|
|
|
|
|
|
|
|