# How does search latency and index latency calculate on marvel's dashborad

**URL:** https://discuss.elastic.co/t/how-does-search-latency-and-index-latency-calculate-on-marvels-dashborad/63178
**Category:** Elasticsearch
**Tags:** elastic-stack-monitoring
**Created:** [October 17, 2016, 10:27am UTC](https://discuss.elastic.co/t/how-does-search-latency-and-index-latency-calculate-on-marvels-dashborad/63178 "2016-10-17T10:27:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![makeyang](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@makeyang](https://discuss.elastic.co/u/makeyang)
#### Post date: [October 17, 2016, 10:27am UTC](https://discuss.elastic.co/t/how-does-search-latency-and-index-latency-calculate-on-marvels-dashborad/63178/1 "2016-10-17T10:27:14Z")

</div>

currently the latency is calcaluted by marvel is not fit with the valued we calculated from client side. so we'd like to konw how it calculated by marvel

---

<div class="post-metadata">

### Author: ![pickypg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pickypg/32/62409_2.png) [@pickypg](https://discuss.elastic.co/u/pickypg)
#### Post date: [October 24, 2016, 10:56pm UTC](https://discuss.elastic.co/t/how-does-search-latency-and-index-latency-calculate-on-marvels-dashborad/63178/2 "2016-10-24T22:56:47Z")

</div>

Hi,

I recently explained the calculation for the latency over at:

> [@Negative Search Latency in Marvel](https://discuss.elastic.co/t/negative-search-latency-in-marvel/54012/3):
>
> Hi Zaar Hai, I'd like to tell you that we're predictively pre-searching for you, but this is a visualization bug that comes from how we calculate the the latency: Search Latency is calculated by dividing the derivative of the total search time by the derivative of the total search count. Index Latency is the same thing. The derivative is necessary because the stats reported from Elasticsearch itself are just counters since the node started, so each time bucket (x coordinate) gets this extra st…

The gist is that we calculate latency by pulling the `_nodes/stats` API, and fetching the total time spent indexing and the number of indexing operations, as well as the same for query (search). Those operations are per shard to be clear. We do this every `10s`, so it slowly grows over time by adding to the initial value since node uptime.

So, to chart it, we take the derivative for each time-bucket (each X-axis slice) that we intend to chart, then divide those derivatives to get the latency.

Keep in mind that your client side latency is going to have more data (the full network round trip for starters), so it is inherently a little more accurate.

Hope that helps,  
Chris

---

<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:41pm UTC](https://discuss.elastic.co/t/how-does-search-latency-and-index-latency-calculate-on-marvels-dashborad/63178/3 "2017-07-06T13:41:47Z")

</div>


