# Scrolling or slicing?

**URL:** <https://discuss.elastic.co/t/scrolling-or-slicing/80274>\
**Category:** Elasticsearch\
**Created:** [March 28, 2017, 10:19am UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274 "2017-03-28T10:19:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shira\_Bendor](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Shira\_Bendor](https://discuss.elastic.co/u/Shira_Bendor)\
**Post date:** [March 28, 2017, 10:19am UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/1 "2017-03-28T10:19:59Z")

</div>

Hi,  
I'm using queries that can return many documents.  
In my UI I would like to split it into "pages" so each page contains a manageable amount of documents.

I read the documentation of scrolling, but if I understand correctly, it will not be sufficient as only the newest scrollId can be used. So if my user wants to view an earlier page it will not be valid. In addition, even if it was valid, I would need to cache all scrollIds in my application.

I also saw the slice option - which sounds more like what I'm trying to achieve - so is this my solution? Should I use a big scroll to hold all the query results and then slice it? I understand there might also be a performance impact with slicing.

Thanks

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [March 28, 2017, 11:33am UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/2 "2017-03-28T11:33:06Z")

</div>

Hi,

The most important question is:

> [@Shira\_Bendor](#):
>
> I'm using queries that can return many documents.

How many ? 🙂

From that point, it'll be easier to answer

bye,  
Xavier

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [March 28, 2017, 11:38am UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/3 "2017-03-28T11:38:06Z")

</div>

And remember :

[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html#search-request-search-after](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-search-after.html#search-request-search-after)

You can scroll to the default limit of 10,000. And you can increase this value here :  
[https://www.elastic.co/guide/en/elasticsearch/reference/5.2/index-modules.html#dynamic-index-settings](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/index-modules.html#dynamic-index-settings)

```
index.max_result_window

```

Would your users scroll to 10,000 documents without any other criteria ?

bye,  
Xavier

---

<div class="post-metadata">

**Author:** ![Shira\_Bendor](https://avatars.discourse-cdn.com/v4/letter/s/b5ac83/32.png) [@Shira\_Bendor](https://discuss.elastic.co/u/Shira_Bendor)\
**Post date:** [March 29, 2017, 6:57am UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/4 "2017-03-29T06:57:02Z")

</div>

Thanks Xavier.  
After some further thought, the UI will not need to show that many documents, so I need the paging just to make sure that I have some limit and I'm not exhausting the memory. In this case what is the better option, scrolling or search\_after?

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [March 30, 2017, 1:49pm UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/5 "2017-03-30T13:49:08Z")

</div>

Hi, you don't need to scroll in this case. Just use the from/size parameters.

bye,  
Xavier

---

<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:** [April 27, 2017, 1:49pm UTC](https://discuss.elastic.co/t/scrolling-or-slicing/80274/6 "2017-04-27T13:49:09Z")

</div>

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