# How to retrieve the last page of my documents even if it is more than 10,000th document?

**URL:** https://discuss.elastic.co/t/how-to-retrieve-the-last-page-of-my-documents-even-if-it-is-more-than-10-000th-document/244331
**Category:** Elasticsearch
**Created:** [August 10, 2020, 3:47am UTC](https://discuss.elastic.co/t/how-to-retrieve-the-last-page-of-my-documents-even-if-it-is-more-than-10-000th-document/244331 "2020-08-10T03:47:27Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Noctis17](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/noctis17/32/41656_2.png) [@Noctis17](https://discuss.elastic.co/u/Noctis17)
#### Post date: [August 10, 2020, 3:47am UTC](https://discuss.elastic.co/t/how-to-retrieve-the-last-page-of-my-documents-even-if-it-is-more-than-10-000th-document/244331/1 "2020-08-10T03:47:28Z")

</div>

Hello and good day! As the title says, we're expecting that we're able to get the last page of our search. But unfortunately, we're encountering an error message:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/4/8472819ef21b4c92ee991178e353b5915bf5ed9a.png)

Things beforehand:

We're aware the with the relationship of the "page" and "page\_size" parameter of the search query. Typically, we're just showing 30 documents per page, but it just so happened that one **Use Case** that we have is, someone was able to click on the last page, here's the parameters

```auto
    page_size: 30,
    page: 334

```

at **page: 333** , we know that we're displaying documents at the **9,990th** document so the query isn't showing any errors yet, but at **page: 334** and above, it's now on **10,020th** and the error message above is now appearing. After reading some ElasticSearch documentations, ES is really limiting to display only up to 10 thousand documents...

Is there a technique to easily perform this the desired or target output without the use of scroll? As for the "search\_after", it's not recommended because for the **search\_after** we're supposed to do a query on a **series** behavior, but our web app that uses ElasticSearch, should be able to select which page they like any time...

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/a/fa5284cbff759228ca577efcfaf672b12305869a.png)

thank you very much in advance! 🙂

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [August 10, 2020, 4:38am UTC](https://discuss.elastic.co/t/how-to-retrieve-the-last-page-of-my-documents-even-if-it-is-more-than-10-000th-document/244331/2 "2020-08-10T04:38:57Z")

</div>

The main issue here is what happens when you have 12000 documents, or that increases to 13000, 14000, 18000, 90000. Do you keep increasing the limit to factor that in for the edge case you run into?

Otherwise;

> [@Noctis17](#):
>
> Is there a technique to easily perform this the desired or target output without the use of scroll?

Nope, sorry.

I would suggest that you may want to reconsider the use case that needs the last document, and then adapt your approach to use scroll.

---

<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: [September 7, 2020, 4:39am UTC](https://discuss.elastic.co/t/how-to-retrieve-the-last-page-of-my-documents-even-if-it-is-more-than-10-000th-document/244331/3 "2020-09-07T04:39:02Z")

</div>

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