POST /cq_sample_index/_doc/2
{
"code": 11258999069452421,
"code2": 11258999069452421,
"code3": "11258999069452421",
"category": "books",
"description": "A book about advanced Elasticsearch usage and optimization."
}
I got this
{
"_index": "cq_sample_index",
"_id": "2",
"_score": 1,
"_source": {
"code": 11258999069452420,
"code2": 11258999069452420,
"code3": "11258999069452421",
"category": "books",
"description": "A book about advanced Elasticsearch usage and optimization."
}
}
As you can see , the value of code and code2 changed
So why ?
I've tried es8.11.1\ es8.11.4 \ es8.12.1
and I insert data with kibana and python code , same result
I believe this will depend on the JSON library used as the length of the number exceeds standard JSON precision. If you want to index long numbers, map them as long and send the numbers the way you did for the code3 field.
Right, it's to do with the difficulty of representing integers when they are cosnidered as floating point numbers, specifically IEEE-754. A 64-bit floating point number has only around 15/16 digits of precision. So the 18-digit integers here, though well within the range of the long datatype, are problematic.
It is not at all obvious when or if tool X might be doing any intermediate conversions internally. e.g. when I do my POST view curl I see following:
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.