版本: 6.8-8.9
简而言之,当Elasticsearch的日期数学表达式中使用了不支持的单位时,就会出现此错误。Elasticsearch支持特定的单位,如毫秒(ms)、秒(s)、分钟(m)、小时(h)、天(d)、周(w)、月(M)和年(y)。如果您使用不支持的单位,就会遇到此错误。要解决此问题,请确保您在日期数学表达式中使用了正确的单位。如果不确定,请参阅Elasticsearch文档以获取支持的单位列表。
日志上下文 #
日志"unit [{}] not supported for date math [{}]“的类名是 JavaDateMathParser.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人使用:
} else {
dateTime = dateTime.plusSeconds(sign * num);
}
break;
default:
throw new ElasticsearchParseException("unit [{}] not supported for date math [{}]", unit, mathString);
}
if (round && roundUpProperty) {
// subtract 1 millisecond to get the largest inclusive value
dateTime = dateTime.minus(1, ChronoField.MILLI_OF_SECOND.getBaseUnit());
}





