原文地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/query-dsl-constant-score-query.html, 原文档版权归 www.elastic.co 所有
IMPORTANT: No additional bug fixes or documentation updates
will be released for this version. For the latest information, see the
current release documentation.
Constant score queryedit
Wraps a filter query and returns every matching
document with a relevance score equal to the boost
parameter value.
GET /_search { "query": { "constant_score" : { "filter" : { "term" : { "user" : "kimchy"} }, "boost" : 1.2 } } }
Top-level parameters for constant_score
edit
-
filter
-
(Required, query object) Filter query you wish to run. Any returned documents must match this query.
Filter queries do not calculate relevance scores. To speed up performance, Elasticsearch automatically caches frequently used filter queries.
-
boost
-
(Optional, float) Floating point number used as the constant
relevance score for every document matching the
filter
query. Defaults to1.0
.