elasticsearch旧版本filtered替换

elasticsearch旧版本filtered替换
从es的5.0版本开始,原先的filtered语句,类似

GET _search
{
  "query": {
    "filtered": {
      "query": {
        "match": {
          "text": "quick brown fox"
        }
      },
      "filter": {
        "term": {
          "status": "published"
        }
      }
    }
  }
}

被淘汰,对应的替换语法是

GET _search
{
  "query": {
    "bool": {
      "must": {
        "match": {
          "text": "quick brown fox"
        }
      },
      "filter": {
        "term": {
          "status": "published"
        }
      }
    }
  }
}

只是结构有了简单变化,其他不变。
参见:https://www.elastic.co/guide/en/elasticsearch/reference/5.0/query-dsl-filtered-query.html

你可能感兴趣的:(elasticsearch旧版本filtered替换)