# Detect epoch as Date field

**URL:** https://discuss.elastic.co/t/detect-epoch-as-date-field/258477
**Category:** Elasticsearch
**Created:** [December 12, 2020, 2:09pm UTC](https://discuss.elastic.co/t/detect-epoch-as-date-field/258477 "2020-12-12T14:09:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![lstoneir](https://avatars.discourse-cdn.com/v4/letter/l/b9bd4f/32.png) [@lstoneir](https://discuss.elastic.co/u/lstoneir)
#### Post date: [December 12, 2020, 2:09pm UTC](https://discuss.elastic.co/t/detect-epoch-as-date-field/258477/1 "2020-12-12T14:09:49Z")

</div>

Hi every one,  
i have an index (name: x-001) with a date field:

```auto
{
"time": {
        "type": "date"
      }
}

```

I insert docs into index like this:

```auto
time: 1607782041000

```

elasticsearch automatically convert epoch to datetime field and save!  
I have created an ilm for rollover! after rollover and create new index like x-002  
when i check the mapping of new index, i see that mapping is like this:

```auto
{
"time": {
        "type": "long"
      }
}

```

How can i fix this issue? How can i disable auto mapping?

---

<div class="post-metadata">

### Author: ![aaron-nimocks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aaron-nimocks/32/73965_2.png) [@aaron-nimocks](https://discuss.elastic.co/u/aaron-nimocks)
#### Post date: [December 12, 2020, 3:24pm UTC](https://discuss.elastic.co/t/detect-epoch-as-date-field/258477/2 "2020-12-12T15:24:17Z")

</div>

You can create an [index template](https://www.elastic.co/guide/en/elasticsearch/reference/7.10/index-templates.html) if you need to keep as `date` vs `long`.

---

<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: [January 9, 2021, 3:24pm UTC](https://discuss.elastic.co/t/detect-epoch-as-date-field/258477/3 "2021-01-09T15:24:25Z")

</div>

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