原英文版地址: https://www.elastic.co/guide/en/elasticsearch/reference/7.7/scroll-api.html, 原文档版权归 www.elastic.co 所有
本地英文版地址: ../en/scroll-api.html

Scroll APIedit

Retrieves the next batch of results for a scrolling search.

GET /_search/scroll
{
    "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="
}

Requestedit

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

Descriptionedit

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.

You can also use the scroll API to specify a new scroll parameter that extends or shortens the retention period for the search context.

See Scroll.

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.

Path parametersedit

<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_id request body parameter.

Query parametersedit

scroll

(Optional, time value) Period to retain the search context for scrolling. See Scroll.

This value overrides the duration set by the original search API request’s scroll parameter.

By default, this value cannot must be less than 1d (one day). You can change this limit using the search.max_keep_alive cluster-level setting.

You can also specify this value using the scroll request 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_id request body parameter.

rest_total_hits_as_int
(Optional, boolean) If true, the API response’s hit.total property is returned as an integer. If false, the API response’s hit.total property is returned as an object. Defaults to false.

Request bodyedit

scroll

(Optional, time value) Period to retain the search context for scrolling. See Scroll.

This value overrides the duration set by the original search API request’s scroll parameter.

By default, this value cannot exceed 1d (24 hours). You can change this limit using the search.max_keep_alive cluster-level setting.

You can also specify this value using the scroll query parameter. If both parameters are specified, only the query parameter is used.

scroll_id
(Required, string) Scroll ID for the search.

Response bodyedit

The scroll API returns the same response body as the search API. See the search API’s response body parameters.