What is the best field type to use numerical values such as 20.5, 10,3? For some reason I mapped them as half-float long ago but now I sometimes get values such as 20.5123. At the time this was fine as I used Kibana's formatter to just make them look like x.x again but now I want to give some color formatting to my data.
Also, is there any difference between the field type I should use for 20**.5 or 20,**5?
I would use a scaled_float for exact decimal values. A scaled float is just a long internally, that applies a scaling factor to turn it into a decimal for presentation purposes. So you can configure the range of values you care about and keep precision.
The various floats (float, double, half-float, etc) are all true floating-point data types, and you'll see rounding error due to how the floating point math works. Fine for most quantities, but not acceptable for things like currency
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.