版本: 6.8-7.15
简而言之,当 Elasticsearch 尝试解析附件时遇到意外的数据类型,就会发生此错误。相关字段预期为字符串类型,但实际提供了不同的数据类型。要解决此问题,可以检查要索引的数据,确保该字段确实是字符串。如果不是,应该在索引之前将其转换为字符串。或者,可以修改映射以接受你提供的数据类型。
日志上下文 #
日志“could not parse data attachment. expected string value for [{}] field but”的类名是 DataAttachment.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入背景信息的人参考:
Field.FORMAT.getPreferredName(), token);
} else if (Field.FORMAT.match(currentFieldName, parser.getDeprecationHandler())) {
if (token == XContentParser.Token.VALUE_STRING) {
dataAttachment = resolve(parser.text());
} else {
throw new ElasticsearchParseException("could not parse data attachment. expected string value for [{}] field but " +
"found [{}] instead", currentFieldName, token);
}
} else {
throw new ElasticsearchParseException("could not parse data attachment. unexpected field [{}]", currentFieldName);
}





