# Find time difference between documents in search hits

**URL:** https://discuss.elastic.co/t/find-time-difference-between-documents-in-search-hits/268580
**Category:** Elasticsearch
**Created:** [March 28, 2021, 10:16am UTC](https://discuss.elastic.co/t/find-time-difference-between-documents-in-search-hits/268580 "2021-03-28T10:16:21Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vradder](https://avatars.discourse-cdn.com/v4/letter/v/898d66/32.png) [@vradder](https://discuss.elastic.co/u/vradder)
#### Post date: [March 28, 2021, 10:16am UTC](https://discuss.elastic.co/t/find-time-difference-between-documents-in-search-hits/268580/1 "2021-03-28T10:16:22Z")

</div>

Hi, I am using ES for log viewer application, how can i add new script filed(hasTimeDifference) in search hits if the time difference between current and previous log is more than specified seconds(for ex: 10 seconds)..  
time difference can be found by comparing timestamp of log record.  
Thanks.

---

<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: [April 25, 2021, 10:16am UTC](https://discuss.elastic.co/t/find-time-difference-between-documents-in-search-hits/268580/2 "2021-04-25T10:16:29Z")

</div>

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