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

版本: 6.8-7.15

简而言之,当 Elasticsearch 无法解析 Cron 计划任务时会出现此错误,因为预期 Cron 中应为字符串值。这通常发生在 Cron 表达式格式不正确或缺失的情况下。要解决此问题,请确保 Cron 表达式以字符串格式正确格式化并包含在计划任务中。此外,请验证 Cron 表达式是否有效且遵循正确的语法。如果问题仍然存在,请考虑检查与您使用的 Elasticsearch 版本相关的任何更新或错误。

日志上下文 #

日志 “could not parse [cron] schedule. expected a string value in the cron” 的类名是 CronSchedule.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

switch (token) {
    case VALUE_STRING:
        crons.add(parser.text());
        break;
    default:
        throw new ElasticsearchParseException("could not parse [cron] schedule. expected a string value in the cron " +
            "array but found [" + token + "]");
}
}
if (crons.isEmpty()) {
    throw new ElasticsearchParseException("could not parse [cron] schedule. no cron expression found in cron array");