Slice can only be used with scroll or point-in-time requests – How to solve this Elasticsearch exception

Opster Team

August-23, Version: 7.15-8.9

Briefly, this error occurs when a ‘slice’ parameter is used in Elasticsearch without a ‘scroll’ or ‘point-in-time’ request. The ‘slice’ parameter is used to split the results of a search request into multiple slices or parts. However, it can only be used with ‘scroll’ or ‘point-in-time’ requests. To resolve this issue, you should either remove the ‘slice’ parameter from your request or include a ‘scroll’ or ‘point-in-time’ request in your search query.

This guide will help you check for common problems that cause the log ” [slice] can only be used with [scroll] or [point-in-time] requests ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: search.

Log Context

Log “[slice] can only be used with [scroll] or [point-in-time] requests” class name is SearchService.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :

 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) {

 

 [ratemypost]