Adding id with long type changes the actual value

I am trying to figure out why elasticsearch is changing the id field of the document that i am inserting. first i was inserting it with data type integer than i realize the id is too heavy for the integer so i declared the data type with long but I ended up with the same situation. I am getting the same issue.
id value i get after inserting is 838738379231670300 where it is supposed to be 838738379231670227,
I think elasticsearch round off the value. Please help needed

Hi,
Can you check & provide your index mapping ?
Note that if you don't have created a new index, inserting a new value has no impact on the field format.

bye,
Xavier

This is the initial mapping for the fields where I want exact format,
"mappings": {
"tweet":
{
"properties": {
"coordinates": {
"properties": {
"coordinates": {
"type": "geo_point"
}
}
},
"created_at":{
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
},
"id" :
{
"type": "long"
}
}
}

Have you recreate a new index since you have changed your mapping ?

Yes I have created index after creating mapping id field show the type as long but the issue is still there it roundoff the last 3 digits, as mentioned above.

The mapping looks good, how do you index your datas ? Do you have any errors or warnings in your server log ?

I figured it out this is happening because of javascript encoding, elasticsearch save and return the exact result but while presenting the stored id field the javascript round off the value in kibana.
I run some cypher queries from outside kibana in python which received the correct values.

ok, ask on Kibana forum then :wink:

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.