[DOCS] Rewrite `constant_score` query (#43374)

This commit is contained in:
James Rodewig 2019-06-21 12:03:19 -04:00
parent 359b103f87
commit 014fd19abd
1 changed files with 21 additions and 7 deletions

View File

@ -1,12 +1,12 @@
[[query-dsl-constant-score-query]]
=== Constant Score Query
A query that wraps another query and simply returns a
constant score equal to the query boost for every document in the
filter. Maps to Lucene `ConstantScoreQuery`.
Wraps a <<query-dsl-bool-query, filter query>> and returns every matching
document with a <<query-filter-context, relevance score>> equal to the `boost`
parameter value.
[source,js]
--------------------------------------------------
----
GET /_search
{
"query": {
@ -18,8 +18,22 @@ GET /_search
}
}
}
--------------------------------------------------
----
// CONSOLE
Filter clauses are executed in <<query-filter-context,filter context>>,
meaning that scoring is ignored and clauses are considered for caching.
[[constant-score-top-level-params]]
==== Top-level parameters for `constant_score`
`filter`::
+
--
<<query-dsl-bool-query, Filter query>> you wish to run. Any returned documents
must match this query. Required.
Filter queries do not calculate <<query-filter-context, relevance scores>>. To
speed up performance, {es} automatically caches frequently used filter queries.
--
`boost`::
Floating point number used as the constant <<query-filter-context, relevance
score>> for every document matching the `filter` query. Default is `1.0`.
Optional.