📣 极限科技诚招搜索运维工程师(Elasticsearch/Easysearch)- 全职/北京 👉 : 立即申请加入

版本: 6.8-7.4

简要来说,当 Elasticsearch 聚合查询中 extended_bounds 参数的 min 值被设置为高于 max 值时,就会发生此错误。这是不正确的,因为 min 值应该始终小于或等于 max 值。

要解决此问题,你应该调整查询以确保 min 值小于或等于 max 值。或者,如果你的查询不需要 extended_bounds 参数,可以将其删除。

日志上下文 #

日志 “[extended_bounds.min][” + min + “] cannot be greater than” 的类名是 ExtendedBounds.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入理解的人参考:

if (maxAsStr != null) {
    // TODO: 我们是否应该传递 roundUp=true?
    max = format.parseLong(maxAsStr, false, context.getQueryShardContext()::nowInMillis);
}
if (min != null && max != null && min.compareTo(max) > 0) {
    throw new SearchParseException(context, "[extended_bounds.min][" + min + "] cannot be greater than " +
    "[extended_bounds.max][" + max + "] for histogram aggregation [" + aggName + "]", null);
}
return new ExtendedBounds(min, max, minAsStr, maxAsStr);
}