2017-04-21 126 views
3

我正在针对AWS Elasticsearch 5.1运行此查询并获取格式错误的查询错误。这是请求的主体。我基本上只是检查该字段是否存在于时间范围内。查询格式不正确,查询名称后没有start_object

{ 
    "query": { 
    "bool": { 
     "filter": { 
     "bool": { 
      "must": [ 
      { 
       "range": { 
       "@timestamp": { 
        "gt": "2017-03-21T15:37:08.595919Z", 
        "lte": "2017-04-21T15:52:08.595919Z" 
       } 
       } 
      }, 
      { 
       "query": [ 
       { 
        "query_string": { 
        "query": "_exists_: $event.supplier" 
        } 
       } 
       ] 
      } 
      ] 
     } 
     } 
    } 
    }, 
    "sort": [ 
    { 
     "@timestamp": { 
     "order": "asc" 
     } 
    } 
    ] 
} 

回答

4

第二must说法是不正确的:

{ 
    "query": { 
    "bool": { 
     "filter": { 
     "bool": { 
      "must": [ 
      { 
       "range": { 
       "@timestamp": { 
        "gt": "2017-03-21T15:37:08.595919Z", 
        "lte": "2017-04-21T15:52:08.595919Z" 
       } 
       } 
      }, 
      { 
       "query_string": { 
       "query": "_exists_: $event.supplier" 
       } 
      } 
      ] 
     } 
     } 
    } 
    }, 
    "sort": [ 
    { 
     "@timestamp": { 
     "order": "asc" 
     } 
    } 
    ] 
}