--- title: "不支持小数时间间隔,请使用正整数 - 如何解决此 Elasticsearch 异常" date: 2026-01-16 lastmod: 2026-01-16 description: "当在 Elasticsearch 中使用小数值作为时间间隔时会出现此错误,因为 Elasticsearch 只支持正整数。解决方法是确保所有时间间隔都指定为正整数。" tags: ["时间间隔", "数据类型", "异常处理"] summary: " 版本: 7.8-7.15 简要来说,当在 Elasticsearch 中使用小数值作为时间间隔时会出现此错误,因为 Elasticsearch 只支持正整数。要解决此问题,应确保所有时间间隔都指定为正整数。如果你使用脚本或应用程序来生成这些值,可能需要调整它以四舍五入到最接近的整数,或者避免生成小数值。 日志上下文 # 日志 “Decimal time interval [{}] not supported; please use an positive integer” 的类名是 LogicalPlanBuilder.java。 我们从 Elasticsearch 源代码中提取了以下内容,供寻求深入背景的人参考: } return new TimeValue(value, timeUnit); } else { throw new ParsingException(source(numberCtx), "Decimal time interval [{}] not supported; please use an positive integer", text(numberCtx)); } } private LogicalPlan pipe(PipeContext ctx, LogicalPlan plan) { " --- > **版本:** 7.8-7.15 简要来说,当在 Elasticsearch 中使用小数值作为时间间隔时会出现此错误,因为 Elasticsearch 只支持正整数。要解决此问题,应确保所有时间间隔都指定为正整数。如果你使用脚本或应用程序来生成这些值,可能需要调整它以四舍五入到最接近的整数,或者避免生成小数值。 日志上下文 ----------- 日志 "Decimal time interval [{}] not supported; please use an positive integer" 的类名是 [LogicalPlanBuilder.java。](https://www.geeksforgeeks.org/java-lang-class-class-java-set-1/) 我们从 Elasticsearch 源代码中提取了以下内容,供寻求深入背景的人参考: ```java } return new TimeValue(value, timeUnit); } else { throw new ParsingException(source(numberCtx), "Decimal time interval [{}] not supported; please use an positive integer", text(numberCtx)); } } private LogicalPlan pipe(PipeContext ctx, LogicalPlan plan) { ```