ES unable to parse ISODateTimeFormat?


(bilash) #1

I am trying to index the following JSON document:

{"post" : "I am going to go to london next month",
"postId" : "0",
"username" : "bilash1",
"postTime" : "2012-05-06T15:32:12",
}

But I get the following date format errors:

org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[postTime]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
320) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
417) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareCreate(InternalIndexShard.java:
290) ~[elasticsearch-0.19.1.jar:na]
Caused by: org.elasticsearch.index.mapper.MapperParsingException:
failed to parse date field [2012-05-06T15:32:12], tried both date
format [yyyy-MM-d
d HH-mm-ss], and timestamp number
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
412) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
Caused by: java.lang.IllegalArgumentException: Invalid format:
"2012-05-06T15:32:12" is malformed at "T15:32:12"
at
org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:
644) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
406) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]

This is the ISO datetime format as suggested by Shay. What am I
missing here?

Thanks!


(medcl.net) #2

the data and the format doesn't match:

[2012-05-06T15:32:12]
yyyy-MM-dd HH-mm-ss

-----Original Message-----
From: bilash
Sent: Monday, May 07, 2012 4:05 AM
To: elasticsearch
Subject: ES unable to parse ISODateTimeFormat?

I am trying to index the following JSON document:

{"post" : "I am going to go to london next month",
"postId" : "0",
"username" : "bilash1",
"postTime" : "2012-05-06T15:32:12",
}

But I get the following date format errors:

org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[postTime]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
320) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
417) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareCreate(InternalIndexShard.java:
290) ~[elasticsearch-0.19.1.jar:na]
Caused by: org.elasticsearch.index.mapper.MapperParsingException:
failed to parse date field [2012-05-06T15:32:12], tried both date
format [yyyy-MM-d
d HH-mm-ss], and timestamp number
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
412) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
Caused by: java.lang.IllegalArgumentException: Invalid format:
"2012-05-06T15:32:12" is malformed at "T15:32:12"
at
org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:
644) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
406) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]

This is the ISO datetime format as suggested by Shay. What am I
missing here?

Thanks!


(bilash) #3

Thanks. Yes, I found out later that the format I used in the mapping
was missing the T in the middle.

On May 6, 10:26 pm, medcl2...@gmail.com wrote:

the data and the format doesn't match:

[2012-05-06T15:32:12]
yyyy-MM-dd HH-mm-ss

-----Original Message-----
From: bilash
Sent: Monday, May 07, 2012 4:05 AM
To: elasticsearch
Subject: ES unable to parse ISODateTimeFormat?

I am trying to index the following JSON document:

{"post" : "I am going to go to london next month",
"postId" : "0",
"username" : "bilash1",
"postTime" : "2012-05-06T15:32:12",
}

But I get the following date format errors:

org.elasticsearch.index.mapper.MapperParsingException: Failed to parse
[postTime]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
320) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
417) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.shard.service.InternalIndexShard.prepareCreate(InternalIndexShard.java:
290) ~[elasticsearch-0.19.1.jar:na]
Caused by: org.elasticsearch.index.mapper.MapperParsingException:
failed to parse date field [2012-05-06T15:32:12], tried both date
format [yyyy-MM-d
d HH-mm-ss], and timestamp number
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
412) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:
473) ~[elasticsearch-0.19.1.jar:na]
Caused by: java.lang.IllegalArgumentException: Invalid format:
"2012-05-06T15:32:12" is malformed at "T15:32:12"
at
org.elasticsearch.common.joda.time.format.DateTimeFormatter.parseMillis(DateTimeFormatter.java:
644) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseStringValue(DateFieldMapper.java:
406) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.DateFieldMapper.parseCreateField(DateFieldMapper.java:
341) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.core.AbstractFieldMapper.parse(AbstractFieldMapper.java:
307) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.serializeValue(ObjectMapper.java:
580) ~[elasticsearch-0.19.1.jar:na]
at
org.elasticsearch.index.mapper.object.ObjectMapper.parse(ObjectMapper.java:
444) ~[elasticsearch-0.19.1.jar:na]

This is the ISO datetime format as suggested by Shay. What am I
missing here?

Thanks!


(system) #4