ES查询tags字段为空或null

现需要查询出tags为 "" 或者为 null 的数据

{
  "query": {
    "bool": {
      "must": {
        "match_all": {}
      },
      "filter": [
        {
          "terms": {
            "_id": [
              "ec5db526a7b32bdd1f6ac865cf830436",
              "e0422a0641334293810275a5302b5014"
            ]
          }
        },
        {
          "bool": {
            "should": [
              {
                "term": {
                  "tags": ""
                }
              },
              {
                "bool": {
                  "must_not": [
                    {
                      "exists": {
                        "field": "tags"
                      }
                    }
                  ]
                }
              }
            ]
          }
        }
      ]
    }
  },
  "size": 100,
  "sort": [],
  "_source": [
    "uuid",
    "tags"
  ]
}
posted @ 2017-07-15 16:55  0xcafedaddy  阅读(26475)  评论(0编辑  收藏  举报