# Time Difference between Documents

**URL:** <https://discuss.elastic.co/t/time-difference-between-documents/60401>\
**Category:** Elasticsearch\
**Created:** [September 13, 2016, 4:04pm UTC](https://discuss.elastic.co/t/time-difference-between-documents/60401 "2016-09-13T16:04:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_McClain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_mcclain/32/8613_2.png) [@David\_McClain](https://discuss.elastic.co/u/David_McClain)\
**Post date:** [September 13, 2016, 4:04pm UTC](https://discuss.elastic.co/t/time-difference-between-documents/60401/1 "2016-09-13T16:04:35Z")

</div>

I've done some searching, and best I can find is that this isn't possible..

We have logs that we are storing, and some of the logs indicate transactions take place as users step through the site.  
We would benefit from being able to take a transaction ID, track it through the system, **and calculate time spent at each step**.  
This would end up looking like.. For example..  
3 Documents

```auto
{
  "step": "1",
  "timestamp":"2016-09-13 10:00:00.000"
}

{
  "step": "2",
  "timestamp":"2016-09-13 10:30:00.000"
}

{
  "step": "3",
  "timestamp":"2016-09-13 11:30:00.000"
}

```

We have a Dashboard created that lets us plug in a transactionID and lets us view different stats for all the docs related to that transactionID.  
We would like to be able to calculate times between different steps.. In this example, 30 mins between step 1 and step 2, and then an hour between step 2 and step 3.

Is this possible?

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 13, 2016, 4:17pm UTC](https://discuss.elastic.co/t/time-difference-between-documents/60401/2 "2016-09-13T16:17:48Z")

</div>

[serial\_diff](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-serialdiff-aggregation.html) might work for you.

---

<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, 10:20pm UTC](https://discuss.elastic.co/t/time-difference-between-documents/60401/3 "2017-07-05T22:20:35Z")

</div>


