elasticsearch 布尔查询相关

 must查询是会根据相关度评分来返回

filter是不计算评分的,

所以查询时优先考虑用filter

bool=>must 查询语法

GET accounts/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "term": {
            "address": "road"
          }
        },
        {
          "range": {
            "age": {
              "gt": 10
            }
          }
        }
      ]
    }
  }
}
bool=>filter查询语法

GET accounts/_search
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "address": "road"
          }
        },
        {
          "range": {
            "age": {
              "gt": 10
            }
          }
        }
      ]
    }
  }
}

你可能感兴趣的:(Elasticsearch,elasticsearch,大数据,搜索引擎)