美文网首页
es 查询 取消打分

es 查询 取消打分

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

    结构化搜索,精确匹配

    DELETE products
    POST /products/_bulk
    { "index": { "_id": 1 }}
    { "price" : 10,"avaliable":true,"date":"2018-01-01", "productID" : "XHDK-A-1293-#fJ3" }
    { "index": { "_id": 2 }}
    { "price" : 20,"avaliable":true,"date":"2019-01-01", "productID" : "KDKE-B-9947-#kL5" }
    { "index": { "_id": 3 }}
    { "price" : 30,"avaliable":true, "productID" : "JODL-X-1937-#pV7" }
    { "index": { "_id": 4 }}
    { "price" : 30,"avaliable":false, "productID" : "QQPX-R-3956-#aD8" }

    GET products/_mapping

    对布尔值 查询,有算分

    POST products/_search
    {
    "profile": "true",
    "explain": true,
    "query": {
    "term": {
    "avaliable": true
    }
    }
    }

    对布尔值,通过constant score 转成 filtering,没有算分

    POST products/_search
    {
    "profile": "true",
    "explain": true,
    "query": {
    "constant_score": {
    "filter": {
    "term": {
    "avaliable": true
    }
    }
    }
    }
    }

    相关文章

      网友评论

          本文标题:es 查询 取消打分

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