diff --git a/internal/elastic/core/scroll.go b/internal/elastic/core/scroll.go index 6651dae61..4aa725711 100644 --- a/internal/elastic/core/scroll.go +++ b/internal/elastic/core/scroll.go @@ -132,6 +132,9 @@ func (ctx *ScrollContext) Get(output interface{}) error { length := int64(len(hits)) offset := ctx.Offset - count + if offset > length && length < ctx.ChunkSize { + break + } if offset > 0 { hits = hits[offset:] }