# Clearing a scroll during scan and scroll?

**URL:** https://discuss.elastic.co/t/clearing-a-scroll-during-scan-and-scroll/42080
**Category:** Elasticsearch
**Created:** [February 17, 2016, 10:44pm UTC](https://discuss.elastic.co/t/clearing-a-scroll-during-scan-and-scroll/42080 "2016-02-17T22:44:12Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![msimos](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@msimos](https://discuss.elastic.co/u/msimos)
#### Post date: [February 17, 2016, 11:31pm UTC](https://discuss.elastic.co/t/clearing-a-scroll-during-scan-and-scroll/42080/2 "2016-02-17T23:31:23Z")

</div>

Hi,

You've probably seen this URL, however you may want to take a look at it again:

[https://www.elastic.co/guide/en/elasticsearch/guide/1.x/scan-scroll.html](https://www.elastic.co/guide/en/elasticsearch/guide/1.x/scan-scroll.html)

Initially when you create the scroll you specify a time with `scroll=1m` for example. Subsequent request using the scroll id also needs to have the same `scroll=1m` specified. This keeps the scroll open for an additional minute. As per the docs:

"Note that we again specify ?scroll=1m. The scroll expiry time is refreshed every time we run a scroll request, so it needs to give us only enough time to process the current batch of results, not all of the documents that match the query."

Lastly, for each subsequent scroll request you need to provide the new scroll id returned by the previous scroll request:

"The scroll request also returns a new \_scroll\_id. Every time we make the next scroll request, we must pass the \_scroll\_id returned by the previous scroll request."

So I would take a look if you're using this behavior for retrieving the results. You can use logstash to re-index your data. Take a look at this blog:

[http://david.pilato.fr/blog/2015/05/20/reindex-elasticsearch-with-logstash/](http://david.pilato.fr/blog/2015/05/20/reindex-elasticsearch-with-logstash/)

---

_[View the full topic](https://discuss.elastic.co/t/clearing-a-scroll-during-scan-and-scroll/42080)._
