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 ClusterService
protected final IndexingPressure
protected final LongSupplier
protected final SystemIndices
protected final Executor
protected final ThreadPool
protected final Executor
Fields 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, LongSupplier relativeTimeNanosProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected long
buildTookInMillis
(long startTimeNanos) protected void
doExecute
(Task task, BulkRequest bulkRequest, ActionListener<BulkResponse> listener) protected abstract void
doInternalExecute
(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 IndexRequest
getIndexWriteRequest
(DocWriteRequest<?> docWriteRequest) Retrieves theIndexRequest
from the providedDocWriteRequest
for index or upsert actions.protected IngestService
getIngestService
(BulkRequest request) protected long
protected abstract Boolean
resolveFailureStore
(String indexName, Metadata 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
-
relativeTimeNanosProvider
-
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, LongSupplier relativeTimeNanosProvider)
-
-
Method Details
-
doExecute
- Specified by:
doExecute
in classTransportAction<BulkRequest,
BulkResponse>
-
resolveFailureStore
protected abstract Boolean resolveFailureStore(String indexName, Metadata 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 theIndexRequest
from the providedDocWriteRequest
for index or upsert actions. Upserts are modeled asIndexRequest
inside theUpdateRequest
. IgnoresDeleteRequest
's- Parameters:
docWriteRequest
- The request to find theIndexRequest
- Returns:
- the found
IndexRequest
ornull
if 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
-