# Deep Pagination vs Scroll API

**URL:** <https://discuss.elastic.co/t/deep-pagination-vs-scroll-api/29782>\
**Category:** Elasticsearch\
**Created:** [September 22, 2015, 12:32pm UTC](https://discuss.elastic.co/t/deep-pagination-vs-scroll-api/29782 "2015-09-22T12:32:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![siddharth\_gupta](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@siddharth\_gupta](https://discuss.elastic.co/u/siddharth_gupta)\
**Post date:** [September 22, 2015, 12:32pm UTC](https://discuss.elastic.co/t/deep-pagination-vs-scroll-api/29782/1 "2015-09-22T12:32:29Z")

</div>

Hello,

We are dealing with around 500k documents.  
Should I use Deep Pagination or Scroll API to display the search results to the user in production ?

Can someone please suggest something ?

Thanks  
Siddharth

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 22, 2015, 12:54pm UTC](https://discuss.elastic.co/t/deep-pagination-vs-scroll-api/29782/2 "2015-09-22T12:54:47Z")

</div>

Scroll is for administrative actions because it leaves a context behind on the server. Deep pagination is expensive because Elasticsearch must use `O(depth)` memory and `O(depth * ln(depth))` cpu to service the request.

500k isn't very many documents though. You could probably get away with deep pagination all the way down but you need to know what you are doing. I'd limit users to prevent pagination deeper than, say, 50k docs.

---

<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:48pm UTC](https://discuss.elastic.co/t/deep-pagination-vs-scroll-api/29782/3 "2017-07-05T23:48:48Z")

</div>


