# Getting documents from an index with more than 10,000 records

**URL:** <https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069>\
**Category:** Elasticsearch\
**Created:** [February 12, 2021, 12:37am UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069 "2021-02-12T00:37:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vastevenson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vastevenson/32/75462_2.png) [@vastevenson](https://discuss.elastic.co/u/vastevenson)\
**Post date:** [February 12, 2021, 12:37am UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/1 "2021-02-12T00:37:55Z")

</div>

I am trying to get a list of the ids of all document in my index. The index has about 50k documents in it, however I cannot use the from parameter to see any ids once "from" + "size" \> 10,000. I know there's the scroll api, but when I tried to use it, I get the error message: from is not allowed in scroll context. How can I modify my query to get the id of records past record 10,000 in my index? Thanks!

```auto
    GET vs-imr-cases/_search?scroll=1m
    {
      "query": {
        "match_all": {}
      },
      "sort": [
        {
          "case_number.keyword": {
            "order": "desc"
          }
        }
      ], 
      "_source": "_id",
      "size": 10,
      "from": 10000
    }

```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 12, 2021, 2:31am UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/2 "2021-02-12T02:31:07Z")

</div>

You can use:

- the [`size` and `from` parameters](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html) to display by default up to 10000 records to your users. If you want to change this limit, you can change `index.max_result_window` setting but be aware of the consequences (ie memory).
- the [search after](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-search-after.html) feature to do deep pagination.
- the [Scroll API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html) if you want to extract a resultset to be consumed by another tool later.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 12, 2021, 2:32am UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/3 "2021-02-12T02:32:16Z")

</div>

Indeed : remove the from/size parameters when you call the scroll API.

---

<div class="post-metadata">

**Author:** ![vastevenson](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vastevenson/32/75462_2.png) [@vastevenson](https://discuss.elastic.co/u/vastevenson)\
**Post date:** [February 12, 2021, 7:45pm UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/4 "2021-02-12T19:45:40Z")

</div>

Thanks for the follow up. How do you change index.max\_result\_window setting? Is that something you can do after an index is created and populated?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [February 12, 2021, 8:59pm UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/5 "2021-02-12T20:59:39Z")

</div>

I think you can. But please understand that it's a good default safeguard.

May be you could explain what you are exactly trying to achieve.

---

<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:** [March 12, 2021, 9:00pm UTC](https://discuss.elastic.co/t/getting-documents-from-an-index-with-more-than-10-000-records/264069/6 "2021-03-12T21:00:26Z")

</div>

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