# Converting long into a proper date field once in ES

**URL:** <https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237>\
**Category:** Elasticsearch\
**Created:** [July 23, 2018, 6:27pm UTC](https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237 "2018-07-23T18:27:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amandrell](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@amandrell](https://discuss.elastic.co/u/amandrell)\
**Post date:** [July 23, 2018, 6:27pm UTC](https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237/1 "2018-07-23T18:27:38Z")

</div>

I have various fields in my data that are in epoch\_millis (long). Is it possible to create a mapping that converts this long into a proper date field when it gets ingested in Elasticsearch?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 23, 2018, 6:31pm UTC](https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237/2 "2018-07-23T18:31:22Z")

</div>

If you want to change the format in the source document, you can use an [ingest pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/pipeline.html) with a [date processor](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/date-processor.html). If you want to keep the format in the document but make sure it is indexed as a date, you can [map it as a date with the correct format](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/date.html). A mapping does not alter the content of the indexed document, just how it is interpreted and indexed.

---

<div class="post-metadata">

**Author:** ![amandrell](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@amandrell](https://discuss.elastic.co/u/amandrell)\
**Post date:** [July 23, 2018, 6:35pm UTC](https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237/3 "2018-07-23T18:35:15Z")

</div>

Brilliant, thank you Christian!

---

<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:** [August 20, 2018, 6:35pm UTC](https://discuss.elastic.co/t/converting-long-into-a-proper-date-field-once-in-es/141237/4 "2018-08-20T18:35:17Z")

</div>

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