ES-NOT,ANT,OR多条件查询

GET colordata_eureka/baseinfo/_search
{
  "size": 1000,
  "_source": [
    "Campaign",
    "MainBrand",
    "NumberofReplys",
    "replyDate",
    "SearchBrand"
  ],
  "query": {
    "bool": {
      "must_not": [
        {
          "exists": {
            "field": "NumberofReplys"
          }
        }
      ],
      "should": [
        {
          "exists": {
            "field": "Campaign"
          }
        },
        {
          "exists": {
            "field": "MainBrand"
          }
        }
      ],
      "must": [
        {
          "term": {
            "realChannel": {
              "value": "weixin"
            }
          }
        },
        {
          "range": {
            "replyDate": {
              "gte": "2021-11-11 00:00:00",
              "format": "yyyy-MM-dd HH:mm:ss"
            }
          }
        },
        {
          "term": {
            "thread": {
              "value": "0"
            }
          }
        }
      ]
    }
  }
}

注释:

查询NumberofReplys不存在 ,Campaign或者MainBrand里面有值的,并且渠道为微信,发布时间为11月11号,帖子类型为主贴的前1000条数据 展示字段为: 【"Campaign", "MainBrand", "NumberofReplys", "replyDate", "SearchBrand"】

posted @ 2021-11-11 19:10  BruceLong  阅读(349)  评论(1编辑  收藏  举报