应用场景:
希望 包含了 某项内容的结果 不是不出现,
而是 排序靠后。
example :
curl -X GET "localhost:9200/_search?pretty" -H 'Content-Type: application/json' -d'
{
"query": {
"boosting" : {
"positive" : {
"term" : {
"text" : "apple"
}
},
"negative" : {
"term" : {
"text" : "pie tart fruit crumble tree"
}
},
"negative_boost" : 0.5
}
}
}
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.
参考地址
https://www.elastic.co/guide/en/elasticsearch/reference/7.1/query-dsl-boosting-query.html
网友评论