Skip to content
Advertisement

failed to parse field [datefield] of type [date]

I’m trying to index a lot of records but I’m facing some troubles when index publish_up field. I mapped that field as date and format by default but I get this error:

Error: 400 {“error”:{“root_cause”:[{“type”:”mapper_parsing_exception”,”reason”:”failed to parse field [publish_up] of type [date]”}],”type”:”mapper_parsing_exception”,”reason”:”failed to parse field [publish_up] of type [date]”,”caused_by”:{“type”:”illegal_argument_exception”,”reason”:”Invalid format: “2015-02-11 00:00:00″ is malformed at ” 00:00:00″”}},”status”:400}

This is how I configure index:

JavaScript

And index code (here I get the error):

JavaScript

NOTE: $datos->publish_up has this dateformat 2015-02-11 00:00:00. I checked Documentation but I can’t solve my problem.

Advertisement

Answer

Since your date format is not standard ISO8601 (missing the T between the date and the time), you need to add a format in your mapping. You did, but the pattern was wrong, as you used YYYY for years instead of yyyy and mm for months instead of MM. Try like this:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement