2017-04-21 146 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" 
     } 
    } 
    ] 
}