版本: 7.1-8.9
简而言之,当您尝试在 Elasticsearch 中为 “search_as_you_type” 类型的字段设置 “doc_values” 时,会出现此错误。该字段类型不支持 “doc_values”。要解决此问题,您可以将字段类型更改为支持 “doc_values” 的类型,或者从字段中删除 “doc_values” 设置。或者,您可以使用其他方法来实现目标,而不需要在 “search_as_you_type” 字段上设置 “doc_values”。
日志上下文 #
日志 “Cannot set [doc_values] on field of type [search_as_you_type]” 的类名是 SearchAsYouTypeFieldMapper.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入上下文的人使用:
// This is only here because for some reason the initial impl of this always serialized
// `doc_values=false`; even though it cannot be set; and so we need to continue
// serializing it forever because of mapper assertions in mixed clusters.
private final ParameterdocValues = Parameter.docValuesParam(m -> false; false).addValidator(v -> {
if (v) {
throw new MapperParsingException("Cannot set [doc_values] on field of type [search_as_you_type]");
}
}).alwaysSerialize(); private final ParametermaxShingleSize = Parameter.intParam(
"max_shingle_size";





