Painless converts float to integer

(Jerzy Stopa) #1

I have field 'payload.temperature[c]' in one of the indexes. I cannot use it in Timelion due to [] therefore I created simple scripted field Temp defined as follows:return doc['payload.temperature[c]'].value

But instead of getting same value (float) I get integer

> Time 	                          payload.temperature[c]              Temp      
> 2018-09-13 08:36:00                      31.1                                   31
> 2018-09-13 08:35:57                       6.5                                    6
> 2018-09-13 08:35:00                      31.3                                   31
> 2018-09-13 08:34:57                       6.6                                    6

Scripted field has type number and format number/default. Any help?

(Jon Budzenski) #2

Hmm, strange, painless should support floats just fine. Can you share elasticsearch mappings for payload.temperature?

The number format is the browser's interpretation of it, and javascript isn't too picky about decimals so I don't think it should be doing anything.

(Jerzy Stopa) #3

You are right, there is something wrong in mappings. with field show once as long and once as text.
I am confuse of how it happened. Will try to correct, reindex and hope problem will disappear.
Thank you for suggestion

(system) #4

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