TIme interval searchs in elasticsearch


(brian) #1

I'm attempting to use some curl searches into elastic search. I'm looking to pull out the average of a field over the past 15 minutes. Right now I can only pull that data from the entire index. I have my query below, what would I need to add to only get the averages for the past 15 minutes? Thanks!!!

curl -XPOST '127.0.0.1:9200/'"$Index"'/'"$Type"'/_search?pretty' -d '
{
"size": 0,
"aggs": {
"group_by_Backend" : {
"terms": {
"field": "Backend",
"order": {
"average_resp_time": "desc"
}
},
"aggs": {
"average_resp_time": {
"avg": {
"field": "RspTime"
}
}
}
}
}
}'


(system) #2