# There is a way to use search\_after to restart an scroll?

**URL:** https://discuss.elastic.co/t/there-is-a-way-to-use-search-after-to-restart-an-scroll/324128
**Category:** Elasticsearch
**Created:** [January 27, 2023, 5:13pm UTC](https://discuss.elastic.co/t/there-is-a-way-to-use-search-after-to-restart-an-scroll/324128 "2023-01-27T17:13:45Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Guillermo\_Garcia1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/guillermo_garcia1/32/100924_2.png) [@Guillermo\_Garcia1](https://discuss.elastic.co/u/Guillermo_Garcia1)
#### Post date: [January 27, 2023, 5:13pm UTC](https://discuss.elastic.co/t/there-is-a-way-to-use-search-after-to-restart-an-scroll/324128/1 "2023-01-27T17:13:45Z")

</div>

It is possible to start an scroll with search\_after ? The idea is to :

- Create an scroll with a good "sort"
- Iterate thanks to the scroll\_id and process each batch of docs
- If when asking for the next batch, a "search\_context\_missing\_exception" arise we create a new scroll with search after, making the scroll start just there where we need it.

This "fallback" will be handy when processing some batches takes more time than expected.

Any thoughts ? Facts ?

Thx !

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [February 24, 2023, 5:14pm UTC](https://discuss.elastic.co/t/there-is-a-way-to-use-search-after-to-restart-an-scroll/324128/2 "2023-02-24T17:14:17Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
