Es根据字段是否存在及某个字段为空的数据

# 根据条件查询某个字段是否存在或为空的情况   
GET colordata_bbs_series/baseinfo/_search
{
  "size": 1000,
  "query": {
    "bool": {
      "must_not": [
        {
          "regexp": {
            "SearchBrand": {
              "value": ".{0,}"
            }
          }
        },{
          "exists": {
            "field": "NumberofReplys"
          }
        }
      ],
      "must": [
        {
          "term": {
            "ClientID": {
              "value": "M103801"
            }
          }
        },
        {
          "term": {
            "realChannel": {
              "value": "weixin"
            }
          }
        },
        {
          "range": {
            "CreateTime": {
              "gte": "2021-10-26 00:00:00",
              "format": "yyyy-MM-dd HH:mm:ss"
            }
          }
        },
        {
          "term": {
            "thread": {
              "value": "0"
            }
          }
        }
        
      ]
    }
  }
}

 

posted @ 2021-10-26 16:32  BruceLong  阅读(3289)  评论(0编辑  收藏  举报