美文网首页
es boosting-query

es boosting-query

作者: 良人与我 | 来源:发表于2019-08-07 22:47 被阅读0次

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

    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

    相关文章

      网友评论

          本文标题:es boosting-query

          本文链接:https://www.haomeiwen.com/subject/zkszdctx.html