Helper param fix (#1284)

Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
This commit is contained in:
Renato
2020-09-01 07:15:11 -03:00
committed by delvedor
parent 6d26647cdc
commit 00aeb8b923
2 changed files with 92 additions and 7 deletions

View File

@ -84,7 +84,7 @@ class Helpers {
const { method, body, index, ...querystring } = params
let response = null
for (let i = 0; i < maxRetries; i++) {
for (let i = 0; i <= maxRetries; i++) {
response = await this[kClient].search(params, options)
if (response.statusCode !== 429) break
await sleep(wait)
@ -114,9 +114,10 @@ class Helpers {
break
}
for (let i = 0; i < maxRetries; i++) {
for (let i = 0; i <= maxRetries; i++) {
response = await this[kClient].scroll({
...querystring,
scroll: querystring.scroll,
rest_total_hits_as_int: querystring.rest_total_hits_as_int || querystring.restTotalHitsAsInt,
body: { scroll_id }
}, options)
if (response.statusCode !== 429) break