TL;DR;
Valid: 2019-07-10T17:01:01.500Z
Valid: 2019-07-10T17:01:01.50Z
INVALID: 2019-07-10T17:01:01.5Z
I want to know how to accept the invalid value as a valid value, since it is a valid date value.
I'm trying to add a document that contains a date property, if this property has a time with a rounded milliseconds that results in only one digit, it causes the following error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [value_at] of type [date] in document with id '1'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [value_at] of type [date] in document with id '1'",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "failed to parse date field [2019-07-10T17:01:01.5Z] 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
}
Steps to reproduce:
PUT my_index/_doc/1
{
"value_at": "2019-07-10T17:01:01.500Z"
}
PUT my_index/_doc/1
{
"value_at": "2019-07-10T17:01:01.5Z"
}
Mapping generated by the first PUT:
{
"my_index" : {
"aliases" : { },
"mappings" : {
"properties" : {
"value_at" : {
"type" : "date"
}
}
},
"settings" : {
"index" : {
"creation_date" : "1562792878369",
"number_of_shards" : "1",
"number_of_replicas" : "1",
"uuid" : "gXOZiC0PTFuQKaOwdeoyig",
"version" : {
"created" : "7000199"
},
"provided_name" : "my_index"
}
}
}
}
