[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]] [[query-dsl-constant-score-query]]
=== Constant Score Query === Constant Score Query
A query that wraps another query and simply returns a Wraps a <<query-dsl-bool-query, filter query>> and returns every matching
constant score equal to the query boost for every document in the document with a <<query-filter-context, relevance score>> equal to the `boost`
filter. Maps to Lucene `ConstantScoreQuery`. parameter value.
[source,js] [source,js]
-------------------------------------------------- ----
GET /_search GET /_search
{ {
"query": { "query": {
@ -18,8 +18,22 @@ GET /_search
} }
} }
} }
-------------------------------------------------- ----
// CONSOLE // CONSOLE
Filter clauses are executed in <<query-filter-context,filter context>>, [[constant-score-top-level-params]]
meaning that scoring is ignored and clauses are considered for caching. ==== 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.