# Just Pused: Search \`count\` search type

**URL:** <https://discuss.elastic.co/t/just-pused-search-count-search-type/3970>\
**Category:** Elasticsearch\
**Created:** [February 23, 2011, 10:31pm UTC](https://discuss.elastic.co/t/just-pused-search-count-search-type/3970 "2011-02-23T22:31:07Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [February 23, 2011, 10:31pm UTC](https://discuss.elastic.co/t/just-pused-search-count-search-type/3970/1 "2011-02-23T22:31:07Z")

</div>

Heya,

Just pushed support for a new `search_type` called `count`. This will return (and optimize) to only provide the total\_hits, while still returning things like facets.

A hack to do that was to set size to 0, but with the new search type, it will be much more optimized to compute just the total\_hits.

-shay.banon

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [February 23, 2011, 11:28pm UTC](https://discuss.elastic.co/t/just-pused-search-count-search-type/3970/2 "2011-02-23T23:28:47Z")

</div>

How did you know I need it? 🙂

Is this only syntax sugar compared to "size":0 approach or is there any  
valuable optimization?

Regards,  
Lukas

On Wed, Feb 23, 2011 at 11:31 PM, Shay Banon  
[shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com)wrote:

> Heya,
> 
> Just pushed support for a new `search_type` called `count`. This will  
> return (and optimize) to only provide the total\_hits, while still returning  
> things like facets.
> 
> A hack to do that was to set size to 0, but with the new search type, it  
> will be much more optimized to compute just the total\_hits.
> 
> -shay.banon

---

<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:** [February 24, 2011, 1:30am UTC](https://discuss.elastic.co/t/just-pused-search-count-search-type/3970/3 "2011-02-24T01:30:42Z")

</div>

There is valuable optimization compared to setting size to 0. Though, I plan to do that automatically when setting size to 0 (but still like the fact that there is a specific "type" for that).  
On Thursday, February 24, 2011 at 1:28 AM, LukÃ¡Å¡ VlÄek wrote:

> How did you know I need it? 🙂
> 
> Is this only syntax sugar compared to "size":0 approach or is there any valuable optimization?
> 
> Regards,  
> Lukas
> 
> On Wed, Feb 23, 2011 at 11:31 PM, Shay Banon [shay.banon@elasticsearch.com](mailto:shay.banon@elasticsearch.com) wrote:
> 
> > Heya,
> > 
> > Just pushed support for a new `search_type` called `count`. This will return (and optimize) to only provide the total\_hits, while still returning things like facets.
> > 
> > A hack to do that was to set size to 0, but with the new search type, it will be much more optimized to compute just the total\_hits.
> > 
> > -shay.banon

---

<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, 4:11am UTC](https://discuss.elastic.co/t/just-pused-search-count-search-type/3970/4 "2017-07-06T04:11:36Z")

</div>


