Package org.elasticsearch.action.bulk
Class BulkProcessor.Builder
java.lang.Object
org.elasticsearch.action.bulk.BulkProcessor.Builder
- Enclosing class:
- BulkProcessor
public static class BulkProcessor.Builder
extends java.lang.Object
A builder used to create a build an instance of a bulk processor.
-
Method Summary
Modifier and Type Method Description BulkProcessor
build()
Builds a new bulk processor.BulkProcessor.Builder
setBackoffPolicy(BackoffPolicy backoffPolicy)
Sets a custom backoff policy.BulkProcessor.Builder
setBulkActions(int bulkActions)
Sets when to flush a new bulk request based on the number of actions currently added.BulkProcessor.Builder
setBulkSize(ByteSizeValue bulkSize)
Sets when to flush a new bulk request based on the size of actions currently added.BulkProcessor.Builder
setConcurrentRequests(int concurrentRequests)
Sets the number of concurrent requests allowed to be executed.BulkProcessor.Builder
setFlushInterval(org.elasticsearch.common.unit.TimeValue flushInterval)
Sets a flush interval flushing *any* bulk actions pending if the interval passes.BulkProcessor.Builder
setGlobalIndex(java.lang.String globalIndex)
BulkProcessor.Builder
setGlobalPipeline(java.lang.String globalPipeline)
BulkProcessor.Builder
setGlobalRouting(java.lang.String globalRouting)
BulkProcessor.Builder
setGlobalType(java.lang.String globalType)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Method Details
-
setConcurrentRequests
Sets the number of concurrent requests allowed to be executed. A value of 0 means that only a single request will be allowed to be executed. A value of 1 means 1 concurrent request is allowed to be executed while accumulating new bulk requests. Defaults to1
. -
setBulkActions
Sets when to flush a new bulk request based on the number of actions currently added. Defaults to1000
. Can be set to-1
to disable it. -
setBulkSize
Sets when to flush a new bulk request based on the size of actions currently added. Defaults to5mb
. Can be set to-1
to disable it. -
setFlushInterval
public BulkProcessor.Builder setFlushInterval(org.elasticsearch.common.unit.TimeValue flushInterval)Sets a flush interval flushing *any* bulk actions pending if the interval passes. Defaults to not set.Note, both
setBulkActions(int)
andsetBulkSize(org.elasticsearch.common.unit.ByteSizeValue)
can be set to-1
with the flush interval set allowing for complete async processing of bulk actions. -
setGlobalIndex
-
setGlobalType
-
setGlobalRouting
-
setGlobalPipeline
-
setBackoffPolicy
Sets a custom backoff policy. The backoff policy defines how the bulk processor should handle retries of bulk requests internally in case they have failed due to resource constraints (i.e. a thread pool was full). The default is to back off exponentially.- See Also:
BackoffPolicy.exponentialBackoff()
-
build
Builds a new bulk processor.
-