# Add a time field in elasticsearch and calculate time between two event

**URL:** https://discuss.elastic.co/t/add-a-time-field-in-elasticsearch-and-calculate-time-between-two-event/305536
**Category:** Elasticsearch
**Tags:** docker
**Created:** [May 24, 2022, 6:25pm UTC](https://discuss.elastic.co/t/add-a-time-field-in-elasticsearch-and-calculate-time-between-two-event/305536 "2022-05-24T18:25:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![The-morpho](https://avatars.discourse-cdn.com/v4/letter/t/f14d63/32.png) [@The-morpho](https://discuss.elastic.co/u/The-morpho)
#### Post date: [May 24, 2022, 6:25pm UTC](https://discuss.elastic.co/t/add-a-time-field-in-elasticsearch-and-calculate-time-between-two-event/305536/1 "2022-05-24T18:25:31Z")

</div>

I'm new to elasticsearch.

I’m working with log files stored in Elasticsearch, that contains information about some operations on differents levels, I have a field timestamp that represents the time when each operation has occured on each step.

I want to calculate the time between the start and the end of the process. **between step1 and step 3** and add it to a field that I will create so I can visualize it on Kibana.

This is an exemple of some of my logs.

> {“log\_level”:“INFO”,“timestamp”:“2021-12-22T11:49:06.124890Z”,“event\_type”:“step1”,“mid”:“96712abc”}{“log\_level”:“INFO”,“timestamp”:“2021-12-22T11:49:07.124890Z”,“event\_type”:“step2”,“mid”:“96712abc”} {“log\_level”:“INFO”,“timestamp”:“2021-12-22T11:49:08.124890Z”,“event\_type”:“step3”,“mid”:“96712abc”}

---

<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 21, 2022, 6:25pm UTC](https://discuss.elastic.co/t/add-a-time-field-in-elasticsearch-and-calculate-time-between-two-event/305536/2 "2022-06-21T18:25:51Z")

</div>

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