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
positivequery and this query, theboostingquery calculates the final relevance score for the document as follows:Take the original relevance score from thepositivequery.Multiply the score by thenegative_boostvalue.(必需,查询对象)查询用来降低匹配文档的相关性得分。如果返回的文档匹配
positive查询和此查询,则该boosting查询将按如下方式计算该文档的最终相关性得分:从positive查询中获取原始的相关性分数,再将分数乘以negative_boost值。 -
negative_boost(Required, float) Floating point number between
0and1.0used to decrease the relevance scores of documents matching thenegativequery.(必需,浮点数)介于
0和1.0之间的浮点数,用于降低匹配negative查询的文档的相关性得分。
来源:CSDN
作者:oowgsoo
链接:https://blog.csdn.net/oowgsoo/article/details/104161727