In order to make it very easy to use we should create and kill the client inside the reindex function. function helpers.reindex(sourceClient, sourceIndex, targetIndex, query, targetClient, scroll)