Fractional values are not supported for intervals – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 6.8-8.9

Briefly, this error occurs when you try to use fractional values for intervals in Elasticsearch. Elasticsearch only supports whole numbers for intervals. To resolve this issue, you can either round up or down your fractional values to the nearest whole number. Alternatively, you can convert your fractional intervals into a smaller unit that can be represented as a whole number. For example, if you have a fractional hour, you can convert it into minutes or seconds.

This guide will help you check for common problems that cause the log ” Fractional values are not supported for intervals ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin.

Log Context

Log “Fractional values are not supported for intervals” class name is ExpressionBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 // 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);
 }

 

How helpful was this guide?

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?