Java Long serialisation

(Mayank Natani) #1

I am using

BulkProcessor Java classes's method setSource ( Map < String, Object > ) .

one of the object I am sending is a java Long with value 4188977024190880439 but when I look it up in the kibana, the value that it shows is 4188977024190880300.

This is happening with most of the values also, the last three digits seems to be generated at random or something.

(Magnus Bäck) #2

What's the field's mapping? It sounds like it might be mapped as a double instead of a long.

(Mayank Natani) #3

Yes. It is double, but that shouldn't be a problem, right? I didn't define mapping myself, I just let the ES decide the mapping.

(Magnus Bäck) #4

The fact that it's mapped as a double is precisely the problem. An IEEE double value holds about 16 digits of precision, and it's indeed the 17th digit that's different in your case. You need to make sure the field is mapped as a long.

(Mayank Natani) #5

Cool. Thanks man!! Will change it to Long. :slight_smile:

(system) #6