Exception during date parsing

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

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:

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

Glad to hear it!