We no longer recommend using the scroll API for deep pagination. If
you need to preserve the index state while paging through more than 10,000 hits,
use the search_after parameter with a point in time (PIT).
Retrieves the next batch of results for a scrolling search.
GET /_search/scroll
{
"scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
}
GET /_search/scroll/<scroll_id>
[7.0.0]
Deprecated in 7.0.0.
GET /_search/scroll
POST /_search/scroll/<scroll_id>
[7.0.0]
Deprecated in 7.0.0.
POST /_search/scroll
-
If the Elasticsearch security features are enabled, you must have the
readindex privilege for the target data stream, index, or alias.
You can use the scroll API to retrieve large sets of results from a single scrolling search request.
The scroll API requires a scroll ID. To get a scroll ID, submit a
search API request that includes an argument for the
scroll query parameter. The scroll
parameter indicates how long Elasticsearch should retain the
search context for the request.
The search response returns a scroll ID in the _scroll_id response body
parameter. You can then use the scroll ID with the scroll API to retrieve the
next batch of results for the request. If the Elasticsearch security features are enabled,
the access to the results of a specific scroll ID is restricted to
the user or API key that submitted the search.
You can also use the scroll API to specify a new scroll parameter that extends
or shortens the retention period for the search context.
Results from a scrolling search reflect the state of the index at the time of the initial search request. Subsequent indexing or document changes only affect later search and scroll requests.
-
<scroll_id> -
[7.0.0] Deprecated in 7.0.0. (Optional, string) Scroll ID of the search.
Scroll IDs can be long. We recommend only specifying scroll IDs using the
scroll_idrequest body parameter.
-
scroll -
(Optional, time value) Period to retain the search context for scrolling. See Scroll search results.
This value overrides the duration set by the original search API request’s
scrollparameter.By default, this value cannot exceed
1d(24 hours). You can change this limit using thesearch.max_keep_alivecluster-level setting.You can also specify this value using the
scrollrequest body parameter. If both parameters are specified, only the query parameter is used. -
scroll_id -
[7.0.0] Deprecated in 7.0.0. (Optional, string) Scroll ID for the search.
Scroll IDs can be long. We recommend only specifying scroll IDs using the
scroll_idrequest body parameter. -
rest_total_hits_as_int -
(Optional, Boolean)
If
true, the API response’shit.totalproperty is returned as an integer. Iffalse, the API response’shit.totalproperty is returned as an object. Defaults tofalse.
-
scroll -
(Optional, time value) Period to retain the search context for scrolling. See Scroll search results.
This value overrides the duration set by the original search API request’s
scrollparameter.By default, this value cannot exceed
1d(24 hours). You can change this limit using thesearch.max_keep_alivecluster-level setting.You can also specify this value using the
scrollquery parameter. If both parameters are specified, only the query parameter is used.
The scroll API returns the same response body as the search API. See the search API’s response body parameters.