# Exception during date parsing

**URL:** <https://discuss.elastic.co/t/exception-during-date-parsing/28943>\
**Category:** Elasticsearch\
**Tags:** es-hadoop\
**Created:** [September 9, 2015, 3:38pm UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943 "2015-09-09T15:38:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandeep\_gunnam](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sandeep\_gunnam](https://discuss.elastic.co/u/sandeep_gunnam)\
**Post date:** [September 9, 2015, 3:38pm UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943/1 "2015-09-09T15:38:44Z")

</div>

Hi

Es-Hadoop is trying to parse a field as a date though in mapping i defined it as a string. This is causing exception as the date looks like "16/11/05". Part of exception stack trace is below

at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parseYear(Unknown Source)  
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl$Parser.parse(Unknown Source)  
at org.apache.xerces.jaxp.datatype.XMLGregorianCalendarImpl.(Unknown Source)  
at org.apache.xerces.jaxp.datatype.DatatypeFactoryImpl.newXMLGregorianCalendar(Unknown Source)  
at javax.xml.bind.DatatypeConverterImpl.\_parseDateTime(DatatypeConverterImpl.java:426)  
at javax.xml.bind.DatatypeConverterImpl.parseDateTime(DatatypeConverterImpl.java:421)  
at javax.xml.bind.DatatypeConverter.parseDateTime(DatatypeConverter.java:327)  
at org.elasticsearch.hadoop.util.DateUtils.parseDateJdk(DateUtils.java:62)  
at org.elasticsearch.spark.serialization.ScalaValueReader.createDate(ScalaValueReader.scala:134)  
at org.elasticsearch.spark.serialization.ScalaValueReader.parseDate(ScalaValueReader.scala:125)  
at org.elasticsearch.spark.serialization.ScalaValueReader$$anonfun$date$1.apply(ScalaValueReader.scala:118)  
at org.elasticsearch.spark.serialization.ScalaValueReader$$anonfun$date$1.apply(ScalaValueReader.scala:118)  
at org.elasticsearch.spark.serialization.ScalaValueReader.checkNull(ScalaValueReader.scala:70)  
at org.elasticsearch.spark.serialization.ScalaValueReader.date(ScalaValueReader.scala:118)  
at org.elasticsearch.spark.serialization.ScalaValueReader.readValue(ScalaValueReader.scala:58)  
at org.elasticsearch.spark.sql.ScalaRowValueReader.readValue(ScalaEsRowValueReader.scala:23)  
at org.elasticsearch.hadoop.serialization.ScrollReader.parseValue(ScrollReader.java:580)  
at org.elasticsearch.hadoop.serialization.ScrollReader.read(ScrollReader.java:568)  
at org.elasticsearch.hadoop.serialization.ScrollReader.map(ScrollReader.java:636)  
at org.elasticsearch.hadoop.serialization.ScrollReader.read(ScrollReader.java:559)  
at org.elasticsearch.hadoop.serialization.ScrollReader.readHitAsMap(ScrollReader.java:358)  
at org.elasticsearch.hadoop.serialization.ScrollReader.readHit(ScrollReader.java:293)  
at org.elasticsearch.hadoop.serialization.ScrollReader.read(ScrollReader.java:188)  
at org.elasticsearch.hadoop.serialization.ScrollReader.read(ScrollReader.java:167)  
at org.elasticsearch.hadoop.rest.RestRepository.scroll(RestRepository.java:403)  
at org.elasticsearch.hadoop.rest.ScrollQuery.hasNext(ScrollQuery.java:76)  
at org.elasticsearch.spark.rdd.AbstractEsRDDIterator.hasNext(AbstractEsRDDIterator.scala:43)

It is obvious why the exception. But why Es-Hadoop is trying to parse it like a date instead of String as defined in mapping.

In my last post you said my message formatting is bad and not readable, but i could see the text properly. I am not sure why because i am just typing in the text box provided by Discus. Can you suggest how to correct it if something i am doing is not right.

-Sandeep

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [September 10, 2015, 8:50am UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943/2 "2015-09-10T08:50:36Z")

</div>

What is your Elasticsearch mapping? The exception occurs because indeed the string is attempted to be parsed as a Date and doesn't obey the ISO 8601.

As for mapping, when you write the post, you have a tool bar that you can use to format if you're not familiar with Markdown which Discuss uses. In fact you also have a preview window to your right:

![](https://us1.discourse-cdn.com/elastic/original/2X/4/4cb0053bce3a84ee162a673bff3da30614d6dfce.png)

---

<div class="post-metadata">

**Author:** ![sandeep\_gunnam](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sandeep\_gunnam](https://discuss.elastic.co/u/sandeep_gunnam)\
**Post date:** [September 10, 2015, 11:59am UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943/3 "2015-09-10T11:59:02Z")

</div>

Hi Costin

Thanks for your response. There is a problem in my mapping, that is why this issue. I corrected my mapping and it works fine now.

Thanks again for your support.

-Sandeep

---

<div class="post-metadata">

**Author:** ![costin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/costin/32/44950_2.png) [@costin](https://discuss.elastic.co/u/costin)\
**Post date:** [September 10, 2015, 1:11pm UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943/4 "2015-09-10T13:11:16Z")

</div>

Glad to hear 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:** [July 6, 2017, 1:27pm UTC](https://discuss.elastic.co/t/exception-during-date-parsing/28943/5 "2017-07-06T13:27:31Z")

</div>


