# What is the best possible way to show time difference between two events in elastic search?

**URL:** <https://discuss.elastic.co/t/what-is-the-best-possible-way-to-show-time-difference-between-two-events-in-elastic-search/359911>\
**Category:** Elasticsearch\
**Created:** [May 21, 2024, 10:32am UTC](https://discuss.elastic.co/t/what-is-the-best-possible-way-to-show-time-difference-between-two-events-in-elastic-search/359911 "2024-05-21T10:32:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaurow.deshmukh](https://avatars.discourse-cdn.com/v4/letter/g/ebca7d/32.png) [@gaurow.deshmukh](https://discuss.elastic.co/u/gaurow.deshmukh)\
**Post date:** [May 21, 2024, 10:32am UTC](https://discuss.elastic.co/t/what-is-the-best-possible-way-to-show-time-difference-between-two-events-in-elastic-search/359911/1 "2024-05-21T10:32:04Z")

</div>

What is the best possible way to show time difference between two events in Elasticsearch?  
Is it possible to add an additional field & show the time difference in that particular field

---

<div class="post-metadata">

**Author:** ![Kathleen\_DeRusso](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kathleen_derusso/32/132039_2.png) [@Kathleen\_DeRusso](https://discuss.elastic.co/u/Kathleen_DeRusso)\
**Post date:** [May 21, 2024, 12:42pm UTC](https://discuss.elastic.co/t/what-is-the-best-possible-way-to-show-time-difference-between-two-events-in-elastic-search/359911/2 "2024-05-21T12:42:34Z")

</div>

You can certainly modify your index schema in the way that works best for your search use case, using a `time_elapsed` field or something like that.

You may also be interested in the [range](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html) query which can search with date math. You can combine multiple range queries in a single bool query if you need to get a very specified time window.

---

<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:** [June 18, 2024, 12:43pm UTC](https://discuss.elastic.co/t/what-is-the-best-possible-way-to-show-time-difference-between-two-events-in-elastic-search/359911/3 "2024-06-18T12:43:28Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
