# TIme interval searchs in elasticsearch

**URL:** https://discuss.elastic.co/t/time-interval-searchs-in-elasticsearch/40971
**Category:** Elasticsearch
**Created:** [February 4, 2016, 2:28pm UTC](https://discuss.elastic.co/t/time-interval-searchs-in-elasticsearch/40971 "2016-02-04T14:28:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![bmbost](https://avatars.discourse-cdn.com/v4/letter/b/48db29/32.png) [@bmbost](https://discuss.elastic.co/u/bmbost)
#### Post date: [February 4, 2016, 2:28pm UTC](https://discuss.elastic.co/t/time-interval-searchs-in-elasticsearch/40971/1 "2016-02-04T14:28:46Z")

</div>

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"  
}  
}  
}  
}  
}  
}'

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/time-interval-searchs-in-elasticsearch/40971/2 "2017-07-05T23:18:53Z")

</div>


