You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Insert a document with date value as "-561600000"( With 9 digits.)
curl -X POST "localhost:9200/testindex/_doc/?pretty" -H 'Content-Type: application/json' -d'{"event_timestamp": "-561600000"}'
Response contains error message as,
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [event_timestamp] of type [date] in document with id 'XkCoRpQBBkWe45k1QzUB'. Preview of field's value: '-561600000'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [event_timestamp] of type [date] in document with id 'XkCoRpQBBkWe45k1QzUB'. Preview of field's value: '-561600000'",
"caused_by": {
"type": "arithmetic_exception",
"reason": "long overflow"
}
},
"status": 400
}
Insert a document with date value as "-5616000000"( With 10 digits.)
curl -X POST "localhost:9200/testindex/_doc/?pretty" -H 'Content-Type: application/json' -d'{"event_timestamp": "-5616000000"}'
Response contains error message as,
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "failed to parse field [event_timestamp] of type [date] in document with id 'X0CoRpQBBkWe45k1sjXW'. Preview of field's value: '-5616000000'"
}
],
"type": "mapper_parsing_exception",
"reason": "failed to parse field [event_timestamp] of type [date] in document with id 'X0CoRpQBBkWe45k1sjXW'. Preview of field's value: '-5616000000'",
"caused_by": {
"type": "date_time_exception",
"reason": "Invalid value for Year (valid values -999999999 - 999999999): -5616000000"
}
},
"status": 400
}
curl -X POST "localhost:9200/testindex/_doc/?pretty" -H 'Content-Type: application/json' -d'{"event_timestamp": "-561600000"}'
Expected behavior
With default format, negative epoch values should be parsed correctly.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
OS: [e.g. iOS]
Version: OpenSearch 1.3 onwards
Additional context
Add any other context about the problem here.
OpenSearch and ElasticSearch code base of handling negative values is different. In OpenSearch, -561600000 is parsed as a Year but in Elasticsearch parsed correctly
Describe the bug
While storing negative epoch millis with certain length, getting parsing execption
These negative values(-561600000, -5616000000) are parsed incorrectly with default format "strict_date_optional_time||epoch_millis".
But, when format changed to "epoch_millis||strict_date_optional_time", then these values are parsed correctly.
other closer ranges(-56160000 or -56160000000), are parsed correctly with default format.
Related component
Indexing
To Reproduce
Expected behavior
With default format, negative epoch values should be parsed correctly.
Additional Details
Plugins
Please list all plugins currently enabled.
Screenshots
If applicable, add screenshots to help explain your problem.
Host/Environment (please complete the following information):
Additional context
Add any other context about the problem here.
OpenSearch and ElasticSearch code base of handling negative values is different. In OpenSearch, -561600000 is parsed as a Year but in Elasticsearch parsed correctly
ES code: https://github.com/elastic/elasticsearch/pull/73034/files#diff-27cb6b4759805385f2b88731b2071c644258c9842be25536d2c7b31314f1348d
OpensSearch code: https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/common/time/DateFormatters.java#L93
The text was updated successfully, but these errors were encountered: