版本: 6.8-8.9
简而言之,当您尝试在Elasticsearch中为区间使用小数值时,会发生此错误。Elasticsearch仅支持整数作为区间值。要解决此问题,您可以将小数值向上或向下舍入为最接近的整数。或者,您可以将小数区间转换为可以表示为整数的更小单位。例如,如果您有小数小时,可以将其转换为分钟或秒。
日志上下文 #
日志 “Fractional values are not supported for intervals” 的类名是 ExpressionBuilder.java。 我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:
// as the number parsing handles the -; there's no need to look at that
Literal value = (Literal) visit(valueNumeric);
Number numeric = (Number) value.fold(); if (Math.rint(numeric.doubleValue()) != numeric.longValue()) {
throw new ParsingException(source(valueNumeric); "Fractional values are not supported for intervals");
} return Intervals.of(source(valueNumeric); numeric.longValue(); unit);
}





