# Maintaining "time delta" between events when reindexing

**URL:** https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155
**Category:** Elasticsearch
**Created:** [January 16, 2024, 10:57am UTC](https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155 "2024-01-16T10:57:10Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![petlit2049](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@petlit2049](https://discuss.elastic.co/u/petlit2049)
#### Post date: [January 16, 2024, 10:57am UTC](https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155/1 "2024-01-16T10:57:10Z")

</div>

I'm trying to work out a process for maintaining the time difference between event records when re-indexing data from one index to another but with a new "t0" using _only_ Elasticsearch with ingest pipelines and/or logstash (if needed). An external program+cursor approach is not possible in this use case unfortunately.

I'll try to explain this further:

I have an index with log events which have been pre-collected and indexed into a master index. We want to re-use the content of this master index by populating new indices using the re-index api. However, and this is the tricky part, we want to maintain the time-difference between event records _although_ they're indexed at another time - a new "t0".

Say we have a new re-indexing "t0": 2024-02-22 10:45:09

and given the following original timestamps  
2023-11-19 12:34:56  
2023-11-19 12:36:22  
...

The difference of the above is 00:01:26 which, using a new "t0" of 2024-02-22 10:45:09, would result in:  
2024-02-22 10:45:09  
2024-02-22 10:46:35  
...

I really hope this makes sense 🤔

Is this possible at all given the tools at hand?

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [January 16, 2024, 12:48pm UTC](https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155/2 "2024-01-16T12:48:55Z")

</div>

> [@petlit2049](#):
>
> Is this possible at all given the tools at hand?

I don't think this is possible without using an external tool.

In both Logstash and Elasticsearch the events are independent from each other, what you want is to have the timestamp of one event dependent of the timestamp of the previous event.

---

<div class="post-metadata">

### Author: ![petlit2049](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@petlit2049](https://discuss.elastic.co/u/petlit2049)
#### Post date: [January 16, 2024, 1:53pm UTC](https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155/3 "2024-01-16T13:53:21Z")

</div>

Thanks for your reply. I was/am afraid that this'd be the case 😊 I'll re-iterate and see how to approach it.

---

<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: [February 13, 2024, 1:53pm UTC](https://discuss.elastic.co/t/maintaining-time-delta-between-events-when-reindexing/351155/4 "2024-02-13T13:53:43Z")

</div>

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