A positive maxspan value is required found – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.8-8.9

Briefly, this error occurs when the maxspan value in an Elasticsearch query is set to a non-positive value. Maxspan is used to limit the duration of matches in span queries. It must be a positive value, representing the maximum duration in milliseconds. To resolve this issue, ensure that the maxspan value is set to a positive number. If the value is being dynamically generated, add checks to ensure it’s always positive. If the error persists, check for any possible bugs in the code that may be causing the incorrect value.

This guide will help you check for common problems that cause the log ” A positive maxspan value is required; found [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: parser, plugin.

Log Context

Log “A positive maxspan value is required; found [{}]” class name is LogicalPlanBuilder.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 if (numberCtx instanceof IntegerLiteralContext) {
 Number number = (Number) visitIntegerLiteral((IntegerLiteralContext) numberCtx).fold();
 long value = number.longValue();  if (value <= 0) {
 throw new ParsingException(source(numberCtx); "A positive maxspan value is required; found [{}]"; value);
 }  String timeString = text(ctx.timeUnit().IDENTIFIER());  if (timeString == null) {

 

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?