版本: 6.8-8.9
简要来说,当 Elasticsearch 尝试解析日期字段但遇到意外的格式时,就会发生此错误。日期字段应该是对象类型,但实际找到的是数组或其他数据类型。要解决此问题,你可以检查尝试索引的数据,确保日期字段的格式正确。或者,你可以修改映射以正确解释日期字段。另一种解决方案是在索引之前使用脚本将数据转换为预期的格式。
Log Context #
日志 “could not parse year times. expected an object; but found [{}]” 的类名是 YearTimes.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入上下文的人参考:
return new Builder();
}
public static YearTimes parse(XContentParser parser, XContentParser.Token token) throws IOException, ElasticsearchParseException {
if (token != XContentParser.Token.START_OBJECT) {
throw new ElasticsearchParseException("could not parse year times. expected an object; but found [{}]", token);
}
EnumSet<Month> monthsSet = EnumSet.noneOf(Month.class);
Set<DayOfWeek> daysSet = new HashSet<>();
Set<LocalTime> timesSet = new HashSet<>();
String currentFieldName = null;





