Class BulkProcessor.Builder

java.lang.Object
org.elasticsearch.action.bulk.BulkProcessor.Builder
Enclosing class:
BulkProcessor

public static class BulkProcessor.Builder extends Object
A builder used to create a build an instance of a bulk processor.
  • Method Details

    • setConcurrentRequests

      public BulkProcessor.Builder setConcurrentRequests(int concurrentRequests)
      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 to 1.
    • setBulkActions

      public BulkProcessor.Builder setBulkActions(int bulkActions)
      Sets when to flush a new bulk request based on the number of actions currently added. Defaults to 1000. Can be set to -1 to disable it.
    • setBulkSize

      public BulkProcessor.Builder setBulkSize(ByteSizeValue bulkSize)
      Sets when to flush a new bulk request based on the size of actions currently added. Defaults to 5mb. Can be set to -1 to disable it.
    • setFlushInterval

      public BulkProcessor.Builder setFlushInterval(TimeValue flushInterval)
      Sets a flush interval flushing *any* bulk actions pending if the interval passes. Defaults to not set.

      Note, both setBulkActions(int) and setBulkSize(org.elasticsearch.common.unit.ByteSizeValue) can be set to -1 with the flush interval set allowing for complete async processing of bulk actions.

    • setGlobalIndex

      public BulkProcessor.Builder setGlobalIndex(String globalIndex)
    • setGlobalType

      public BulkProcessor.Builder setGlobalType(String globalType)
    • setGlobalRouting

      public BulkProcessor.Builder setGlobalRouting(String globalRouting)
    • setGlobalPipeline

      public BulkProcessor.Builder setGlobalPipeline(String globalPipeline)
    • setBackoffPolicy

      public BulkProcessor.Builder setBackoffPolicy(BackoffPolicy backoffPolicy)
      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:
    • build

      public BulkProcessor build()
      Builds a new bulk processor.
    • setFlushCondition

      public BulkProcessor.Builder setFlushCondition(Supplier<Boolean> flushCondition)