Skip to content

Commit

Permalink
[DOCS] Rewrite constant_score query (#43374)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig committed Jun 21, 2019
1 parent 359b103 commit 014fd19
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions docs/reference/query-dsl/constant-score-query.asciidoc
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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.

0 comments on commit 014fd19

Please sign in to comment.