Question on size of query request


(Amit Soni) #1

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.
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.
For more options, visit https://groups.google.com/groups/opt_out.


(Alexander Reelsen) #2

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 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.
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
.
For more options, visit 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.
To view this discussion on the web visit 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.


(Amit Soni) #3

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 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 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.
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
.
For more options, visit 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.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit 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.


(Binh Ly-2) #4

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.
To view this discussion on the web visit 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.


(Amit Soni) #5

Sounds good, thanks Binh and Alex!

-Amit.

On Mon, Mar 3, 2014 at 12:28 PM, Binh Ly 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.
To view this discussion on the web visit
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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAAOGaQKY5TyiHKRua9FLO4v7g6yG4NSkp%3DO0q_Q0wTtJhuCg4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #6