# Scroll Search Bug?

**URL:** <https://discuss.elastic.co/t/scroll-search-bug/8906>\
**Category:** Elasticsearch\
**Created:** [August 31, 2012, 5:26pm UTC](https://discuss.elastic.co/t/scroll-search-bug/8906 "2012-08-31T17:26:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mary\_Hamlin](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Mary\_Hamlin](https://discuss.elastic.co/u/Mary_Hamlin)\
**Post date:** [August 31, 2012, 5:26pm UTC](https://discuss.elastic.co/t/scroll-search-bug/8906/1 "2012-08-31T17:26:50Z")

</div>

Hi. I'm very new to elasticsearch and have been playing around with the  
scroll/scan search functionality attempting to get it to scroll through all  
of the documents in my test index so that I can perform some processing on  
them. I did the following:

//i did this the first time to initiate the search  
[http://myserver:9200/mary/\_search?search\_type=scan&scroll=1m&size=100](http://myserver:9200/mary/_search?search_type=scan&scroll=1m&size=100)

//then i used the scroll\_id returned above to get the first set of data  
[http://myserver:9200/mary/\_search?scroll=1m&size=100&scroll\_id=c2Nhbjs1OzgwMzpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMDpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzc5OTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMjpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzE7dG90YWxfaGl0czozOTcxOw==](http://myserver:9200/mary/_search?scroll=1m&size=100&scroll_id=c2Nhbjs1OzgwMzpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMDpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzc5OTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMjpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzE7dG90YWxfaGl0czozOTcxOw==)

//then i used the next scroll\_id returned in the previous request to get  
the next set of data  
[http://myserver:9200/mary/\_search?scroll=1m&size=100&scroll\_id=cXVlcnlUaGVuRmV0Y2g7NTs4MDg6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDY6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDU6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDQ6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDc6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTswOw==](http://myserver:9200/mary/_search?scroll=1m&size=100&scroll_id=cXVlcnlUaGVuRmV0Y2g7NTs4MDg6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDY6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDU6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDQ6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDc6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTswOw==)

Am I doing something wrong here? Note that I am getting different scroll  
\_id values returned for each request. However, the results that come back  
are always the same, i.e. the scroll does not seem to be advancing, and it  
would basically loop forever, since it's always returning the same 100  
results over and over. Note that the index that I am attempting to return  
results for has more than 100 records (it's something like 3000 atm), and I  
have also played around with increasing the scroll time. Any help on this  
would be greatly appreciated.

--

---

<div class="post-metadata">

**Author:** ![Radu\_Gheorghe1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/radu_gheorghe1/32/2688_2.png) [@Radu\_Gheorghe1](https://discuss.elastic.co/u/Radu_Gheorghe1)\
**Post date:** [September 3, 2012, 6:05am UTC](https://discuss.elastic.co/t/scroll-search-bug/8906/2 "2012-09-03T06:05:25Z")

</div>

Hi Mary,

Here's how I do scrolling and it works (might not be the only way, though):

1. get the scroll ID:  
curl -XGET  
localhost:9200/my\_index/my\_type/\_search?search\_type=scan&scroll=1m&size=100
2. get the first 100 elements:  
curl -XGET localhost:9200/\_search/scroll?scroll=1m&scroll\_id=  
SCROLL\_ID\_FROM\_STEP1\_GOES\_HERE  
3,4,5, etc. get the next 100 elements:  
curl -XGET localhost:9200/\_search/scroll?scroll=1m&scroll\_id=  
SCROLL\_ID\_FROM\_STEP1\_GOES\_HERE

So you always give the scroll ID that you get at the first step.

When you get no more hits while repeating the last step you should be done.

On Friday, August 31, 2012 8:26:50 PM UTC+3, Mary Hamlin wrote:

> Hi. I'm very new to elasticsearch and have been playing around with the  
> scroll/scan search functionality attempting to get it to scroll through all  
> of the documents in my test index so that I can perform some processing on  
> them. I did the following:
> 
> //i did this the first time to initiate the search  
> [http://myserver:9200/mary/\_search?search\_type=scan&scroll=1m&size=100](http://myserver:9200/mary/_search?search_type=scan&scroll=1m&size=100)
> 
> //then i used the scroll\_id returned above to get the first set of data
> 
> [http://myserver:9200/mary/\_search?scroll=1m&size=100&scroll\_id=c2Nhbjs1OzgwMzpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMDpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzc5OTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMjpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzE7dG90YWxfaGl0czozOTcxOw==](http://myserver:9200/mary/_search?scroll=1m&size=100&scroll_id=c2Nhbjs1OzgwMzpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMDpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzc5OTpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzgwMjpnZEZCcW1pQ1EzLTdhTFYwNDFOZHdROzE7dG90YWxfaGl0czozOTcxOw==)
> 
> //then i used the next scroll\_id returned in the previous request to get  
> the next set of data
> 
> [http://myserver:9200/mary/\_search?scroll=1m&size=100&scroll\_id=cXVlcnlUaGVuRmV0Y2g7NTs4MDg6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDY6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDU6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDQ6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDc6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTswOw==](http://myserver:9200/mary/_search?scroll=1m&size=100&scroll_id=cXVlcnlUaGVuRmV0Y2g7NTs4MDg6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDY6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDU6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDQ6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTs4MDc6Z2RGQnFtaUNRMy03YUxWMDQxTmR3UTswOw==)
> 
> Am I doing something wrong here? Note that I am getting different scroll  
> \_id values returned for each request. However, the results that come back  
> are always the same, i.e. the scroll does not seem to be advancing, and it  
> would basically loop forever, since it's always returning the same 100  
> results over and over. Note that the index that I am attempting to return  
> results for has more than 100 records (it's something like 3000 atm), and I  
> have also played around with increasing the scroll time. Any help on this  
> would be greatly appreciated.

--

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [September 3, 2012, 10:34am UTC](https://discuss.elastic.co/t/scroll-search-bug/8906/3 "2012-09-03T10:34:29Z")

</div>

Hi Mary

The important thing to note from Radu's reply is that the first request  
is against /\_search and all subsequent requests against /\_search/scroll

clint

--

---

<div class="post-metadata">

**Author:** ![Mary\_Hamlin](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Mary\_Hamlin](https://discuss.elastic.co/u/Mary_Hamlin)\
**Post date:** [September 4, 2012, 9:37pm UTC](https://discuss.elastic.co/t/scroll-search-bug/8906/4 "2012-09-04T21:37:32Z")

</div>

Thanks Radu/Clinton. I finally got it working. I think the issue for me was that I was still using the index/type name in the url after the initial scan, which was resulting in a 404 error message and a return message of "{"\_index":"mary","\_type":"\_search","\_id":"scroll","exists":false}", even though I used the correct api syntax of /\_search followed by subsequent /\_search/scroll commands, which confused me and made me think that I had the api syntax wrong. So I guess other than using /\_search followed by /\_search/scroll, one also needs to make sure to remove any index/type names from the subsequent search urls. Thanks so much for the help!

---

<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:** [July 6, 2017, 3:14am UTC](https://discuss.elastic.co/t/scroll-search-bug/8906/5 "2017-07-06T03:14:09Z")

</div>


