Interface SearchScroll<H>

  • Type Parameters:
    H - The type of hits.
    All Superinterfaces:
    AutoCloseable
    All Known Subinterfaces:
    ElasticsearchSearchScroll<H>, ExtendedSearchScroll<H,​R>, LuceneSearchScroll<H>

    public interface SearchScroll<H>
    extends AutoCloseable
    An ongoing query execution delivering hits continuously from a single snapshot of the index.

    This is different from classic pagination, where a loop executes the same query multiple times with an incrementing offset. Classic pagination will execute the query against a different snapshot of the index for each call to fetch(...), potentially leading to some hits appearing in two subsequent pages if the index was modified between two executions. Scrolls do not suffer from this limitation and guarantee that each hit is returned only once.

    As the scroll maintains a reference to internal resources that ultimately must be freed, the client must call close() when it no longer needs the scroll. Additionally, some implementations have an internal timeout beyond which the scroll will automatically close and will no longer be usable.