es boosting-query

应用场景:
希望 包含了 某项内容的结果 不是不出现,
而是 排序靠后。

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章