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.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
SearchScrollResult<H>
next()
Returns the next chunk, with at mostchunkSize
hits.
-
-
-
Method Detail
-
close
void close()
- Specified by:
close
in interfaceAutoCloseable
-
next
SearchScrollResult<H> next()
Returns the next chunk, with at mostchunkSize
hits.May return a result with less than
chunkSize
elements if only that many hits are left.- Returns:
- The next
SearchScrollResult
. - See Also:
SearchFetchable.scroll(int)
-
-