# Calculation of time spent in the system

**URL:** <https://discuss.elastic.co/t/calculation-of-time-spent-in-the-system/45214>\
**Category:** Kibana\
**Created:** [March 23, 2016, 11:59am UTC](https://discuss.elastic.co/t/calculation-of-time-spent-in-the-system/45214 "2016-03-23T11:59:26Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [March 24, 2016, 8:08pm UTC](https://discuss.elastic.co/t/calculation-of-time-spent-in-the-system/45214/2 "2016-03-24T20:08:35Z")

</div>

Hi Prateek,

Kibana doesn't have anything built-in that would take the difference between documents related by an ID, but it has some scripting functionality.

Here's a link to another post where a script is used to build a metric about concurrent events. It might provide some ideas;

> [@Display concurrency in data on Kibana](https://discuss.elastic.co/t/display-concurrency-in-data-on-kibana/26006/13):
>
> It worked for me with the following data and config: curl -XPOST 'http://localhost:9200/test3' -d '{ "settings" : { "number\_of\_shards" : 1 }, "mappings" : { "test" : { "properties" : { "start\_date" : { "type" : "date"}, "end\_date" : { "type" : "date"}, "duration" : { "type" : "integer"} } } } }' curl -XPUT 'http://localhost:9200/test3/test/1' -d '{ "start\_date" : "2015-08-23T00:0…

Another option might be the Timelion plugin to Kibana. Here's one video about it but if you search you'll find more; [https://www.elastic.co/videos/time-series-analysis-using-timelion](https://www.elastic.co/videos/time-series-analysis-using-timelion)

But this is a fairly common question. I'll try to come up with a good solution and post it back here.

Regards,  
Lee

---

_[View the full topic](https://discuss.elastic.co/t/calculation-of-time-spent-in-the-system/45214)._
