Class BulkProcessor2.Builder

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

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

    • setBulkActions

      public BulkProcessor2.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 BulkProcessor2.Builder setBulkSize(ByteSizeValue maxBulkSizeInBytes)
      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 BulkProcessor2.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.

    • setMaxNumberOfRetries

      public BulkProcessor2.Builder setMaxNumberOfRetries(int maxNumberOfRetries)
      Sets the maximum number of times a BulkRequest will be retried if it fails.
    • setMaxBytesInFlight

      public BulkProcessor2.Builder setMaxBytesInFlight(ByteSizeValue maxBytesInFlight)
      Sets the maximum number of bytes allowed in in-flight requests (both the BulkRequest being built up by the BulkProcessor and any BulkRequests sent to Retry2 that have not yet completed) before subsequent calls to add()result in EsRejectedExecutionException. Defaults to 50mb.
    • build

      public BulkProcessor2 build()
      Builds a new bulk processor.