Package org.elasticsearch.index.reindex
Class ScrollableHitSource
- java.lang.Object
-
- org.elasticsearch.index.reindex.ScrollableHitSource
-
- Direct Known Subclasses:
ClientScrollableHitSource
public abstract class ScrollableHitSource extends java.lang.ObjectA scrollable source of results. Pumps data out into the passed onResponse consumer. Same data may come out several times in case of failures during searching (though not yet). Once the onResponse consumer is done, it should call AsyncResponse.isDone(time) to receive more data (only receives one response at a time).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceScrollableHitSource.AsyncResponsestatic classScrollableHitSource.BasicHitAn implementation of ScrollableHitSource.Hit that uses getters and setters.static interfaceScrollableHitSource.HitA document returned as part of the response.static classScrollableHitSource.ResponseResponse from each scroll batch.static classScrollableHitSource.SearchFailureA failure during search.
-
Field Summary
Fields Modifier and Type Field Description protected BackoffPolicybackoffPolicyprotected java.lang.RunnablecountSearchRetryprotected java.util.function.Consumer<java.lang.Exception>failprotected org.apache.logging.log4j.Loggerloggerprotected ThreadPoolthreadPool
-
Constructor Summary
Constructors Constructor Description ScrollableHitSource(org.apache.logging.log4j.Logger logger, BackoffPolicy backoffPolicy, ThreadPool threadPool, java.lang.Runnable countSearchRetry, java.util.function.Consumer<ScrollableHitSource.AsyncResponse> onResponse, java.util.function.Consumer<java.lang.Exception> fail)
-
Method Summary
Modifier and Type Method Description protected abstract voidcleanup(java.lang.Runnable onCompletion)Called after the process has been totally finished to clean up any resources the process needed like remote connections.protected abstract voidclearScroll(java.lang.String scrollId, java.lang.Runnable onCompletion)Called to clear a scroll id.voidclose(java.lang.Runnable onCompletion)protected abstract voiddoStart(RejectAwareActionListener<ScrollableHitSource.Response> searchListener)protected abstract voiddoStartNextScroll(java.lang.String scrollId, TimeValue extraKeepAlive, RejectAwareActionListener<ScrollableHitSource.Response> searchListener)voidsetScroll(java.lang.String scrollId)Set the id of the last scroll.voidstart()
-
-
-
Field Detail
-
logger
protected final org.apache.logging.log4j.Logger logger
-
backoffPolicy
protected final BackoffPolicy backoffPolicy
-
threadPool
protected final ThreadPool threadPool
-
countSearchRetry
protected final java.lang.Runnable countSearchRetry
-
fail
protected final java.util.function.Consumer<java.lang.Exception> fail
-
-
Constructor Detail
-
ScrollableHitSource
public ScrollableHitSource(org.apache.logging.log4j.Logger logger, BackoffPolicy backoffPolicy, ThreadPool threadPool, java.lang.Runnable countSearchRetry, java.util.function.Consumer<ScrollableHitSource.AsyncResponse> onResponse, java.util.function.Consumer<java.lang.Exception> fail)
-
-
Method Detail
-
start
public final void start()
-
close
public final void close(java.lang.Runnable onCompletion)
-
doStart
protected abstract void doStart(RejectAwareActionListener<ScrollableHitSource.Response> searchListener)
-
doStartNextScroll
protected abstract void doStartNextScroll(java.lang.String scrollId, TimeValue extraKeepAlive, RejectAwareActionListener<ScrollableHitSource.Response> searchListener)
-
clearScroll
protected abstract void clearScroll(java.lang.String scrollId, java.lang.Runnable onCompletion)Called to clear a scroll id.- Parameters:
scrollId- the id to clearonCompletion- implementers must call this after completing the clear whether they are successful or not
-
cleanup
protected abstract void cleanup(java.lang.Runnable onCompletion)
Called after the process has been totally finished to clean up any resources the process needed like remote connections.- Parameters:
onCompletion- implementers must call this after completing the cleanup whether they are successful or not
-
setScroll
public final void setScroll(java.lang.String scrollId)
Set the id of the last scroll. Used for debugging.
-
-