# Is there a way to find out if response returned from Scroll request is last page?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-find-out-if-response-returned-from-scroll-request-is-last-page/43539>\
**Category:** Elasticsearch\
**Created:** [March 4, 2016, 5:12pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-find-out-if-response-returned-from-scroll-request-is-last-page/43539 "2016-03-04T17:12:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ayushsangani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayushsangani/32/9612_2.png) [@ayushsangani](https://discuss.elastic.co/u/ayushsangani)\
**Post date:** [March 4, 2016, 5:12pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-find-out-if-response-returned-from-scroll-request-is-last-page/43539/1 "2016-03-04T17:12:45Z")

</div>

Hey all,

I'm using Scroll request extensively in my application. Do we have any way to find out if response from Scroll request is going to be the last page?

For example: Suppose my first request with scrolling enabled has `limit=100` and number of results matching this query is 250.

First execution with search endpoint: It will return 100 results.  
Second execution with scroll endpoint: It will again return 100 results.  
Third execution with scroll endpoint: It will return 50 results.

Then I have to make one EXTRA request to check if there are anymore results with "XYZ" scroll\_id.  
As there is no way to find out `limit` set on first request from Scroll API.

I want to avoid making an extra request to ES.

Any insight on this issue would be helpful.

Thanks,  
Ayush

---

<div class="post-metadata">

**Author:** ![ayushsangani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ayushsangani/32/9612_2.png) [@ayushsangani](https://discuss.elastic.co/u/ayushsangani)\
**Post date:** [March 5, 2016, 5:06pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-find-out-if-response-returned-from-scroll-request-is-last-page/43539/2 "2016-03-05T17:06:21Z")

</div>

@Mark_Harwood Any input would be really helpful!

---

<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 5, 2017, 11:10pm UTC](https://discuss.elastic.co/t/is-there-a-way-to-find-out-if-response-returned-from-scroll-request-is-last-page/43539/3 "2017-07-05T23:10:59Z")

</div>


