+
 新版

ElasticSearch下三种不同查询语句的区别

雨木木1988 发布于 2021/07/20 17:22
阅读 427
收藏 0
// 索引结构信息
{
   "game_meta_info": {
      "mappings": {
         "properties": {
            "gameName": {
               "type": "text"
            }
         }
      }
   }
}

// 查询1
{
  "query": {
    "term": {
      "gameName": {
        "value": "fps",
        "boost": 1
      }
    }
  }
}

// 查询2
{
  "query": {
    "constant_score": {
      "filter": {
        "term": {
          "gameName": {
            "value": "fps",
            "boost": 1
          }
        }
      },
      "boost": 1
    }
  }
}

// 查询3
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "gameName": {
              "value": "fps",
              "boost": 1
            }
          }
        }
      ],
      "adjust_pure_negative": true,
      "boost": 1
    }
  }
}

以上三种查询对于底层解析、执行有什么区别。性能方面有什么区别。迷惑点”query“、”filter“、”_score“。

 

 

加载中
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部