Description
Elasticsearch version (bin/elasticsearch --version
):
5.6.12 vs 74.2
Plugins installed: []
unrelated
JVM version (java -version
):
openjdk version "1.8.0_232"
OS version (uname -a
if on a Unix-like system):
centos8 container
Linux 044afd19e126 4.9.184-linuxkit #1 SMP Tue Jul 2 22:58:16 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Description of the problem including expected versus actual behavior:
Steps to reproduce:
This admittedly weird, incomplete date time string with a timezone offset:
2016-11-30T12+01
is accepted as a date
by ES 5.6.12 but fails on ES 7.4.2 (probably any 7.x?) with:
HTTP/1.1 400 Bad Request
"type" : "illegal_argument_exception",
"reason" : "failed to parse date field [2016-11-30T12+01] with format [strict_date_optional_time||epoch_millis]",
curl -X PUT "elasticsearch:9200/my_index?pretty" -H 'Content-Type: application/json' --data-binary '{
"mappings": {
"doc": {
"properties": {
"date": {
"type": "date"
}
}
}
}
}'
curl -i -XPUT -H 'Content-type: application/json' http://elasticsearch:9200/my_index/doc/1 --data-binary '{"date": "2016-11-30T12+01"}'
HTTP/1.1 201 Created
curl -X PUT "elasticsearch:9200/my_index?include_type_name=true&pretty" -H 'Content-Type: application/json' --data-binary '{
"mappings": {
"doc" : {
"properties": {
"date": {
"type": "date"
}
}
}
}
}'
curl -i -XPUT -H 'Content-type: application/json' http://elasticsearch:9200/my_index/doc/1?pretty --data-binary '{"date": "2016-11-30T12+01"}'
HTTP/1.1 400 Bad Request
Warning: 299 Elasticsearch-7.4.2-2f90bbf7b93631e52bafb59b3b049cb44ec25e96 "[types removal] Specifying types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id})."
content-type: application/json; charset=UTF-8
content-length: 767
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "failed to parse field [date] of type [date] in document with id '1'. Preview of field's value: '2016-11-30T12+01'"
}
],
"type" : "mapper_parsing_exception",
"reason" : "failed to parse field [date] of type [date] in document with id '1'. Preview of field's value: '2016-11-30T12+01'",
"caused_by" : {
"type" : "illegal_argument_exception",
"reason" : "failed to parse date field [2016-11-30T12+01] with format [strict_date_optional_time||epoch_millis]",
"caused_by" : {
"type" : "date_time_parse_exception",
"reason" : "Failed to parse with all enclosed parsers"
}
}
},
"status" : 400
}
Btw same behavior if the strict_date_optional_time
is used explicitly in the mapping, it's the default in both elasticsearch versions.
"format": "strict_date_optional_time||epoch_millis"
Provide logs (if relevant):
See output above, it just seems like a change in what the date parser accepts. Can that be fixed or is this by design?
Besides the regression and incompatibility this introduces for users upgrading, can this cause any in-place upgrade problems with ES 5 => 7?