# Determining custom timestamp for new index does not work

**URL:** <https://discuss.elastic.co/t/determining-custom-timestamp-for-new-index-does-not-work/273106>\
**Category:** Logstash\
**Created:** [May 16, 2021, 10:27am UTC](https://discuss.elastic.co/t/determining-custom-timestamp-for-new-index-does-not-work/273106 "2021-05-16T10:27:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roy\_Levy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roy_levy/32/61613_2.png) [@Roy\_Levy](https://discuss.elastic.co/u/Roy_Levy)\
**Post date:** [May 16, 2021, 10:27am UTC](https://discuss.elastic.co/t/determining-custom-timestamp-for-new-index-does-not-work/273106/1 "2021-05-16T10:27:45Z")

</div>

Hey,

I have an index which is loaded with aggregated data each day at same time, like so:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/1/9/19f0d52310b6c63ac456b0e478e5a11f2b38b1d1.png)

I'm trying to use logstash in order to migrate the data to another ES cluster in order to use machine learning capabilities there.

When I migrate the data the @timestamp is the **time of the addition to the new index**.  
I don't want this behavior, and instead want to get the date of the original index from `key.date` field.

For example if the aggregated document was aggregated in 9.5.2021 I want the timestamp of the document **remain the same** and not change to be the addition date.

[The date format of the first index is: 05-15-2021]

I've tried using filter in my logstash for this cause, like so:

```auto
filter
{
        mutate {
                convert => { "key.date" => "string" }
        }
        date {
                match => ["key.date", "MM-dd-yyyy"]
                target => "@timestamp"
        }
}

```

But the @timestamp still picks the current time of the addition to the new index.  
Is there anything I'm missing here?

---

<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 13, 2021, 10:27am UTC](https://discuss.elastic.co/t/determining-custom-timestamp-for-new-index-does-not-work/273106/2 "2021-06-13T10:27:47Z")

</div>

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