# Elasticsearch Scroll Api

**URL:** <https://discuss.elastic.co/t/elasticsearch-scroll-api/318608>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [November 10, 2022, 4:38am UTC](https://discuss.elastic.co/t/elasticsearch-scroll-api/318608 "2022-11-10T04:38:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![GOPAL\_GOTE](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gopal_gote/32/113156_2.png) [@GOPAL\_GOTE](https://discuss.elastic.co/u/GOPAL_GOTE)\
**Post date:** [November 10, 2022, 4:38am UTC](https://discuss.elastic.co/t/elasticsearch-scroll-api/318608/1 "2022-11-10T04:38:04Z")

</div>

Hi, I'm trying to fetch 10,000 records on each iteration using the scroll API, but I'm not getting a response from it. I increased max\_result\_window to 500000 but am not getting any response from the API.

I wrote code as below.

```auto
        result = await elasticClient.search({
              index: collName,
              scroll: '1m',
              size: 10000,
              body: {
                _source: fieldList,
                query: {
                  "bool": {
                    "must" : query,
                    "filter": {
                      "range": {
                        "inputDate": {
                          "gte":fromDate,
                          "lte": toDate
                        }
                      }
                    }
                  }
                }
              }
            });

          while (fetchRecordsCount <= totalRecordsCount) { 
            const resultScroll = await elasticClient.scroll({ scroll: '1m', scroll_id: scrollId });
            fetchRecordsCount=fetchRecordsCount+resultScroll.hits.hits.length;
            scrollId=resultScroll._scroll_id;
          } 

```

---

<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:** [December 8, 2022, 4:38am UTC](https://discuss.elastic.co/t/elasticsearch-scroll-api/318608/2 "2022-12-08T04:38:22Z")

</div>

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