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

版本: 6.8-7.15

简而言之,当 Elasticsearch 由于格式不正确或语法错误而无法解析特定的计划或持续时间时,就会出现此错误。这可能是 cron 表达式或时间单位的问题。要解决此问题,请确保计划或持续时间按照 Elasticsearch 的指南正确格式化。例如,cron 表达式应采用 “分 时 日 月 周” 的格式。对于持续时间,请使用正确的时间单位,如 “s” 表示秒,“m” 表示分钟,“h” 表示小时,“d” 表示天。

日志上下文 #

日志 “could not parse [{}] schedule. could not parse [{}] as a [{}] duration” 的类名是 IntervalSchedule.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:

    assert value.endsWith(suffix);
    String num = value.substring(0, value.indexOf(suffix));
    try {
        return Long.parseLong(num);
    } catch (NumberFormatException nfe) {
        throw new ElasticsearchParseException("could not parse [{}] schedule. could not parse [{}] as a [{}] duration",
            TYPE, num, name().toLowerCase(Locale.ROOT));
    }
}

public String format(long duration) {