# How to retrieve all documents

**URL:** <https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991>\
**Category:** Elastic Search\
**Created:** [June 13, 2022, 6:53am UTC](https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991 "2022-06-13T06:53:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [June 13, 2022, 6:53am UTC](https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991/1 "2022-06-13T06:53:44Z")

</div>

Hi everyone,  
Currently, I want to retrieve all the documents from one engine but I could not find any solution for that, for the search and document list APIs, they just support getting a maximum of 10000 documents.

- [Documents API | Elastic App Search Documentation [8.2] | Elastic](https://www.elastic.co/guide/en/app-search/current/documents.html#documents-list)
- [Search guide | Elastic App Search Documentation [8.2] | Elastic](https://www.elastic.co/guide/en/app-search/current/search-guide.html#search-guide-paginate)  
So I wonder if there's any way to overcome this issue.

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![adrianfusco](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/adrianfusco/32/111798_2.png) [@adrianfusco](https://discuss.elastic.co/u/adrianfusco)\
**Post date:** [June 13, 2022, 8:15am UTC](https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991/2 "2022-06-13T08:15:53Z")

</div>

How are you trying to get all the documents? I've used `scan` for this in one [project](https://github.com/rhos-infra/cibyl/blob/475bc7096e7643b420ea644ab39c14442c3a809d/cibyl/sources/elasticsearch/api.py#L144-L149) I'm contributing and it works really good.

You should take in mind that it doesn't work for aggregations (if you need to use it). You can take a look into the documentation of [Scan](https://elasticsearch-py.readthedocs.io/en/7.x/helpers.html#scan)

---

<div class="post-metadata">

**Author:** ![ntruongsinh](https://avatars.discourse-cdn.com/v4/letter/n/8c91f0/32.png) [@ntruongsinh](https://discuss.elastic.co/u/ntruongsinh)\
**Post date:** [June 13, 2022, 9:35am UTC](https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991/3 "2022-06-13T09:35:09Z")

</div>

Hi @adrianfusco,  
Thank you for the suggestion. Yeah, I also want to connect to ES directly and use the search after feature to overcome this issue.

---

<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 11, 2022, 9:36am UTC](https://discuss.elastic.co/t/how-to-retrieve-all-documents/306991/4 "2022-07-11T09:36:06Z")

</div>

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