版本: 6.8-7.14
简而言之,当在搜索查询中的非滚动上下文环境下使用slice参数时,就会出现此错误。slice参数用于将滚动拆分为多个部分,但它不适用于常规的搜索查询。要解决此问题,如果slice参数不是必需的,可以从搜索查询中将其删除;或者如果需要使用slice,应该在滚动上下文中使用它。这包括初始化一个滚动,然后在后续的滚动请求中使用slice参数。
日志上下文 #
日志"slice cannot be used outside of a scroll context"的类名是
SearchService.java。我们从Elasticsearch源代码中提取了以下内容,供那些寻求深入了解的人参考:
context.searchAfter(fieldDoc);
} if (source.slice() != null) {
if (context.scrollContext() == null) {
throw new SearchException(shardTarget; "`slice` cannot be used outside of a scroll context");
}
context.sliceBuilder(source.slice());
} if (source.storedFields() != null) {





