0
我試圖執行elasticsearch查詢作爲POST
請求,以便從我創建的索引中提取數據。索引中的數據是來自MySQL DB的表格,通過logstash
配置。我如何在我的elasticsearch查詢中追加時間戳範圍?
這裏是我的要求和JSON
體:
http://localhost:9200/response_summary/_search
身體:
{
"query": {
"query_string": {
"query": "transactionoperationstatus:\"charged\" AND api:\"payment\" AND operatorid:\"XL\" AND userid:*test AND time:\"2015-05-27*\" AND responsecode:(200+201)"
}
},
"aggs": {
"total": {
"terms": {
"field": "userid"
},
"aggs": {
"total": {
"sum": {
"script": "Double.parseDouble(doc['chargeamount'].value)"
}
}
}
}
}
}
在上面JSON
身體,我需要我的timestamp
追加到query_string
在在日期範圍內從索引獲取數據。我嘗試添加在查詢作爲結束:
AND timestamp:[2015-05-27T00:00:00.128Z+TO+2015-05-27T23:59:59.128Z]"
我要去哪裏錯了?任何幫助,將不勝感激。
感謝它的工作。 :) – Kulasangar
很酷。同時刪除'(200 + 201)'中的'+' – Val