       try
         try nim = RetryHttp.call 'PUT', tourl + '/' + toindex, {retry:API.es._retries} # will fail if index still exists, but that is OK
         nitm = RetryHttp.call 'PUT', tourl + '/' + toindex + '/_mapping/' + totype, {data: mapping, retry:API.es._retries}
-        ret = RetryHttp.call 'POST', tourl + '/' + intermediate + toindex + '/' + totype + '/_search?search_type=scan&scroll=1m', {data:{query: { match_all: {} }, size: 10000 }, retry:API.es._retries}
+        ret = RetryHttp.call 'POST', tourl + '/' + intermediate + toindex + '/' + totype + '/_search?search_type=scan&scroll=' + scroll, {data:{query: { match_all: {} }, size: sz }, retry:API.es._retries}
         if ret.data?._scroll_id?
-          res = RetryHttp.call 'GET', tourl + '/_search/scroll?scroll=1m&scroll_id=' + ret.data._scroll_id, {retry:API.es._retries}
+          res = RetryHttp.call 'GET', tourl + '/_search/scroll?scroll=' + scroll + '&scroll_id=' + ret.data._scroll_id, {retry:API.es._retries}
           while (res?.data?.hits?.hits? and res.data.hits.hits.length)
             pkg = ''
             for row in res.data.hits.hits

  totype = if rename? then (if rename.indexOf('/') isnt -1 then rename.split('/')[1] else rename) else type
  intermediate = if not rename? and fromurl is tourl then 'temp_reindex_' else ''
  processed = 0
  try
    try pim = RetryHttp.call 'PUT', tourl + '/' + intermediate + toindex, {retry:API.es._retries}
    pitm = RetryHttp.call 'PUT', tourl + '/' + intermediate + toindex + '/_mapping/' + totype, {data: mapping, retry:API.es._retries}
    ret = RetryHttp.call 'POST', fromurl + '/' + index + '/' + type + '/_search?search_type=scan&scroll=1m', {data:{query: { match_all: {} }, size: 10000 }, retry:API.es._retries}
    if ret.data?._scroll_id?
      res = RetryHttp.call 'GET', fromurl + '/_search/scroll?scroll=1m&scroll_id=' + ret.data._scroll_id, {retry:API.es._retries}
      while (res?.data?.hits?.hits? and res.data.hits.hits.length)
        processed += res.data.hits.hits.length
        pkg = ''

          pkg += JSON.stringify(row._source) + '\n'
        hp = RetryHttp.call 'POST', tourl + '/_bulk', {content:pkg, headers:{'Content-Type':'text/plain'},retry:API.es._retries}
        pkg = ''
        res = RetryHttp.call 'GET', fromurl + '/_search/scroll?scroll=' + scroll + '&scroll_id=' + res.data._scroll_id, {retry:API.es._retries}
      refreshed = RetryHttp.call 'POST', tourl + '/' + intermediate + toindex + '/_refresh', {retry:API.es._retries}
      if intermediate is ''
        API.log {msg: 'Reindexed ' + fromurl + '/' + index + '/' + type + ' with ' + processed + ' records, to ' + tourl + '/' + intermediate + toindex + '/' + totype + ', no copy phase needed', level:'warn', notify:true}
