Module org.elasticsearch.server
Package org.elasticsearch.action.bulk
Class TransportAbstractBulkAction
java.lang.Object
org.elasticsearch.action.support.TransportAction<BulkRequest,BulkResponse>
org.elasticsearch.action.support.HandledTransportAction<BulkRequest,BulkResponse>
org.elasticsearch.action.bulk.TransportAbstractBulkAction
- Direct Known Subclasses:
TransportBulkAction,TransportSimulateBulkAction
public abstract class TransportAbstractBulkAction
extends HandledTransportAction<BulkRequest,BulkResponse>
This is an abstract base class for bulk actions. It traverses all indices that the request gets routed to, executes all applicable
pipelines, and then delegates to the concrete implementation of #doInternalExecute to actually index the data.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ClusterServiceprotected final Executorprotected final IndexingPressureprotected final ProjectResolverprotected final LongSupplierprotected final SystemIndicesprotected final Executorprotected final ThreadPoolprotected final ExecutorFields inherited from class org.elasticsearch.action.support.TransportAction
actionName, taskManager -
Constructor Summary
ConstructorsConstructorDescriptionTransportAbstractBulkAction(ActionType<BulkResponse> action, TransportService transportService, ActionFilters actionFilters, Writeable.Reader<BulkRequest> requestReader, ThreadPool threadPool, ClusterService clusterService, IngestService ingestService, IndexingPressure indexingPressure, SystemIndices systemIndices, ProjectResolver projectResolver, LongSupplier relativeTimeNanosProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected longbuildTookInMillis(long startTimeNanos) protected voiddoExecute(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener) protected abstract voiddoInternalExecute(Task task, BulkRequest bulkRequest, Executor executor, ActionListener<BulkResponse> listener, long relativeStartTimeNanos) This method creates any missing resources and actually applies the BulkRequest to the relevant indicesstatic IndexRequestgetIndexWriteRequest(DocWriteRequest<?> docWriteRequest) Retrieves theIndexRequestfrom the providedDocWriteRequestfor index or upsert actions.protected IngestServicegetIngestService(BulkRequest request) protected longprotected abstract BooleanresolveFailureStore(String indexName, ProjectMetadata metadata, long epochMillis) Determines if an index name is associated with either an existing data stream or a template for one that has the failure store enabled.Methods inherited from class org.elasticsearch.action.support.TransportAction
execute, executeDirect, localOnly
-
Field Details
-
threadPool
-
clusterService
-
indexingPressure
-
systemIndices
-
projectResolver
-
relativeTimeNanosProvider
-
coordinationExecutor
-
writeExecutor
-
systemWriteExecutor
-
-
Constructor Details
-
TransportAbstractBulkAction
public TransportAbstractBulkAction(ActionType<BulkResponse> action, TransportService transportService, ActionFilters actionFilters, Writeable.Reader<BulkRequest> requestReader, ThreadPool threadPool, ClusterService clusterService, IngestService ingestService, IndexingPressure indexingPressure, SystemIndices systemIndices, ProjectResolver projectResolver, LongSupplier relativeTimeNanosProvider)
-
-
Method Details
-
doExecute
- Specified by:
doExecutein classTransportAction<BulkRequest,BulkResponse>
-
resolveFailureStore
protected abstract Boolean resolveFailureStore(String indexName, ProjectMetadata metadata, long epochMillis) Determines if an index name is associated with either an existing data stream or a template for one that has the failure store enabled.- Parameters:
indexName- The index name to check.metadata- Cluster state metadata.epochMillis- A timestamp to use when resolving date math in the index name.- Returns:
- true if this is not a simulation, and the given index name corresponds to a data stream with a failure store, or if it matches a template that has a data stream failure store enabled, or if it matches a data stream template with no failure store option specified and the name matches the cluster setting to enable the failure store. Returns false if the index name corresponds to a data stream, but it doesn't have the failure store enabled by one of those conditions. Returns null when it doesn't correspond to a data stream.
-
getIndexWriteRequest
Retrieves theIndexRequestfrom the providedDocWriteRequestfor index or upsert actions. Upserts are modeled asIndexRequestinside theUpdateRequest. IgnoresDeleteRequest's- Parameters:
docWriteRequest- The request to find theIndexRequest- Returns:
- the found
IndexRequestornullif one can not be found.
-
getIngestService
-
relativeTimeNanos
protected long relativeTimeNanos() -
buildTookInMillis
protected long buildTookInMillis(long startTimeNanos) -
doInternalExecute
protected abstract void doInternalExecute(Task task, BulkRequest bulkRequest, Executor executor, ActionListener<BulkResponse> listener, long relativeStartTimeNanos) throws IOException This method creates any missing resources and actually applies the BulkRequest to the relevant indices- Parameters:
task- The task in which this work is being donebulkRequest- The BulkRequest of changes to make to indicesexecutor- The executor for the thread pool in which the work is to be donelistener- The listener to be notified of resultsrelativeStartTimeNanos- The relative start time of this bulk load, to be used in computing the time taken for the BulkResponse- Throws:
IOException
-