# Spark How to store DateType As Date not as Long

**URL:** <https://discuss.elastic.co/t/spark-how-to-store-datetype-as-date-not-as-long/74871>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [February 13, 2017, 11:54am UTC](https://discuss.elastic.co/t/spark-how-to-store-datetype-as-date-not-as-long/74871 "2017-02-13T11:54:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramvodedara](https://avatars.discourse-cdn.com/v4/letter/r/8edcca/32.png) [@ramvodedara](https://discuss.elastic.co/u/ramvodedara)\
**Post date:** [February 13, 2017, 11:54am UTC](https://discuss.elastic.co/t/spark-how-to-store-datetype-as-date-not-as-long/74871/1 "2017-02-13T11:54:15Z")

</div>

when creating index with spark all DateType column is stored as Long  
But I want to store as Date  
How can i ?

---

<div class="post-metadata">

**Author:** ![james.baiera](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/james.baiera/32/10209_2.png) [@james.baiera](https://discuss.elastic.co/u/james.baiera)\
**Post date:** [February 14, 2017, 8:50pm UTC](https://discuss.elastic.co/t/spark-how-to-store-datetype-as-date-not-as-long/74871/2 "2017-02-14T20:50:54Z")

</div>

@ramvodedara ES-Hadoop/Spark delegates to Elasticsearch's facilities for automatically assigning mappings. If one of the mappings is not what you expected automatically, you must set the mapping for the index yourself before sending documents to it in ES-Hadoop/Spark.

---

<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:** [March 14, 2017, 8:50pm UTC](https://discuss.elastic.co/t/spark-how-to-store-datetype-as-date-not-as-long/74871/3 "2017-03-14T20:50:54Z")

</div>

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