I recently got this strange problem in a new index:
Basic info:
Elasticsearch Version: 7.13.2
Nodes: 1 Node (localhost in Dev-Env)
Middleware: [Elasticsearch-PHP] API-Wrapper
The index got a date field and a numeric field to count up with the explicit mapping:
//PHP-Syntax but should be readable
"click_count" => [
"type" => "long",
],
"created" => [
"type" => "date",
"format" => "strict_date_optional_time||epoch_millis"
],
If a document gets indexed with a epochMillis value everything is fine.
However if want to increase the counter by an update call with scripted update:
..."type":"mapper_parsing_exception","reason":"failed to parse field [created] of type [date] in document with id 'sZwXXXoBfo59-9IusoIu'. Preview of field's value: '1.625059471792E12'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [1.625059471792E12] with format [strict_date_optional_time||epoch_millis]"...
Can you share a sample document and how it is stored in Elasticsearch? You may want to store dates as strings in a human readable format, instead as epoch milliseconds/seconds...
You are right, human readable date may be better solution and i may keep it anyway. However i want to understand why elasticsearch fails to reindex a document with epochMilli date field value, without the special treatment on updates.
And if the workarround is intended to be used, why does elasticsearch support the format "epoch_millis" at all, if you have to look and take care on every update of documents with casting.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.