我正在尝试执行弹性搜索查询作为POST
请求,以便从我创建的索引中提取数据。索引中的数据是来自 MySQL DB 的表,但已配置logstash
。
这是我的要求和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]"
我哪里错了?任何帮助,将不胜感激。