type":"date_time_exception","reason":"Invalid date 'February 29' as '1970' is not a leap year"}

Hi,

We have some issues trying to index documents with date fields set on the 29 of February.

Below an example :

{"type":"mapper_parsing_exception","reason":"failed to parse field [date_updated] of type [date] in document with id 'mydoc_17107'. Preview of field's value: '2008-02-29 00:00:00'","caused_by":{"type":"date_time_exception","reason":"Invalid date 'February 29' as '1970' is not a leap year"}}

Mapping :

    "mappings" : {
      "mydoc" : {
        "properties" : {
          "date_created" : {
            "type" : "date",
            "format" : "YYYY-MM-dd HH:mm:ss"
          },
          "date_indexed" : {
            "type" : "date",
            "format" : "YYYY-MM-dd HH:mm:ss"
          },
          "date_updated" : {
            "type" : "date",
            "format" : "YYYY-MM-dd HH:mm:ss"
          },
         }
       }
    }

We can reproduce the issue locally (Elasticsearch 7.4.0 using the official docker image) and on Elastic Cloud (Elasticsearch 7.4.1).

Any idea?

Does it change if you change YYYY to yyyy in the format string as in the docs?

Hi Christian,

I did try but unfortunately it didn't change anything.

@spinscale does this ring a bell?

I have also tried with Elasticseach 7.2.0 (docker) and same issue.

@dadoonet, @spinscale have you seen this before? Could you fix it?

Thanks

Using YYYY will not work, as this refers to a week based year.

I tried this on 7.4.0 and it worked just fine,.

DELETE test

PUT test
{
  "mappings": {
    "properties": {
      "date_created": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss"
      }
    }
  }
}

PUT test/_doc/1
{
  "date_created" : "2008-02-29 00:00:00"
}

The document got indexed successfully as it is not using a week based year, but the year-of-era.

Can you please provide a minimal exact reproduction under 7.4.1 including index creation and mapping, so we can figure out what is going on and what is different to my sample, that yours does not work?

Thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.