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

版本: 6.8-7.15

简而言之,当 Elasticsearch 尝试解析消息附件中某个字段时,如果它期望该字段是布尔值,但实际值是不同的数据类型,就会发生此错误。要解决此问题,您可以检查被索引的数据,以确保相关字段确实是布尔值。如果数据来自外部源,您可能需要添加预处理步骤,在索引之前将字段转换为布尔值。或者,您可以修改索引的映射以接受字段的实际数据类型。

日志上下文 #

日志 “could not parse message attachment field. expected a boolean value for” 的类名是 Field.java。我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

}
} else if (XField.SHORT.match(currentFieldName, parser.getDeprecationHandler())) {
    if (token == XContentParser.Token.VALUE_BOOLEAN) {
        isShort = parser.booleanValue();
    } else {
        throw new ElasticsearchParseException("could not parse message attachment field. expected a boolean value for " +
            "[{}] field; but found [{}]", XField.SHORT, token);
    }
} else {
    throw new ElasticsearchParseException("could not parse message attachment field. unexpected field [{}]",
        currentFieldName);
}