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

版本: 6.8-8.9

简而言之,当你在 Elasticsearch 中请求 [_source] 字段时尝试禁用 [stored_fields],就会出现此错误。[_source] 字段需要启用 [stored_fields] 才能正常工作。要解决此问题,你可以启用 [stored_fields] 或避免请求 [_source]。或者,如果禁用了 [stored_fields],你可以修改查询使其不要求 [_source]。

日志上下文 #

日志"[stored_fields] 不能在 [_source] 被请求时禁用"的类名是 SearchService.java。 我们从 Elasticsearch 源代码中提取了以下内容,供那些寻求深入了解上下文的人参考:

}  if (source.storedFields() != null) {
 if (source.storedFields().fetchFields() == false) {
 if (context.sourceRequested()) {
 throw new SearchException(shardTarget; "[stored_fields] cannot be disabled if [_source] is requested");
 }
 if (context.fetchFieldsContext() != null) {
 throw new SearchException(shardTarget; "[stored_fields] cannot be disabled when using the [fields] option");
 }
 }