refactoring to avoid to calls to readIndex when fewer than DefaultBatchSize docs are requested.