# How to increase query performance?

**URL:** <https://discuss.elastic.co/t/how-to-increase-query-performance/14662>\
**Category:** Elasticsearch\
**Created:** [December 2, 2013, 4:21pm UTC](https://discuss.elastic.co/t/how-to-increase-query-performance/14662 "2013-12-02T16:21:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matheus\_Salvia](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@Matheus\_Salvia](https://discuss.elastic.co/u/Matheus_Salvia)\
**Post date:** [December 2, 2013, 4:21pm UTC](https://discuss.elastic.co/t/how-to-increase-query-performance/14662/1 "2013-12-02T16:21:49Z")

</div>

Hello everyone,

In my current setup I have a 2 node elasticsearch cluster (EC2 m1.medium  
machines),  
and the need of making a 100+ query batch at certain times in my  
application.  
The queries follow this structure:  
[http://pastebin.com/HbZSET16](http://pastebin.com/HbZSET16)  
But may vary in the number of conditions inside the "must" or the "should"  
(as a general rule it will not exceed, say, 6 conditions).  
The Example on pastebin has 3 conditions, which are "has\_child" queries,  
each running on a different child type (we may assume that this will always  
be the case).  
Running 60 of those queries took 15 seconds, which is too slow for my  
application, is there any way to speed it up?  
The obvious question being: Putting more and more powerful machines on the  
cluster (say, 10 xlarge machines) will speed this process up? could I  
achieve a \< 5s time?

Thanks in advance,  
Matheus Salvia

--  
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/CAOJV22YWTLDN%2B4vcVOajFj335Q\_DzunNfacDT1q1mLPhc\_N%3DuQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAOJV22YWTLDN%2B4vcVOajFj335Q_DzunNfacDT1q1mLPhc_N%3DuQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![radu\_gheorghe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe/32/556_2.png) [@radu\_gheorghe](https://discuss.elastic.co/u/radu_gheorghe)\
**Post date:** [December 2, 2013, 7:58pm UTC](https://discuss.elastic.co/t/how-to-increase-query-performance/14662/2 "2013-12-02T19:58:52Z")

</div>

Hi,

Yes, adding/upgrading nodes should decrease the time for each query. While  
adding nodes, adding more replicas should help support more concurrent  
queries. Which should also decrease your total time because you seem to  
have many queries running at once.

Since you're on EC2, it should be pretty easy to add some more nodes to  
your cluster and do a quick test to see how much better performance gets.  
On Dec 2, 2013 6:21 PM, "Matheus Salvia" [matheus2740@gmail.com](mailto:matheus2740@gmail.com) wrote:

> Hello everyone,
> 
> In my current setup I have a 2 node elasticsearch cluster (EC2 m1.medium  
> machines),  
> and the need of making a 100+ query batch at certain times in my  
> application.  
> The queries follow this structure:  
> [http://pastebin.com/HbZSET16](http://pastebin.com/HbZSET16)  
> But may vary in the number of conditions inside the "must" or the "should"  
> (as a general rule it will not exceed, say, 6 conditions).  
> The Example on pastebin has 3 conditions, which are "has\_child" queries,  
> each running on a different child type (we may assume that this will always  
> be the case).  
> Running 60 of those queries took 15 seconds, which is too slow for my  
> application, is there any way to speed it up?  
> The obvious question being: Putting more and more powerful machines on the  
> cluster (say, 10 xlarge machines) will speed this process up? could I  
> achieve a \< 5s time?
> 
> Thanks in advance,  
> Matheus Salvia
> 
> --  
> 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/CAOJV22YWTLDN%2B4vcVOajFj335Q\_DzunNfacDT1q1mLPhc\_N%3DuQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAOJV22YWTLDN%2B4vcVOajFj335Q_DzunNfacDT1q1mLPhc_N%3DuQ%40mail.gmail.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAHXA0\_1YrvZJQ\_W5ro21NiBM8D2deKyYcXGjmj2GY5o4BLPNzg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAHXA0_1YrvZJQ_W5ro21NiBM8D2deKyYcXGjmj2GY5o4BLPNzg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![James\_Richardson](https://avatars.discourse-cdn.com/v4/letter/j/838e76/32.png) [@James\_Richardson](https://discuss.elastic.co/u/James_Richardson)\
**Post date:** [December 3, 2013, 9:19am UTC](https://discuss.elastic.co/t/how-to-increase-query-performance/14662/3 "2013-12-03T09:19:32Z")

</div>

I have found ec2 to be pretty poor in terms of performance. It is really handy for scaling up and down, but mot so good for speed. This is even more the case if you want your data on ebs, which is handy but non-local.  
Have you you considered different hosting options. You can get 1 month deals from linode, and hetzner has eur99/month dedicated servers.  
You might find this type of setup easier to manage than a cluster of machines...

Cheers

James

--  
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/3e88c92f-4883-4920-bd68-a120444cdf46%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3e88c92f-4883-4920-bd68-a120444cdf46%40googlegroups.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:03am UTC](https://discuss.elastic.co/t/how-to-increase-query-performance/14662/4 "2017-07-06T02:03:44Z")

</div>


