# Find difference between two fields of two different values

**URL:** <https://discuss.elastic.co/t/find-difference-between-two-fields-of-two-different-values/208303>\
**Category:** Elasticsearch\
**Created:** [November 18, 2019, 11:47am UTC](https://discuss.elastic.co/t/find-difference-between-two-fields-of-two-different-values/208303 "2019-11-18T11:47:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yossi\_Saadi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yossi_saadi/32/57863_2.png) [@Yossi\_Saadi](https://discuss.elastic.co/u/Yossi_Saadi)\
**Post date:** [November 18, 2019, 11:47am UTC](https://discuss.elastic.co/t/find-difference-between-two-fields-of-two-different-values/208303/1 "2019-11-18T11:47:19Z")

</div>

Hello,  
I want to know how to get it done, and I just can't figure it out.

Let's say I have 3 logs.  
Each log has fields 'buildNumber', 'startedAt', 'finishedAt' (and more unrelevant fields).

I want to calculate the:  
_difference_ between the _last log 'finishedAt' with 'buildNumber' X_ to the _first log 'startedAt' with 'buildNumber' X_.

This way I want to get the runtime of the whole job with buildNumber X.

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:** [December 16, 2019, 11:47am UTC](https://discuss.elastic.co/t/find-difference-between-two-fields-of-two-different-values/208303/2 "2019-12-16T11:47:29Z")

</div>

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