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

版本: 7.15-8.9

简而言之,当在 Elasticsearch 中使用了 ‘slice’ 参数但没有配合 ‘scroll’ 或 ‘point-in-time’ 请求时,就会发生此错误。‘slice’ 参数用于将搜索请求的结果拆分为多个切片或部分。然而,它只能与 ‘scroll’ 或 ‘point-in-time’ 请求一起使用。要解决此问题,你应该从请求中删除 ‘slice’ 参数,或者在搜索查询中包含 ‘scroll’ 或 ‘point-in-time’ 请求。

日志上下文 #

日志 “[slice] can only be used with [scroll] or [point-in-time] requests” 的类名是 SearchService.java. 我们从 Elasticsearch 源代码中提取了以下内容,供那些需要深入理解上下文的人参考:

context.searchAfter(fieldDoc);
 }  if (source.slice() != null) {
 if (source.pointInTimeBuilder() == null && context.scrollContext() == null) {
 throw new SearchException(shardTarget; "[slice] can only be used with [scroll] or [point-in-time] requests");
 }
 context.sliceBuilder(source.slice());
 }  if (source.storedFields() != null) {