# Specifying custom date fields in an Elasticsearch index template

**URL:** <https://discuss.elastic.co/t/specifying-custom-date-fields-in-an-elasticsearch-index-template/1112>\
**Category:** Elasticsearch\
**Created:** [May 21, 2015, 4:07pm UTC](https://discuss.elastic.co/t/specifying-custom-date-fields-in-an-elasticsearch-index-template/1112 "2015-05-21T16:07:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hartfordfive](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hartfordfive/32/44794_2.png) [@hartfordfive](https://discuss.elastic.co/u/hartfordfive)\
**Post date:** [May 21, 2015, 4:07pm UTC](https://discuss.elastic.co/t/specifying-custom-date-fields-in-an-elasticsearch-index-template/1112/1 "2015-05-21T16:07:17Z")

</div>

I've tried updating my index template to allow an epoch and ISO8601 date format directly at the mapping level in Elasticsearch, which should override the @timestamp field. So far I've had no luck. My template can be viewed here [http://pastebin.com/1DCT6GfM](http://pastebin.com/1DCT6GfM).

Essentially, once I parse the json logs are parsed by Logstash, Elasticsearch should recognized those fields and automatically update the @timestamp field. Examples of potential log events include:

{"timestamp\_epoch": "1432146610", "message": "This is a test message to test epoch timestamp events", "category": "testing", "country": "EU"}

or

{"timestamp\_iso8601": "2015-05-20T14:30:20-05:00", "message": "This is a test message to test epoch timestamp events", "category": "testing", "country": "US"}

Please note that every other mapping in that template works fine except for timestamp\_epoch and timestamp\_iso8601. I can tell those two mappings aren't taking affect because the @timestamp isn't updating to the proper value.

You can see a few of the raw sample Elasticsearch entries here: [http://pastebin.com/HmtmNNAb](http://pastebin.com/HmtmNNAb)

The type for timestamp\_iso8601 is updating to date, but it's not overriding the @timestamp field and timestamp\_epoch set to string instead of date

I'd really appreciate if someone could clarify exactly what it is that i'm doing incorrectly.

Thanks for the help!

---

<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:** [July 6, 2017, 12:12am UTC](https://discuss.elastic.co/t/specifying-custom-date-fields-in-an-elasticsearch-index-template/1112/2 "2017-07-06T00:12:37Z")

</div>


