Boosting Query
Returns documents matching a positive
query while reducing the relevance score of documents that also match a negative
query.
可以为返回的文档匹配一个positive
查询和一个negative
查询,positive
查询对文档的相关性得分没有影响,而negative
查询会降低文档的 相关性得分。
You can use the boosting
query to demote certain documents without excluding them from the search results.
您可以使用boosting
查询使某些文档降级,而不必将它们从搜索结果中排除。
Example request
GET /_search
{
"query": {
"boosting" : {
"positive" : {
"term" : {
"text" : "apple"
}
},
"negative" : {
"term" : {
"text" : "pie tart fruit crumble tree"
}
},
"negative_boost" : 0.5
}
}
}
Copy as cURLView in Console
Top-level parameters for boosting
boosting的一级参数
-
positive
(Required, query object) Query you wish to run. Any returned documents must match this query.
(必需,查询对象)您希望运行的查询。任何返回的文档都必须与此查询匹配。
-
negative
(Required, query object) Query used to decrease the relevance score of matching documents.If a returned document matches the
positive
query and this query, theboosting
query calculates the final relevance score for the document as follows:Take the original relevance score from thepositive
query.Multiply the score by thenegative_boost
value.(必需,查询对象)查询用来降低匹配文档的相关性得分。如果返回的文档匹配
positive
查询和此查询,则该boosting
查询将按如下方式计算该文档的最终相关性得分:从positive
查询中获取原始的相关性分数,再将分数乘以negative_boost
值。 -
negative_boost
(Required, float) Floating point number between
0
and1.0
used to decrease the relevance scores of documents matching thenegative
query.(必需,浮点数)介于
0
和1.0
之间的浮点数,用于降低匹配negative
查询的文档的相关性得分。
来源:CSDN
作者:oowgsoo
链接:https://blog.csdn.net/oowgsoo/article/details/104161727