Date_time format change in elasticsearch from version 6.5 to 7.2

Hi all, I noticed that some dates that were correctly handled by elasticsearch version 6.5 are rejected by elasticsearch 7.2. Here is an example:

Elasticseach 7.2.0

PUT localhost:9200/my_index
{
  "mappings": {
    "properties": {
      "date": {
        "type":   "date",
        "format": "date_time"
      }
    }
  }
}

This document is successfully indexed:

POST  localhost:9200/my_index/_doc
{
  "date": "99999-12-31T23:59:59.999+0000"
}

While this one is rejected:

POST  localhost:9200/my_index/_doc
{
  "date": "100000-01-01T00:00:00.000+0000"
}

The error is:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "failed to parse field [date] of type [date] in document with id 'vp5Ms2sBNm1nVrvtzmYN'"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse field [date] of type [date] in document with id 'vp5Ms2sBNm1nVrvtzmYN'",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "failed to parse date field [100000-01-01T00:00:00.000+0000] with format [date_time]",
      "caused_by" : {
        "type" : "date_time_parse_exception",
        "reason" : "Failed to parse with all enclosed parsers"
      }
    }
  },
  "status" : 400
}

Elasticseach 6.5.4

PUT localhost:9200/my_index
{
  "mappings": {
    "_doc": {
      "properties": {
        "date": {
          "type":   "date",
          "format": "date_time"
        }
      }
    }
  }
}

Both documents are successfully indexed:

POST  localhost:9200/my_index/_doc
{
  "date": "99999-12-31T23:59:59.999+0000"
}

POST  localhost:9200/my_index/_doc
{
  "date": "100000-01-01T00:00:00.000+0000"
}

I haven't found anything in the changelogs about this, any suggestion on how to keep the old behavior?

This has very likely happened with the migration from joda time to java time. See https://www.elastic.co/guide/en/elasticsearch/reference/7.2/breaking-changes-7.0.html#breaking_70_java_time_changes

Can you please open a github issue about this? Thank you!

--Alex

Thanks for your answer, I'll open the issue on github

Here is the GitHub issue: https://github.com/elastic/elasticsearch/issues/43966

1 Like

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