Elasticsearch Scroll Api

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.

        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;
          } 

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