# How to get count for each type across all indexes

**URL:** https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810
**Category:** Elasticsearch
**Created:** [October 1, 2013, 12:59am UTC](https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810 "2013-10-01T00:59:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Alexander\_Gray\_II](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_gray_ii/32/1669_2.png) [@Alexander\_Gray\_II](https://discuss.elastic.co/u/Alexander_Gray_II)
#### Post date: [October 1, 2013, 12:59am UTC](https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810/1 "2013-10-01T00:59:27Z")

</div>

I'm just getting my feet wet with ES and I'm using the Head Plugin to  
examine my logstash messages coming in.

One thing we're interested in is finding the document count for each type.  
I figured out how to get all Types:  
curl -XGET '[http://localhost:9200/\_mapping](http://localhost:9200/_mapping)'

But now I want to cycle through all Types and get the total doc count  
across all indexes.  
I assume it's like:  
curl -XGET '[http://localhost:9200/\_all/[TYPE]/\_search](http://localhost:9200/_all/%5BTYPE%5D/_search)'

Is there a better way to do this?  
Thanks!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [October 1, 2013, 7:40am UTC](https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810/2 "2013-10-01T07:40:20Z")

</div>

Hey,

have you tried just executing

[http://localhost:9200/\_all/TYPE/\_count](http://localhost:9200/_all/TYPE/_count) - should do what you need, unless I  
didnt have enough coffee (simply returns a count instead of search results).

--Alex

On Tue, Oct 1, 2013 at 2:59 AM, Alexander Gray II [grayaii@gmail.com](mailto:grayaii@gmail.com) wrote:

> I'm just getting my feet wet with ES and I'm using the Head Plugin to  
> examine my logstash messages coming in.
> 
> One thing we're interested in is finding the document count for each type.  
> I figured out how to get all Types:  
> curl -XGET '[http://localhost:9200/\_mapping](http://localhost:9200/_mapping)'
> 
> But now I want to cycle through all Types and get the total doc count  
> across all indexes.  
> I assume it's like:  
> curl -XGET '[http://localhost:9200/\_all/[TYPE]/\_search](http://localhost:9200/_all/%5BTYPE%5D/_search)'
> 
> Is there a better way to do this?  
> Thanks!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Alexander\_Gray\_II](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexander_gray_ii/32/1669_2.png) [@Alexander\_Gray\_II](https://discuss.elastic.co/u/Alexander_Gray_II)
#### Post date: [October 1, 2013, 12:15pm UTC](https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810/3 "2013-10-01T12:15:36Z")

</div>

Awesome. Just making sure I was on the right track.  
Thanks!  
Alex

On Tuesday, October 1, 2013 3:40:20 AM UTC-4, Alexander Reelsen wrote:

> Hey,
> 
> have you tried just executing
> 
> [http://localhost:9200/\_all/TYPE/\_count](http://localhost:9200/_all/TYPE/_count) - should do what you need, unless  
> I didnt have enough coffee (simply returns a count instead of search  
> results).
> 
> --Alex
> 
> On Tue, Oct 1, 2013 at 2:59 AM, Alexander Gray II \<[gra...@gmail.com](mailto:gra...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I'm just getting my feet wet with ES and I'm using the Head Plugin to  
> > examine my logstash messages coming in.
> > 
> > One thing we're interested in is finding the document count for each type.  
> > I figured out how to get all Types:  
> > curl -XGET '[http://localhost:9200/\_mapping](http://localhost:9200/_mapping)'
> > 
> > But now I want to cycle through all Types and get the total doc count  
> > across all indexes.  
> > I assume it's like:  
> > curl -XGET '[http://localhost:9200/\_all/[TYPE]/\_search](http://localhost:9200/_all/%5BTYPE%5D/_search)'
> > 
> > Is there a better way to do this?  
> > Thanks!
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 2:14am UTC](https://discuss.elastic.co/t/how-to-get-count-for-each-type-across-all-indexes/13810/4 "2017-07-06T02:14:06Z")

</div>


