# How to get all results with search API

**URL:** <https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127>\
**Category:** Elasticsearch\
**Created:** [June 14, 2022, 9:50am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127 "2022-06-14T09:50:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 14, 2022, 9:50am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/1 "2022-06-14T09:50:07Z")

</div>

I am trying to use the REST API to get the contents of the index.

> **[Search API | Elasticsearch Guide \[8.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html)**

I found that this API only retrieves up to 10 results by default.

I also found that by using the `size` option, I can retrieve the specified number of results.

However, I want to retrieve all the results I specify.  
Is it possible to retrieve all results without specifying the `size`?

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [June 14, 2022, 7:45pm UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/2 "2022-06-14T19:45:57Z")

</div>

Out of curiosity, why do you want all the results at once and not use size or any other pagination strategy?

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 15, 2022, 1:13am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/3 "2022-06-15T01:13:29Z")

</div>

@RabBit_BR Thanks for commenting.  
Ah. I knew there was such a function.  
Where is it described? Please tell me how to use it.

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 15, 2022, 1:23am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/4 "2022-06-15T01:23:37Z")

</div>

Oh. I'm guessing you mean this one?

> **[Scroll API | Elasticsearch Guide \[8.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/scroll-api.html)**

If so, maybe you can refer to this area for how to use it.

> **[How Do You Scroll in Elasticsearch?](https://linuxhint.com/scroll-elasticsearch/)**
>
> In Elasticsearch, a search query can be as simple as a single document or large and complex results consisting of millions of records. Scrolling thru' documents using the scroll API is not recommended for real-time requests. It is mainly helpful for...

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [June 15, 2022, 1:36am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/5 "2022-06-15T01:36:33Z")

</div>

This [post](https://opster.com/guides/elasticsearch/how-tos/elasticsearch-pagination-techniques/) explain about techniques pagination.

---

<div class="post-metadata">

**Author:** ![its-ogawa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/its-ogawa/32/120829_2.png) [@its-ogawa](https://discuss.elastic.co/u/its-ogawa)\
**Post date:** [June 15, 2022, 2:35am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/6 "2022-06-15T02:35:25Z")

</div>

@RabBit_BR Wow. Thank you. I will read this article.

---

<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 13, 2022, 2:35am UTC](https://discuss.elastic.co/t/how-to-get-all-results-with-search-api/307127/7 "2022-07-13T02:35:58Z")

</div>

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