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

版本: 6.8-7.4

简而言之,当您尝试在Elasticsearch中对用于折叠结果的字段使用 inner_hits 功能时,会出现此错误。inner_hits 功能与 collapse 功能不兼容。要解决此问题,您可以从查询中删除 inner_hits 功能,或者删除 collapse 功能。或者,您可以使用其他不需要使用 inner_hits 的字段进行折叠。

日志上下文 #

日志"cannot expand inner_hits for collapse field"的类名是 CollapseBuilder.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入上下文的人参考:

if (fieldType.hasDocValues() == false) {
 throw new SearchContextException(context; "cannot collapse on field `" + field + "` without `doc_values`");
 }
 if (fieldType.indexOptions() == IndexOptions.NONE && (innerHits != null && !innerHits.isEmpty())) {
 throw new SearchContextException(context; "cannot expand `inner_hits` for collapse field `"
 + field + "`; " + "only indexed field can retrieve `inner_hits`");
 }  return new CollapseContext(field; fieldType; innerHits);
 }