org.elasticsearch.action.bulk
Class BulkProcessor

java.lang.Object
  extended by org.elasticsearch.action.bulk.BulkProcessor

public class BulkProcessor
extends Object

A bulk processor is a thread safe bulk processing class, allowing to easily set when to "flush" a new bulk request (either based on number of actions, based on the size, or time), and to easily control the number of concurrent bulk requests allowed to be executed in parallel.

In order to create a new bulk processor, use the BulkProcessor.Builder.


Nested Class Summary
static class BulkProcessor.Builder
          A builder used to create a build an instance of a bulk processor.
static interface BulkProcessor.Listener
          A listener for the execution.
 
Method Summary
 BulkProcessor add(ActionRequest request)
           
 BulkProcessor add(BytesReference data, boolean contentUnsafe, String defaultIndex, String defaultType)
           
 BulkProcessor add(DeleteRequest request)
          Adds an DeleteRequest to the list of actions to execute.
 BulkProcessor add(IndexRequest request)
          Adds an IndexRequest to the list of actions to execute.
static BulkProcessor.Builder builder(Client client, BulkProcessor.Listener listener)
           
 void close()
          Closes the processor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

builder

public static BulkProcessor.Builder builder(Client client,
                                            BulkProcessor.Listener listener)

close

public void close()
Closes the processor. If flushing by time is enabled, then its shutdown. Any remaining bulk actions are flushed.


add

public BulkProcessor add(IndexRequest request)
Adds an IndexRequest to the list of actions to execute. Follows the same behavior of IndexRequest (for example, if no id is provided, one will be generated, or usage of the create flag).


add

public BulkProcessor add(DeleteRequest request)
Adds an DeleteRequest to the list of actions to execute.


add

public BulkProcessor add(ActionRequest request)

add

public BulkProcessor add(BytesReference data,
                         boolean contentUnsafe,
                         @Nullable
                         String defaultIndex,
                         @Nullable
                         String defaultType)
                  throws Exception
Throws:
Exception


Copyright © 2009-2012. All Rights Reserved.