当我使用curl执行以下查询时
curl -XGET 'http://localhost:9200/logstash*/_search' -d '{ "query" : { "filter" : [ "range" : { "timestamp" : {"gt" : "2017-02-01 00:00:00","lt" : "2017-05-01 00:00:00"}}]}}'
我收到以下错误
{"error":{"root_cause":[{"type":"parsing_exception","reason":"[filter] query malformed, no start_object after query name","line":1,"col":26}],"type":"parsing_exception","reason":"[filter] query malformed, no start_object after query name","line":1,"col":26},"status":400}
但是如果我使用感知插件上面的查询执行日期范围过滤器,它运行正常。
弹性版本5.2
此致 KUNAL
答案 0 :(得分:1)
您只需将查询更改为:
curl -XGET 'http://localhost:9200/logstash*/_search' -d '{
"query": {
"bool": {
"filter": {
"range": {
"timestamp": {
"gt": "2017-02-01 00:00:00",
"lt": "2017-05-01 00:00:00"
}
}
}
}
}
}'