Run a scrolling search Beta
IMPORTANT: The scroll API is no longer recommend 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).
The scroll API gets large sets of results from a single scrolling search request.
To get the necessary 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.
IMPORTANT: 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 parameters
-
The scroll ID
Query parameters
-
scroll string
Period to retain the search context for scrolling.
-
The scroll ID for scrolled search
-
rest_total_hits_as_int 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.
Responses
-
200 application/json
Hide response attributes Show response attributes object
-
Additional properties are allowed.
Hide _shards attributes Show _shards attributes object
-
failures array[object]
Hide failures attributes Show failures attributes object
-
index string
-
node string
-
Additional properties are allowed.
Hide reason attributes Show reason attributes object
-
The type of error
-
reason string
A human-readable explanation of the error, in english
-
stack_trace string
The server stack trace. Present only if the
error_trace=true
parameter was sent with the request. -
caused_by object
Additional properties are allowed.
-
root_cause array[object]
Additional properties are allowed.
-
suppressed array[object]
Additional properties are allowed.
-
-
status string
-
-
skipped number
-
Additional properties are allowed.
Hide hits attributes Show hits attributes object
-
Hide hits attributes Show hits attributes object
-
_id string
_score number | string | null
-
_explanation object
Additional properties are allowed.
Hide _explanation attributes Show _explanation attributes object
-
Additional properties are allowed.
-
fields object
Hide fields attribute Show fields attribute object
-
Additional properties are allowed.
-
-
highlight object
Hide highlight attribute Show highlight attribute object
-
inner_hits object
matched_queries array[string] | object
One of: Hide attribute Show attribute
-
_nested object
Additional properties are allowed.
-
_ignored array[string]
-
ignored_field_values object
Hide ignored_field_values attribute Show ignored_field_values attribute object
-
_shard string
-
_node string
-
_routing string
-
_source object
Additional properties are allowed.
-
_rank number
-
_seq_no number
-
_primary_term number
-
_version number
-
sort array[number | string | boolean | null | object]
A field value.
One of: Additional properties are allowed.
max_score number | string | null
-
aggregations object
-
_clusters object
Additional properties are allowed.
Hide _clusters attributes Show _clusters attributes object
-
details object
Hide details attribute Show details attribute object
-
Additional properties are allowed.
-
-
fields object
Hide fields attribute Show fields attribute object
-
Additional properties are allowed.
-
-
max_score number
-
num_reduce_phases number
-
profile object
Additional properties are allowed.
Hide profile attribute Show profile attribute object
-
Hide shards attributes Show shards attributes object
-
Hide aggregations attributes Show aggregations attributes object
-
dfs object
Additional properties are allowed.
Hide dfs attributes Show dfs attributes object
-
statistics object
Additional properties are allowed.
Hide statistics attributes Show statistics attributes object
-
knn array[object]
Additional properties are allowed.
-
-
fetch object
Additional properties are allowed.
Hide fetch attributes Show fetch attributes object
-
time_in_nanos number
Time unit for nanoseconds
-
Additional properties are allowed.
Hide breakdown attributes Show breakdown attributes object
-
load_source number
-
load_source_count number
-
load_stored_fields number
-
load_stored_fields_count number
-
next_reader number
-
next_reader_count number
-
process_count number
-
process number
-
-
debug object
Additional properties are allowed.
Hide debug attributes Show debug attributes object
-
stored_fields array[string]
-
fast_path number
-
-
children array[object]
Additional properties are allowed.
-
Hide searches attributes Show searches attributes object
-
-
-
pit_id string
-
_scroll_id string
-
suggest object
Hide suggest attribute Show suggest attribute object
-
terminated_early boolean
curl \
-X GET http://api.example.com/_search/scroll/{scroll_id} \
-H "Content-Type: application/json" \
-d '{"scroll":"string","scroll_id":"string"}'