Overall Query TIme in Elastic Search


As mentioned here:- the query consists of two phases search and fetch. Their timings are given by search_* and fetch_* from the node stats. Is there a way I can get the average query time (which includes both search and fetch phase?

(Adrien Grand) #2

The overall search time would just be the sum of the query and fetch phases?


I also thought the same but then I am seeing the query_total and fetch_total are not same. For example from the _node/stats I am getting the below output:-

"search": {
      "open_contexts": 0,
      "query_total": 16,
      "query_time_in_millis": 1427,
      "query_current": 0,
      "fetch_total": 5,
      "fetch_time_in_millis": 181,
      "fetch_current": 0

So I think I can't do a simple addition.

(Adrien Grand) #4

This is because we only perform the fetch phase on shards that have competitive hits. For instance if you have 5 shards and the top 10 docs are all on shards 0 and 3, then elasticsearch won't perform a fetch phase on shards 1, 2 and 5.


Ohk Thanks Adrian.

Can you let me know what is the different between open_contexts & query_current?

(system) #6