# Time taken by each stage for a query

**URL:** <https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661>\
**Category:** Elasticsearch\
**Created:** [May 22, 2014, 4:25am UTC](https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661 "2014-05-22T04:25:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srinivasan\_Ramaswamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srinivasan_ramaswamy/32/74106_2.png) [@Srinivasan\_Ramaswamy](https://discuss.elastic.co/u/Srinivasan_Ramaswamy)\
**Post date:** [May 22, 2014, 4:25am UTC](https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661/1 "2014-05-22T04:25:30Z")

</div>

In the past when i used solr, i can look at time taken by each component to  
understand where most of the time is spent for a particular query.  
Similarly, I am trying to understand the breakdown of time spent for one  
particular query. Can anyone tell me how can i investigate performance of  
specific queries it in elasticsearch ?

Thanks  
Srini

--  
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/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [May 22, 2014, 11:39pm UTC](https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661/2 "2014-05-22T23:39:58Z")

</div>

That is not easy, and the reason is that Elasticsearch and Solr work in  
quite a different way eg. when it comes to compute facets/aggregations:  
Solr first computes top hits, and if facets are required, it will load the  
doc IDs of document matches into a bit set that will be used in a  
subsequent step in order to compute facets. On the other hand,  
Elasticsearch computes both top hits and facets/aggregations at the same  
time (in the same "Collector" if you are familiar with Lucene terminology)  
which makes timings harder to track.

On Thu, May 22, 2014 at 6:25 AM, Srinivasan Ramaswamy [ursvasan@gmail.com](mailto:ursvasan@gmail.com)wrote:

> In the past when i used solr, i can look at time taken by each component  
> to understand where most of the time is spent for a particular query.  
> Similarly, I am trying to understand the breakdown of time spent for one  
> particular query. Can anyone tell me how can i investigate performance of  
> specific queries it in elasticsearch ?
> 
> Thanks  
> Srini
> 
> --  
> 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/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
Adrien Grand

--  
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/CAL6Z4j5y1Md0G9WBuQxj\_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5y1Md0G9WBuQxj_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Srinivasan\_Ramaswamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/srinivasan_ramaswamy/32/74106_2.png) [@Srinivasan\_Ramaswamy](https://discuss.elastic.co/u/Srinivasan_Ramaswamy)\
**Post date:** [May 23, 2014, 11:33pm UTC](https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661/3 "2014-05-23T23:33:50Z")

</div>

Thanks for the clarification. I suspected (as it was mentioned in ES site)  
that significant terms feature is the bottle neck and verified the amount  
of time the query takes with the feature turned on and off. With the  
feature the query takes 5s (every time) and after turning it off the query  
takes only 160ms.

Does anyone have any tips on how to make significant terms feature much  
faster ? Does it require a lot of JVM heap size ? Currently I am running on  
a virtual machine with 16G where i allocated 8G to JVM. I have 6 nodes with  
a total of 24 shards and 1 replica (default). Each shard size is 2.5G. How  
can I optimize the significant terms feature ?

On Thu, May 22, 2014 at 4:39 PM, Adrien Grand \<  
[adrien.grand@elasticsearch.com](mailto:adrien.grand@elasticsearch.com)\> wrote:

> That is not easy, and the reason is that Elasticsearch and Solr work in  
> quite a different way eg. when it comes to compute facets/aggregations:  
> Solr first computes top hits, and if facets are required, it will load the  
> doc IDs of document matches into a bit set that will be used in a  
> subsequent step in order to compute facets. On the other hand,  
> Elasticsearch computes both top hits and facets/aggregations at the same  
> time (in the same "Collector" if you are familiar with Lucene terminology)  
> which makes timings harder to track.
> 
> On Thu, May 22, 2014 at 6:25 AM, Srinivasan Ramaswamy [ursvasan@gmail.com](mailto:ursvasan@gmail.com)wrote:
> 
> > In the past when i used solr, i can look at time taken by each component  
> > to understand where most of the time is spent for a particular query.  
> > Similarly, I am trying to understand the breakdown of time spent for one  
> > particular query. Can anyone tell me how can i investigate performance of  
> > specific queries it in elasticsearch ?
> > 
> > Thanks  
> > Srini
> > 
> > --  
> > 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/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/02f323f6-b2af-4c71-889f-9f4f7f888c57%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> Adrien Grand
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/D3ZOfKL6VKk/unsubscribe](https://groups.google.com/d/topic/elasticsearch/D3ZOfKL6VKk/unsubscribe).  
> To unsubscribe from this group and all its topics, 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/CAL6Z4j5y1Md0G9WBuQxj\_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5y1Md0G9WBuQxj_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5y1Md0G9WBuQxj\_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAL6Z4j5y1Md0G9WBuQxj_AokB8ro%2BuYAR9biFRKwYLdbpAkU4g%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAL1MvVzzGqK33G4hfxcai-WQocom0o5vshZgKOaoSMov9ZboDw%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAL1MvVzzGqK33G4hfxcai-WQocom0o5vshZgKOaoSMov9ZboDw%40mail.gmail.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:27am UTC](https://discuss.elastic.co/t/time-taken-by-each-stage-for-a-query/17661/4 "2017-07-06T01:27:17Z")

</div>


