# How to get a count by index id

**URL:** https://discuss.elastic.co/t/how-to-get-a-count-by-index-id/94958
**Category:** Elasticsearch
**Created:** [July 28, 2017, 1:22pm UTC](https://discuss.elastic.co/t/how-to-get-a-count-by-index-id/94958 "2017-07-28T13:22:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![spraveenjd](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spraveenjd](https://discuss.elastic.co/u/spraveenjd)
#### Post date: [July 28, 2017, 1:22pm UTC](https://discuss.elastic.co/t/how-to-get-a-count-by-index-id/94958/1 "2017-07-28T13:22:02Z")

</div>

Help with the query how to get count of each index on a specified time frame

---

<div class="post-metadata">

### Author: ![spraveenjd](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@spraveenjd](https://discuss.elastic.co/u/spraveenjd)
#### Post date: [July 28, 2017, 1:23pm UTC](https://discuss.elastic.co/t/how-to-get-a-count-by-index-id/94958/2 "2017-07-28T13:23:38Z")

</div>

Use the below query to get it  
curl -XGET "[http://localhost:9200/index\*/\_search](http://localhost:9200/index*/_search)" -H 'Content-Type: application/json' -d'  
{  
"query": {  
"bool": {  
"filter": {  
"range": {  
"@timestamp": {  
"gte": "now-2d",  
"lt": "now"  
}  
}  
}  
}  
}, "size" : 0,  
"aggs" : {  
"keywords" : {  
"significant\_terms" : {  
"field" : "\_index"  
}  
}  
}  
}'

---

<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: [August 25, 2017, 1:23pm UTC](https://discuss.elastic.co/t/how-to-get-a-count-by-index-id/94958/3 "2017-08-25T13:23:41Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
