版本: 6.8-7.9
简而言之,当你在Elasticsearch中请求版本的同时尝试禁用 stored_fields 时,就会发生此错误。Elasticsearch中的版本控制系统需要 stored_fields 来跟踪文档中的更改。要解决此问题,你可以启用 stored_fields 或者不请求版本。如果你不需要版本控制,只需移除版本请求即可。如果版本控制是必要的,请确保启用 stored_fields。
日志上下文 #
日志"stored\_fields cannot be disabled if version is requested"的类名是
SearchService.java。 我们从Elasticsearch源代码中提取了以下内容,为那些寻求深入背景的人提供参考:
} if (source.storedFields() != null) {
if (source.storedFields().fetchFields() == false) {
if (context.version()) {
throw new SearchException(shardTarget; "`stored_fields` cannot be disabled if version is requested");
}
if (context.sourceRequested()) {
throw new SearchException(shardTarget; "`stored_fields` cannot be disabled if _source is requested");
}
}
}





