Malformed date value? But the date and the template match

CSV data looks like his

220364000,2015-09-04 11:04:23,Under way using engine,65.5000000,-53.5114983

Mapping to create index a009 was created this way.

$ curl -XPUT 'http://10.30.90.5:9200/a009' -d '{
"mappings": {
"type": {
"properties": {
"mmsi" : { "type": "string" },
"datetime" : { "type": "date", "format": "YYYY-MM-dd HH:mm:ss"},
"status" : { "type": "string", "index": "not_analyzed" },
"lat" : { "type": "float" },
"long" : { "type": "float" }
}
}
}
}'

Getting this error:

"error"=>{"type"=>"mapper_parsing_exception",
"reason"=>"failed to parse [datetime]",
"caused_by"=>{"type"=>"illegal_argument_exception",
"reason"=>"Invalid format: "2015-09-04 11:04:23" is malformed at " 11:04:23""}}

How is it that

2015-09-04 11:04:23 (a date value)

is malformed?

I've moved this to the ES area as it's more suitable than LS :slight_smile:

OK... Thanks.

I could be wrong but I think you have to wrap literal characters in ''s so your format in your mapping should be:

 "format": "YYYY-MM-dd' 'HH:mm:ss"

see https://www.elastic.co/guide/en/elasticsearch/reference/2.1/mapping-date-format.html#custom-date-formats and http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html for more details on the date format

This works for me in ES2.0, only diff I see is yyyy vs YYYY

"post_date_gmt": {
                "type": "date",
                "format": "yyyy-MM-dd HH:mm:ss"
            },