Class AbstractAsyncBulkByScrollAction<Request extends org.elasticsearch.index.reindex.AbstractBulkByScrollRequest<Request>,Action extends org.elasticsearch.action.support.TransportAction<Request,?>>

java.lang.Object
org.elasticsearch.reindex.AbstractAsyncBulkByScrollAction<Request,Action>
Direct Known Subclasses:
AsyncDeleteByQueryAction

public abstract class AbstractAsyncBulkByScrollAction<Request extends org.elasticsearch.index.reindex.AbstractBulkByScrollRequest<Request>,Action extends org.elasticsearch.action.support.TransportAction<Request,?>> extends Object
Abstract base for scrolling across a search and executing bulk actions on all results. All package private methods are package private so their tests can use them. Most methods run in the listener thread pool because they are meant to be fast and don't expect to block.
  • Field Details

    • logger

      protected final org.apache.logging.log4j.Logger logger
    • task

      protected final org.elasticsearch.index.reindex.BulkByScrollTask task
    • worker

      protected final org.elasticsearch.index.reindex.WorkerBulkByScrollTaskState worker
    • threadPool

      protected final org.elasticsearch.threadpool.ThreadPool threadPool
    • scriptService

      protected final org.elasticsearch.script.ScriptService scriptService
    • sslConfig

      protected final ReindexSslConfig sslConfig
    • mainRequest

      protected final Request extends org.elasticsearch.index.reindex.AbstractBulkByScrollRequest<Request> mainRequest
      The request for this action. Named mainRequest because we create lots of request variables all representing child requests of this mainRequest.
  • Method Details

    • buildScriptApplier

      public BiFunction<AbstractAsyncBulkByScrollAction.RequestWrapper<?>,org.elasticsearch.index.reindex.ScrollableHitSource.Hit,AbstractAsyncBulkByScrollAction.RequestWrapper<?>> buildScriptApplier()
      Build the BiFunction to apply to all AbstractAsyncBulkByScrollAction.RequestWrapper. Public for testings....
    • buildRequest

      protected abstract AbstractAsyncBulkByScrollAction.RequestWrapper<?> buildRequest(org.elasticsearch.index.reindex.ScrollableHitSource.Hit doc)
      Build the AbstractAsyncBulkByScrollAction.RequestWrapper for a single search hit. This shouldn't handle metadata or scripting. That will be handled by copyMetadata and apply functions that can be overridden.
    • copyMetadata

      protected AbstractAsyncBulkByScrollAction.RequestWrapper<?> copyMetadata(AbstractAsyncBulkByScrollAction.RequestWrapper<?> request, org.elasticsearch.index.reindex.ScrollableHitSource.Hit doc)
      Copies the metadata from a hit to the request.
    • copyRouting

      protected void copyRouting(AbstractAsyncBulkByScrollAction.RequestWrapper<?> request, String routing)
      Copy the routing from a search hit to the request.
    • accept

      protected boolean accept(org.elasticsearch.index.reindex.ScrollableHitSource.Hit doc)
      Used to accept or ignore a search hit. Ignored search hits will be excluded from the bulk request. It is also where we fail on invalid search hits, like when the document has no source but it's required.
    • buildScrollableResultSource

      protected org.elasticsearch.index.reindex.ScrollableHitSource buildScrollableResultSource(org.elasticsearch.action.bulk.BackoffPolicy backoffPolicy)
    • buildResponse

      protected org.elasticsearch.index.reindex.BulkByScrollResponse buildResponse(org.elasticsearch.core.TimeValue took, List<org.elasticsearch.action.bulk.BulkItemResponse.Failure> indexingFailures, List<org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure> searchFailures, boolean timedOut)
      Build the response for reindex actions.
    • start

      public void start()
      Start the action by firing the initial search request.
    • finishHim

      protected void finishHim(Exception failure)
      Finish the request.
      Parameters:
      failure - if non null then the request failed catastrophically with this exception
    • finishHim

      protected void finishHim(Exception failure, List<org.elasticsearch.action.bulk.BulkItemResponse.Failure> indexingFailures, List<org.elasticsearch.index.reindex.ScrollableHitSource.SearchFailure> searchFailures, boolean timedOut)
      Finish the request.
      Parameters:
      failure - if non null then the request failed catastrophically with this exception
      indexingFailures - any indexing failures accumulated during the request
      searchFailures - any search failures accumulated during the request
      timedOut - have any of the sub-requests timed out?
    • wrap

      public static AbstractAsyncBulkByScrollAction.RequestWrapper<org.elasticsearch.action.index.IndexRequest> wrap(org.elasticsearch.action.index.IndexRequest request)
    • wrap

      public static AbstractAsyncBulkByScrollAction.RequestWrapper<org.elasticsearch.action.delete.DeleteRequest> wrap(org.elasticsearch.action.delete.DeleteRequest request)