# How to count all records in an index/type?

**URL:** <https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680>\
**Category:** Elasticsearch\
**Created:** [October 25, 2011, 6:29pm UTC](https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680 "2011-10-25T18:29:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Frank\_Hsueh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frank_hsueh/32/2889_2.png) [@Frank\_Hsueh](https://discuss.elastic.co/u/Frank_Hsueh)\
**Post date:** [October 25, 2011, 6:29pm UTC](https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680/1 "2011-10-25T18:29:06Z")

</div>

> > > >

$ curl -XGET '[http://localhost:9200/twitter/tweet/\_count](http://localhost:9200/twitter/tweet/_count)'  
{"error":"No query to execute, not in body, and not bounded to 'q'  
parameter"}  
\<\<\<\<

or should I just use a dummy predicate that will always succeed ?

--  
Frank Hsueh | [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)

---

<div class="post-metadata">

**Author:** ![Frank\_Hsueh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/frank_hsueh/32/2889_2.png) [@Frank\_Hsueh](https://discuss.elastic.co/u/Frank_Hsueh)\
**Post date:** [October 25, 2011, 11:06pm UTC](https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680/2 "2011-10-25T23:06:08Z")

</div>

doh. match\_all

On Tue, Oct 25, 2011 at 11:29 AM, Frank Hsueh [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com) wrote:

> > > > >
> 
> $ curl -XGET '[http://localhost:9200/twitter/tweet/\_count](http://localhost:9200/twitter/tweet/_count)'  
> {"error":"No query to execute, not in body, and not bounded to 'q'  
> parameter"}  
> \<\<\<\<
> 
> or should I just use a dummy predicate that will always succeed ?
> 
> --  
> Frank Hsueh | [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)

--  
Frank Hsueh | [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [October 26, 2011, 3:12am UTC](https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680/3 "2011-10-26T03:12:53Z")

</div>

The query is no longer required in the count API in master (upcoming 0.18)  
🙂

On Wed, Oct 26, 2011 at 1:06 AM, Frank Hsueh [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com) wrote:

> doh. match\_all
> 
> On Tue, Oct 25, 2011 at 11:29 AM, Frank Hsueh [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)wrote:
> 
> > > > > >
> > 
> > $ curl -XGET '[http://localhost:9200/twitter/tweet/\_count](http://localhost:9200/twitter/tweet/_count)'  
> > {"error":"No query to execute, not in body, and not bounded to 'q'  
> > parameter"}  
> > \<\<\<\<
> > 
> > or should I just use a dummy predicate that will always succeed ?
> > 
> > --  
> > Frank Hsueh | [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)
> 
> --  
> Frank Hsueh | [frank.hsueh@gmail.com](mailto:frank.hsueh@gmail.com)

---

<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, 3:50am UTC](https://discuss.elastic.co/t/how-to-count-all-records-in-an-index-type/5680/4 "2017-07-06T03:50:56Z")

</div>


