Scroll search should clear the scroll at the end (#1331)
This commit is contained in:
committed by
GitHub
parent
5682e680d1
commit
ea009da3b6
@ -104,13 +104,15 @@ class Helpers {
|
||||
}
|
||||
|
||||
while (response.body.hits && response.body.hits.hits.length > 0) {
|
||||
// scroll id is always present in the response, but it might
|
||||
// change over time based on the number of shards
|
||||
scroll_id = response.body._scroll_id
|
||||
response.clear = clear
|
||||
addDocumentsGetter(response)
|
||||
|
||||
yield response
|
||||
|
||||
if (!scroll_id || stop === true) {
|
||||
if (stop === true) {
|
||||
break
|
||||
}
|
||||
|
||||
@ -127,6 +129,10 @@ class Helpers {
|
||||
throw new ResponseError(response)
|
||||
}
|
||||
}
|
||||
|
||||
if (stop === false) {
|
||||
await clear()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user