What Is Relevance?edit
We’ve mentioned that, by default, results are returned in descending order of relevance. But what is relevance? How is it calculated?
The relevance score of each document is represented by a positive floating-point number called the _score. The higher the _score, the more relevant the document.
所以,elasticsearch中分数是 浮点类型的 。
IEEE 754
这里就不细说什么是IEEE 754了,就直接讲具体内容,有兴趣的可以自己百度。
float
符号位(S):1bit 指数位(E):8bit 尾数位(M):23bit
float的尾数:23位,其范围为:0~223,而223=8388608,所以float的精度为6~7位,能保证6位为绝对精确,7位一般也是正确的,8位就不一定了(但不是说8位就绝对不对了)
那为什么elasticsearch 要用float呢,看了一下源代码 FiltersFunctionFactorScorer 类