# Date/timestamp fields are indexing as long

**URL:** <https://discuss.elastic.co/t/date-timestamp-fields-are-indexing-as-long/139173>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [July 9, 2018, 12:35pm UTC](https://discuss.elastic.co/t/date-timestamp-fields-are-indexing-as-long/139173 "2018-07-09T12:35:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pradosh\_gupta](https://avatars.discourse-cdn.com/v4/letter/p/8baadc/32.png) [@pradosh\_gupta](https://discuss.elastic.co/u/pradosh_gupta)\
**Post date:** [July 9, 2018, 12:35pm UTC](https://discuss.elastic.co/t/date-timestamp-fields-are-indexing-as-long/139173/1 "2018-07-09T12:35:22Z")

</div>

Hi,

I am using Elasticsearch for Apache Hadoop 6.2.0 to index my data to ES using Structured Streaming (spark2.2.0)  
My data contains one date field and one timestamp field along with other fields.

Data is successfully indexing.  
But the date and timestamp fields values are saved in millis (i.e. long) and data type of these fields is long (as index is created automatically).

How can I save dates as in their original format and not in long ?  
Also how to auto create index with date fields data type as date not long ?

---

<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:** [July 25, 2018, 2:46pm UTC](https://discuss.elastic.co/t/date-timestamp-fields-are-indexing-as-long/139173/2 "2018-07-25T14:46:02Z")

</div>

This is a known issue [https://github.com/elastic/elasticsearch-hadoop/issues/1040](https://github.com/elastic/elasticsearch-hadoop/issues/1040) and in my opinion a bug that needs fixing. If you would like, please head over to the issue and upvote it.

---

<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 22, 2018, 2:46pm UTC](https://discuss.elastic.co/t/date-timestamp-fields-are-indexing-as-long/139173/3 "2018-08-22T14:46:11Z")

</div>

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