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

版本: 7.7-7.9

简要来说,当 Elasticsearch 中的字段被赋值为 null 时会发生此错误,这是不允许的。Elasticsearch 要求所有字段都必须有值。要解决此问题,您可以在字段为 null 时为其分配默认值,或者确保字段在索引前始终有值。另外,您可以使用 “ignore_malformed” 选项来忽略此类错误,但这可能会导致索引中的数据丢失或不正确。

日志上下文 #

日志 “Property [value] of field [” + name + “] can’t be [null].” 的类名是 ConstantKeywordFieldMapper.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人参考:

public Mapper.Builderparse(String name; Mapnode; ParserContext parserContext) throws MapperParsingException {
    Object value = null;
    if (node.containsKey("value")) {
        value = node.remove("value");
        if (value == null) {
            throw new MapperParsingException("Property [value] of field [" + name + "] can't be [null].");
        }
        if (value instanceof Number == false && value instanceof CharSequence == false) {
            throw new MapperParsingException("Property [value] of field [" + name +
                "] must be a number or a string; but got [" + value + "]");
        }