# Size = 0 w/ query\_then\_fetch vs count search\_type

**URL:** <https://discuss.elastic.co/t/size-0-w-query-then-fetch-vs-count-search-type/19271>\
**Category:** Elasticsearch\
**Created:** [August 13, 2014, 8:54pm UTC](https://discuss.elastic.co/t/size-0-w-query-then-fetch-vs-count-search-type/19271 "2014-08-13T20:54:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Ochsner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_ochsner/32/1287_2.png) [@Andrew\_Ochsner](https://discuss.elastic.co/u/Andrew_Ochsner)\
**Post date:** [August 13, 2014, 8:54pm UTC](https://discuss.elastic.co/t/size-0-w-query-then-fetch-vs-count-search-type/19271/1 "2014-08-13T20:54:12Z")

</div>

Hi:

For some reason I remember someone saying (might have been during a  
training or git issue) that ElasticSearch would optimize a query\_then\_fetch  
search with size=0 to a count search. But now I can't find anywhere on the  
interwebs or in a quick search through the code. Does anyone know if this  
is the case or if it really is more important to specify count search\_type  
rather than size=0 (in this instance, it's in the context of wanting to do  
an aggregation and I don't care about the hits).

Thanks in advance  
Andy O

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b349267e-c01b-4fcb-9b2d-c80a14e5015f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b349267e-c01b-4fcb-9b2d-c80a14e5015f%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:08am UTC](https://discuss.elastic.co/t/size-0-w-query-then-fetch-vs-count-search-type/19271/2 "2017-07-06T01:08:47Z")

</div>


