org.elasticsearch.action.bulk
Class BulkProcessor.Builder

java.lang.Object
  extended by 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.


Constructor Summary
BulkProcessor.Builder(Client client, BulkProcessor.Listener listener)
          Creates a builder of bulk processor with the client to use and the listener that will be used to be notified on the completion of bulk requests.
 
Method Summary
 BulkProcessor build()
          Builds a new bulk processor.
 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(TimeValue flushInterval)
          Sets a flush interval flushing *any* bulk actions pending if the interval passes.
 BulkProcessor.Builder setName(String name)
          Sets an optional name to identify this bulk processor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BulkProcessor.Builder

public BulkProcessor.Builder(Client client,
                             BulkProcessor.Listener listener)
Creates a builder of bulk processor with the client to use and the listener that will be used to be notified on the completion of bulk requests.

Method Detail

setName

public BulkProcessor.Builder setName(String name)
Sets an optional name to identify this bulk processor.


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.


build

public BulkProcessor build()
Builds a new bulk processor.



Copyright © 2009-2012. All Rights Reserved.