File tree Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Expand file tree Collapse file tree 1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -520,18 +520,16 @@ async function searchESWithScroll (mustQuery) {
520520 console . log ( `totalHits: ${ totalHits } ` )
521521 // eslint-disable-next-line camelcase
522522 let scrollId = _scroll_id
523- let currentHits = hits . hits
524523
525- while ( currentHits . length < totalHits ) {
526- console . log ( `currentHits.length: ${ currentHits . length } ` )
524+ while ( hits . hits . length < totalHits ) {
525+ console . log ( `currentHits.length: ${ hits . hits . length } ` )
527526 const nextScrollResponse = await esClient . scroll ( {
528527 scroll : scrollTimeout ,
529528 scroll_id : scrollId
530529 } )
531530
532531 scrollId = nextScrollResponse . _scroll_id
533- currentHits = nextScrollResponse . hits . hits
534- hits . hits = [ ...hits . hits , ...currentHits ]
532+ hits . hits = [ ...hits . hits , ...nextScrollResponse . hits . hits ]
535533 }
536534
537535 await esClient . clearScroll ( {
You can’t perform that action at this time.
0 commit comments