# Question on size of query request

**URL:** <https://discuss.elastic.co/t/question-on-size-of-query-request/16091>\
**Category:** Elasticsearch\
**Created:** [March 2, 2014, 8:17pm UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091 "2014-03-02T20:17:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [March 2, 2014, 8:17pm UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/1 "2014-03-02T20:17:22Z")

</div>

Hi everyone - I have a very basic question. I am just wondering, in a  
system which is supposed to handle high traffic, how important is the size  
of the request (json request) when it comes to performance.

For instance: earlier the size of my json request was ~ 600 characters.  
After I added the names of the few fields which I wanted to explicitly  
search on, the request size increased to ~1000 characters.

Would this impact the query response time (although I haven't seen anything  
weird so far)? Would you recommend keeping the size of query request to  
absolute minimum?

-Amit.

--  
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/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B\_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%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:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 3, 2014, 7:58am UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/2 "2014-03-03T07:58:09Z")

</div>

Hey,

the size if your requests is most likely very dependent on what you do. If  
you write a complex query and it results in 10kb JSON, but you really need  
this query to be fired, there is no way around it. Same goes for indexing -  
a document is as big as a document is, not too much possibility to optimize  
it. On the elasticsearch side the request gets streamed using the jackson  
library to prevent creation of huge request objects in memory.

I think your question hides another question, which I am not able to  
extract. From my experience it is not about request size, but about the  
request your are sending. You can create awful slow queries with a small  
request or very fast ones with a larger one. This should not be a factor in  
your calculations.

Maybe you can elaborate a bit more why exactly you are worried about... You  
should not think in terms of requests, but rather in terms of needed  
functionality to put inside a request to get a requirement done.

--Alex

On Sun, Mar 2, 2014 at 9:17 PM, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) wrote:

> Hi everyone - I have a very basic question. I am just wondering, in a  
> system which is supposed to handle high traffic, how important is the size  
> of the request (json request) when it comes to performance.
> 
> For instance: earlier the size of my json request was ~ 600 characters.  
> After I added the names of the few fields which I wanted to explicitly  
> search on, the request size increased to ~1000 characters.
> 
> Would this impact the query response time (although I haven't seen  
> anything weird so far)? Would you recommend keeping the size of query  
> request to absolute minimum?
> 
> -Amit.
> 
> --  
> 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/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B\_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%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/CAGCwEM-T-HtzguJt02qch\_Rs2ymFZTDjNFQod-C8kgqvQSGxaQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-T-HtzguJt02qch_Rs2ymFZTDjNFQod-C8kgqvQSGxaQ%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:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [March 3, 2014, 8:44am UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/3 "2014-03-03T08:44:33Z")

</div>

Hi Alex - Thanks for the responses. Let me provided a little more detail.

Earlier I was querying just on "\_all" field. Then I realized that different  
fields have been indexed differently and hence just querying \_all will not  
suffice. Hence I have started sending the list of all the fields (which  
need to be queried) as an array and this translated to ~15 fields (which  
look a lot to me). So I am just wondering whether this change will make an  
impact to the performance.

"simple\_query\_string" : {  
"query" : "customer",  
"fields" : ["field1", "field2", "field3",..............],  
"default\_operator" : "and"  
}

_Secondly_, I am using term filter and it has something like below and my  
filters are all strings. I am wondering whether I should convert my strings  
(there are only 30 distinct possible values) to integer constants since  
they would take less space.  
"terms" : {  
"type" : [ "filter\_str1", "filter\_str2",  
"filter\_str3",............................ ]  
}

Does this help? Thoughts?

-Amit.

On Sun, Mar 2, 2014 at 11:58 PM, Alexander Reelsen [alr@spinscale.de](mailto:alr@spinscale.de) wrote:

> Hey,
> 
> the size if your requests is most likely very dependent on what you do. If  
> you write a complex query and it results in 10kb JSON, but you really need  
> this query to be fired, there is no way around it. Same goes for indexing -  
> a document is as big as a document is, not too much possibility to optimize  
> it. On the elasticsearch side the request gets streamed using the jackson  
> library to prevent creation of huge request objects in memory.
> 
> I think your question hides another question, which I am not able to  
> extract. From my experience it is not about request size, but about the  
> request your are sending. You can create awful slow queries with a small  
> request or very fast ones with a larger one. This should not be a factor in  
> your calculations.
> 
> Maybe you can elaborate a bit more why exactly you are worried about...  
> You should not think in terms of requests, but rather in terms of needed  
> functionality to put inside a request to get a requirement done.
> 
> --Alex
> 
> On Sun, Mar 2, 2014 at 9:17 PM, Amit Soni [amitsoni29@gmail.com](mailto:amitsoni29@gmail.com) wrote:
> 
> > Hi everyone - I have a very basic question. I am just wondering, in a  
> > system which is supposed to handle high traffic, how important is the size  
> > of the request (json request) when it comes to performance.
> > 
> > For instance: earlier the size of my json request was ~ 600 characters.  
> > After I added the names of the few fields which I wanted to explicitly  
> > search on, the request size increased to ~1000 characters.
> > 
> > Would this impact the query response time (although I haven't seen  
> > anything weird so far)? Would you recommend keeping the size of query  
> > request to absolute minimum?
> > 
> > -Amit.
> > 
> > --  
> > 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/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B\_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2B%3Dv5tZA3oOyPi%2B_uxY-pc2%3D%3DAOffh7oFykqDQeMUKmpQ%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/CAGCwEM-T-HtzguJt02qch\_Rs2ymFZTDjNFQod-C8kgqvQSGxaQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM-T-HtzguJt02qch_Rs2ymFZTDjNFQod-C8kgqvQSGxaQ%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/CAAOGaQ%2B0P2Zq031i96BPaosG5%3D7GWmTWU%3DnR58%3D3aizoSoq5HA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQ%2B0P2Zq031i96BPaosG5%3D7GWmTWU%3DnR58%3D3aizoSoq5HA%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:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 3, 2014, 8:28pm UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/4 "2014-03-03T20:28:53Z")

</div>

I think you'll be fine. I think that this should be the last thing to think  
of doing anything about. I would be more concerned about whether what is  
inside your query is optimized or not like Alex already mentioned.

--  
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/6a2a8405-2dc4-493f-b521-c9f9e1b0dd36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a2a8405-2dc4-493f-b521-c9f9e1b0dd36%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:** ![Amit\_Soni](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@Amit\_Soni](https://discuss.elastic.co/u/Amit_Soni)\
**Post date:** [March 4, 2014, 3:15am UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/5 "2014-03-04T03:15:18Z")

</div>

Sounds good, thanks Binh and Alex!

-Amit.

On Mon, Mar 3, 2014 at 12:28 PM, Binh Ly [binhly\_es@yahoo.com](mailto:binhly_es@yahoo.com) wrote:

> I think you'll be fine. I think that this should be the last thing to  
> think of doing anything about. I would be more concerned about whether what  
> is inside your query is optimized or not like Alex already mentioned.
> 
> --  
> 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/6a2a8405-2dc4-493f-b521-c9f9e1b0dd36%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6a2a8405-2dc4-493f-b521-c9f9e1b0dd36%40googlegroups.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/CAAOGaQKY5TyiHKRua9FLO4v7g6yG4NSkp%3DO0q\_Q0wTtJhuCg4Q%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKY5TyiHKRua9FLO4v7g6yG4NSkp%3DO0q_Q0wTtJhuCg4Q%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:** ![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:45am UTC](https://discuss.elastic.co/t/question-on-size-of-query-request/16091/6 "2017-07-06T01:45:57Z")

</div>


