Skip to content

Commit 22ff603

Browse files
committed
[DOCS] Rewrite constant_score query (#43374)
1 parent e17a024 commit 22ff603

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed
Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[[query-dsl-constant-score-query]]
22
=== Constant Score Query
33

4-
A query that wraps another query and simply returns a
5-
constant score equal to the query boost for every document in the
6-
filter. Maps to Lucene `ConstantScoreQuery`.
4+
Wraps a <<query-dsl-bool-query, filter query>> and returns every matching
5+
document with a <<query-filter-context, relevance score>> equal to the `boost`
6+
parameter value.
77

88
[source,js]
9-
--------------------------------------------------
9+
----
1010
GET /_search
1111
{
1212
"query": {
@@ -18,8 +18,22 @@ GET /_search
1818
}
1919
}
2020
}
21-
--------------------------------------------------
21+
----
2222
// CONSOLE
2323

24-
Filter clauses are executed in <<query-filter-context,filter context>>,
25-
meaning that scoring is ignored and clauses are considered for caching.
24+
[[constant-score-top-level-params]]
25+
==== Top-level parameters for `constant_score`
26+
`filter`::
27+
+
28+
--
29+
<<query-dsl-bool-query, Filter query>> you wish to run. Any returned documents
30+
must match this query. Required.
31+
32+
Filter queries do not calculate <<query-filter-context, relevance scores>>. To
33+
speed up performance, {es} automatically caches frequently used filter queries.
34+
--
35+
36+
`boost`::
37+
Floating point number used as the constant <<query-filter-context, relevance
38+
score>> for every document matching the `filter` query. Default is `1.0`.
39+
Optional.

0 commit comments

Comments
 (0)