1. 程式人生 > 其它 >ES-NOT,ANT,OR多條件查詢

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"】