Constant score query
Wraps a filter query and returns every matching document with a relevance score equal to the boost
parameter value.
包装过滤查询,返回的每个相关文档的相关性得分等于boost
参数的值。
GET /_search
{
"query": {
"constant_score" : {
"filter" : {
"term" : { "user" : "kimchy"}
},
"boost" : 1.2
}
}
}
Copy as cURLView in Console
Top-level parameters for constant_score
constant_score
的一级参数
-
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.
(必需,查询对象)希望执行的过滤查询。任何返回的文档都必须与此查询匹配。
过滤查询不计算相关性分数。为了提高性能,Elasticsearch自动缓存经常使用的过滤查询。
-
boost
(Optional, float) Floating point number used as the constant relevance score for every document matching the
filter
query. Defaults to1.0
.(可选,float)浮点数,用于为匹配过滤查询的每个文档设定恒定的 相关性得分。默认为
1.0
。