# Scroll and/or "from-size" for pagination - best practices

**URL:** <https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306>\
**Category:** Elasticsearch\
**Created:** [September 2, 2011, 9:30pm UTC](https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306 "2011-09-02T21:30:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [September 2, 2011, 9:30pm UTC](https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306/1 "2011-09-02T21:30:46Z")

</div>

Hi

I'm a bit confused here about the use of scroll and "From-size", I  
was wondering if someone can give some light about them.

So far I've been using the scroll to get the next "page" of results  
for the user, now I'm in need of having the user select which page go  
to. From the docs "setFrom" is a method of SearchBuilder but couldn't  
find it as a method of SearchScrollRequestBuilder.

It is my understanding that scroll will keep the relevant resources  
related to the search to continue, so, isn't setting a starting point  
"from" something that should be part of scroll? instead of calling a  
completely new search? isn't this cheaper that do the search setting  
the "from" param?

What are the best practices here related to pagination and how to deal  
when user click on "show me page 6" instead of "next" page?

Cheers

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 2, 2011, 11:05pm UTC](https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306/2 "2011-09-02T23:05:59Z")

</div>

Hi,

the way to go is to use "from" value in search request (do not use scroll  
for user pagination). As the doc for scroll points out  
[Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/scroll.html) it  
should not be used for user requests.

Regards,  
Lukas

On Fri, Sep 2, 2011 at 11:30 PM, maverick [mauricio.alarcon@gmail.com](mailto:mauricio.alarcon@gmail.com)wrote:

> Hi
> 
> I'm a bit confused here about the use of scroll and "From-size", I  
> was wondering if someone can give some light about them.
> 
> So far I've been using the scroll to get the next "page" of results  
> for the user, now I'm in need of having the user select which page go  
> to. From the docs "setFrom" is a method of SearchBuilder but couldn't  
> find it as a method of SearchScrollRequestBuilder.
> 
> It is my understanding that scroll will keep the relevant resources  
> related to the search to continue, so, isn't setting a starting point  
> "from" something that should be part of scroll? instead of calling a  
> completely new search? isn't this cheaper that do the search setting  
> the "from" param?
> 
> What are the best practices here related to pagination and how to deal  
> when user click on "show me page 6" instead of "next" page?
> 
> Cheers

---

<div class="post-metadata">

**Author:** ![Mauricio\_Alarcon](https://avatars.discourse-cdn.com/v4/letter/m/cab0a1/32.png) [@Mauricio\_Alarcon](https://discuss.elastic.co/u/Mauricio_Alarcon)\
**Post date:** [September 6, 2011, 6:59pm UTC](https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306/3 "2011-09-06T18:59:57Z")

</div>

Thanks Lukas, really appreciated the info

Regards

On Sep 2, 7:05 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> Hi,
> 
> the way to go is to use "from" value in search request (do not use scroll  
> for user pagination). As the doc for scroll points outhttp://www.elasticsearch.org/guide/reference/api/search/scroll.htmlit  
> should not be used for user requests.
> 
> Regards,  
> Lukas
> 
> On Fri, Sep 2, 2011 at 11:30 PM, maverick [mauricio.alar...@gmail.com](mailto:mauricio.alar...@gmail.com)wrote:
> 
> > Hi
> 
> > I'm a bit confused here about the use of scroll and "From-size", I  
> > was wondering if someone can give some light about them.
> 
> > So far I've been using the scroll to get the next "page" of results  
> > for the user, now I'm in need of having the user select which page go  
> > to. From the docs "setFrom" is a method of SearchBuilder but couldn't  
> > find it as a method of SearchScrollRequestBuilder.
> 
> > It is my understanding that scroll will keep the relevant resources  
> > related to the search to continue, so, isn't setting a starting point  
> > "from" something that should be part of scroll? instead of calling a  
> > completely new search? isn't this cheaper that do the search setting  
> > the "from" param?
> 
> > What are the best practices here related to pagination and how to deal  
> > when user click on "show me page 6" instead of "next" page?
> 
> > Cheers

---

<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:55am UTC](https://discuss.elastic.co/t/scroll-and-or-from-size-for-pagination-best-practices/5306/4 "2017-07-06T03:55:07Z")

</div>


