# Improve performance on first time query

**URL:** <https://discuss.elastic.co/t/improve-performance-on-first-time-query/11197>\
**Category:** Elasticsearch\
**Created:** [March 18, 2013, 11:44pm UTC](https://discuss.elastic.co/t/improve-performance-on-first-time-query/11197 "2013-03-18T23:44:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pr2012](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pr2012/32/2186_2.png) [@pr2012](https://discuss.elastic.co/u/pr2012)\
**Post date:** [March 18, 2013, 11:44pm UTC](https://discuss.elastic.co/t/improve-performance-on-first-time-query/11197/1 "2013-03-18T23:44:04Z")

</div>

I am seeing somewhat lackluster performance from the first execution of  
queries, subsequent requests hit the cache and seem to be alright. I'd like  
to improve performance on the first requests though, as this will be the  
majority of usage.

We have a 5x Node cluster of EC2 Large instances with IOPS at 600.  
Elasticsearch has 50% of the available memory on each node. All requests  
are over Thrift. I'm still looking for ways to tweak this configuration.  
We have about 10million documents spread roughly evenly across 4 different  
indexes.

The query matches about between 100k and 300k of the documents in the  
indexes 2-4million.  
A number of facets are calculated.

The first time the query is executed, response time is ~5s.  
Subsequent executions are sub 1s.  
Without facets, first execution is under 100ms.

Here is an example query:

> <https://gist.github.com/phillro/803701269a1b2a384c32>

  
All numerical fields are mapped as integers, but beyond that I havent  
optimized the mappings at all.

Any tips on how to optimize this would be much appreciated.

Thx!

--  
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:** ![otisg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/otisg/32/492_2.png) [@otisg](https://discuss.elastic.co/u/otisg)\
**Post date:** [March 19, 2013, 3:39am UTC](https://discuss.elastic.co/t/improve-performance-on-first-time-query/11197/2 "2013-03-19T03:39:35Z")

</div>

Hi,

Consider using

> **[Elastic — The Search AI Company](https://www.elastic.co)**
>
> Power insights and outcomes with The Elastic Search AI Platform. See into your data and find answers that matter with enterprise solutions designed to help you accelerate time to insight. Try Elastic ...

## Otis

ELASTICSEARCH Performance Monitoring - [Sematext Monitoring | Infrastructure Monitoring Service](http://sematext.com/spm/index.html)

On Monday, March 18, 2013 7:44:04 PM UTC-4, ES\_Newb wrote:

> I am seeing somewhat lackluster performance from the first execution of  
> queries, subsequent requests hit the cache and seem to be alright. I'd like  
> to improve performance on the first requests though, as this will be the  
> majority of usage.
> 
> We have a 5x Node cluster of EC2 Large instances with IOPS at 600.  
> Elasticsearch has 50% of the available memory on each node. All requests  
> are over Thrift. I'm still looking for ways to tweak this configuration.  
> We have about 10million documents spread roughly evenly across 4 different  
> indexes.
> 
> The query matches about between 100k and 300k of the documents in the  
> indexes 2-4million.  
> A number of facets are calculated.
> 
> The first time the query is executed, response time is ~5s.  
> Subsequent executions are sub 1s.  
> Without facets, first execution is under 100ms.
> 
> Here is an example query:  
> [gist:803701269a1b2a384c32 · GitHub](https://gist.github.com/phillro/803701269a1b2a384c32)  
> All numerical fields are mapped as integers, but beyond that I havent  
> optimized the mappings at all.
> 
> Any tips on how to optimize this would be much appreciated.
> 
> Thx!

--  
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:45am UTC](https://discuss.elastic.co/t/improve-performance-on-first-time-query/11197/3 "2017-07-06T02:45:56Z")

</div>


