org.elasticsearch.action.bulk
Class BulkRequestBuilder

java.lang.Object
  extended by org.elasticsearch.action.support.BaseRequestBuilder<BulkRequest,BulkResponse>
      extended by org.elasticsearch.action.bulk.BulkRequestBuilder
All Implemented Interfaces:
ActionRequestBuilder<BulkRequest,BulkResponse>

public class BulkRequestBuilder
extends BaseRequestBuilder<BulkRequest,BulkResponse>

A bulk request holds an ordered IndexRequests and DeleteRequests and allows to executes it in a single batch.


Field Summary
 
Fields inherited from class org.elasticsearch.action.support.BaseRequestBuilder
client, request
 
Constructor Summary
BulkRequestBuilder(Client client)
           
 
Method Summary
 BulkRequestBuilder add(byte[] data, int from, int length, boolean contentUnsafe)
          Adds a framed data in binary format
 BulkRequestBuilder add(byte[] data, int from, int length, boolean contentUnsafe, String defaultIndex, String defaultType)
          Adds a framed data in binary format
 BulkRequestBuilder add(DeleteRequest request)
          Adds an DeleteRequest to the list of actions to execute.
 BulkRequestBuilder add(DeleteRequestBuilder request)
          Adds an DeleteRequest to the list of actions to execute.
 BulkRequestBuilder add(IndexRequest request)
          Adds an IndexRequest to the list of actions to execute.
 BulkRequestBuilder add(IndexRequestBuilder request)
          Adds an IndexRequest to the list of actions to execute.
protected  void doExecute(ActionListener<BulkResponse> listener)
           
 int numberOfActions()
          The number of actions currently in the bulk.
 BulkRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
          Sets the consistency level.
 BulkRequestBuilder setRefresh(boolean refresh)
          Should a refresh be executed post this bulk operation causing the operations to be searchable.
 BulkRequestBuilder setReplicationType(ReplicationType replicationType)
          Set the replication type for this operation.
 
Methods inherited from class org.elasticsearch.action.support.BaseRequestBuilder
execute, execute, request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BulkRequestBuilder

public BulkRequestBuilder(Client client)
Method Detail

add

public BulkRequestBuilder 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 BulkRequestBuilder add(IndexRequestBuilder 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 BulkRequestBuilder add(DeleteRequest request)
Adds an DeleteRequest to the list of actions to execute.


add

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


add

public BulkRequestBuilder add(byte[] data,
                              int from,
                              int length,
                              boolean contentUnsafe)
                       throws Exception
Adds a framed data in binary format

Throws:
Exception

add

public BulkRequestBuilder add(byte[] data,
                              int from,
                              int length,
                              boolean contentUnsafe,
                              @Nullable
                              String defaultIndex,
                              @Nullable
                              String defaultType)
                       throws Exception
Adds a framed data in binary format

Throws:
Exception

setReplicationType

public BulkRequestBuilder setReplicationType(ReplicationType replicationType)
Set the replication type for this operation.


setConsistencyLevel

public BulkRequestBuilder setConsistencyLevel(WriteConsistencyLevel consistencyLevel)
Sets the consistency level. Defaults to WriteConsistencyLevel.DEFAULT.


setRefresh

public BulkRequestBuilder setRefresh(boolean refresh)
Should a refresh be executed post this bulk operation causing the operations to be searchable. Note, heavy indexing should not set this to true. Defaults to false.


numberOfActions

public int numberOfActions()
The number of actions currently in the bulk.


doExecute

protected void doExecute(ActionListener<BulkResponse> listener)
Specified by:
doExecute in class BaseRequestBuilder<BulkRequest,BulkResponse>


Copyright © 2009-2012. All Rights Reserved.