Took is having a different value than the time ES is taking to show the result in Kibana

I have a query in Elastic Search which is fetching 10000 records having approximately 8MB of data. In the "took" tag in the JSON response, it is showing "1071" . However the response is actually appearing in Kibana after approximately, 6 to 7 seconds later. Same thing is observed, when I am executing it from JAVA API. After doing some googling, I understood that "took" includes only the query execution time in Elastic Search and hence does not include the time for the following:

  1. Sending the response to the server

  2. Deserializing the request from JSON on the server

  3. Serializing the response into JSON on the server

  4. Sending the response over the network

So, given the above scenario, what measures can I take to make sure that it appears in a very reasonable time (in 2 to 3 seconds)?

What does your query look like?
Why do you need to get 10000 documents back?

Actually, another application is dependent on this query and at a certain given time, we do not expect the result to be more than 10000 but it can very easily be e.g. 8000. So we have kept the upper limit as 10000.

Does it mean that you are giving 10000 results back to your users?

Well, we are giving this data to another application which has some other business logic for further clean up and after that the data is being presented to the user.

You should better use the scroll API with a more reasonable size depending on your tests.
You can extract millions of rows if you wish with that.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.