# Overall Query TIme in Elastic Search

**URL:** https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004
**Category:** Elasticsearch
**Created:** [August 25, 2015, 11:57am UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004 "2015-08-25T11:57:49Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)
#### Post date: [August 25, 2015, 11:57am UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/1 "2015-08-25T11:57:49Z")

</div>

As mentioned [here](https://www.elastic.co/guide/en/elasticsearch/guide/current/_monitoring_individual_nodes.html#_indices_section):- 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?

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [August 25, 2015, 2:24pm UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/2 "2015-08-25T14:24:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)
#### Post date: [August 26, 2015, 6:31am UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/3 "2015-08-26T06:31:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)
#### Post date: [August 26, 2015, 12:11pm UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/4 "2015-08-26T12:11:02Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Deb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/deb/32/46162_2.png) [@Deb](https://discuss.elastic.co/u/Deb)
#### Post date: [August 26, 2015, 12:50pm UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/5 "2015-08-26T12:50:12Z")

</div>

Ohk Thanks Adrian.

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

---

<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 5, 2017, 11:53pm UTC](https://discuss.elastic.co/t/overall-query-time-in-elastic-search/28004/6 "2017-07-05T23:53:50Z")

</div>


