【问题标题】:How to use must filter with range and terms in elasticsearch 1.4.5如何在 elasticsearch 1.4.5 中使用必须过滤范围和术语
【发布时间】:2016-06-15 12:22:10
【问题描述】:

我必须找到从“今天”开始的数据,并且它的“显示状态”必须为零。我正在使用它,但它也会返回显示状态为一的文档。

$searchParams['index'] = 'events';  
$searchParams['type'] = 'couchbaseDocument';  
$searchParams['from'] = 0;  
$searchParams['size'] = 1000;  
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['range']['starttimestamp']['from'] = $today;  
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['term']['displaystatus'] = 0;  
$searchParams['body']['query']['filtered']['filter']['bool']['must'][]['terms']['cat_id'] = $interestIdArray;

【问题讨论】:

    标签: php elasticsearch couchbase


    【解决方案1】:

    我不确定 python,但类似这样的东西

    {
      "query": {
        "filtered": {
    
          "filter": {
            "bool": {
              "must": [
                {
                  "range": {
                    "FIELD": {
                      "gte": ,
                      "lte": 
                    }
                  }
                },
                {
                  "term": {
                    "FIELD": "VALUE"
                  }
                },
                {
                  "term": {
                    "FIELD": "VALUE"
                  }
                }
              ]
            }
          }
        }
      }
    }
    

    应该在惊奇中工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-09-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-22
      • 1970-01-01
      • 2018-04-26
      • 2016-10-07
      相关资源
      最近更新 更多