Adding id with long type changes the actual value


(Ehtisham Ullah) #1

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


(Xavier Facq) #2

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


(Ehtisham Ullah) #3

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"
}
}
}


(Xavier Facq) #4

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


(Ehtisham Ullah) #5

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.


(Xavier Facq) #6

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


(Ehtisham Ullah) #7

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.


(Xavier Facq) #8

ok, ask on Kibana forum then :wink:


(system) #9

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