Number Precision

Hi,

I am facing an issue with the number precision.
We have a field "consumptionvalue" as float which contains numeric values like 0.001, 0.004, 0.054 etc.
When i try to search for records with below query
consumptionvalue:[0 TO 1]
I still get the values out of this range(+ve).

Is there anything else that we need to do to address this precision issue.

Is it conceivable for you to change your type and use scaled_float with a scaling_factor of 1000 instead? That way 0.001 would be stored as 1, 0.054 as 54 and the range queries will become queries on integer numbers, hence much more precise. Can you give it a shot?

1 Like

Thanks, I have fixed it by changing the type and works fine , for some reason the first record say with value was streamed in as “long “ and hence the mapping for all the values were of type long.
I enabled the mapping as “float” and hence worked
Thanks for your help

Yes, that can also be the reason. Glad you figured it out!

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