Package org.elasticsearch.action.bulk
Class BulkRequestBuilder
- java.lang.Object
-
- org.elasticsearch.action.ActionRequestBuilder<BulkRequest,BulkResponse,BulkRequestBuilder>
-
- org.elasticsearch.action.bulk.BulkRequestBuilder
-
- All Implemented Interfaces:
WriteRequestBuilder<BulkRequestBuilder>
public class BulkRequestBuilder extends ActionRequestBuilder<BulkRequest,BulkResponse,BulkRequestBuilder> implements WriteRequestBuilder<BulkRequestBuilder>
A bulk request holds an orderedIndexRequests andDeleteRequests and allows to executes it in a single batch.
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.action.ActionRequestBuilder
action, client, request
-
-
Constructor Summary
Constructors Constructor Description BulkRequestBuilder(ElasticsearchClient client, BulkAction action)BulkRequestBuilder(ElasticsearchClient client, BulkAction action, java.lang.String globalIndex, java.lang.String globalType)
-
Method Summary
Modifier and Type Method Description BulkRequestBuilderadd(byte[] data, int from, int length, java.lang.String defaultIndex, java.lang.String defaultType, XContentType xContentType)Adds a framed data in binary formatBulkRequestBuilderadd(byte[] data, int from, int length, XContentType xContentType)Adds a framed data in binary formatBulkRequestBuilderadd(DeleteRequest request)Adds anDeleteRequestto the list of actions to execute.BulkRequestBuilderadd(DeleteRequestBuilder request)Adds anDeleteRequestto the list of actions to execute.BulkRequestBuilderadd(IndexRequest request)Adds anIndexRequestto the list of actions to execute.BulkRequestBuilderadd(IndexRequestBuilder request)Adds anIndexRequestto the list of actions to execute.BulkRequestBuilderadd(UpdateRequest request)Adds anUpdateRequestto the list of actions to execute.BulkRequestBuilderadd(UpdateRequestBuilder request)Adds anUpdateRequestto the list of actions to execute.intnumberOfActions()The number of actions currently in the bulk.BulkRequestBuilderpipeline(java.lang.String globalPipeline)BulkRequestBuilderrouting(java.lang.String globalRouting)BulkRequestBuildersetTimeout(java.lang.String timeout)A timeout to wait if the index operation can't be performed immediately.BulkRequestBuildersetTimeout(TimeValue timeout)A timeout to wait if the index operation can't be performed immediately.BulkRequestBuildersetWaitForActiveShards(int waitForActiveShards)A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.BulkRequestBuildersetWaitForActiveShards(ActiveShardCount waitForActiveShards)Sets the number of shard copies that must be active before proceeding with the write.-
Methods inherited from class org.elasticsearch.action.ActionRequestBuilder
execute, execute, get, get, get, request
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.elasticsearch.action.support.WriteRequestBuilder
request, setRefreshPolicy, setRefreshPolicy
-
-
-
-
Constructor Detail
-
BulkRequestBuilder
public BulkRequestBuilder(ElasticsearchClient client, BulkAction action, @Nullable java.lang.String globalIndex, @Nullable java.lang.String globalType)
-
BulkRequestBuilder
public BulkRequestBuilder(ElasticsearchClient client, BulkAction action)
-
-
Method Detail
-
add
public BulkRequestBuilder add(IndexRequest request)
Adds anIndexRequestto the list of actions to execute. Follows the same behavior ofIndexRequest(for example, if no id is provided, one will be generated, or usage of the create flag).
-
add
public BulkRequestBuilder add(IndexRequestBuilder request)
Adds anIndexRequestto the list of actions to execute. Follows the same behavior ofIndexRequest(for example, if no id is provided, one will be generated, or usage of the create flag).
-
add
public BulkRequestBuilder add(DeleteRequest request)
Adds anDeleteRequestto the list of actions to execute.
-
add
public BulkRequestBuilder add(DeleteRequestBuilder request)
Adds anDeleteRequestto the list of actions to execute.
-
add
public BulkRequestBuilder add(UpdateRequest request)
Adds anUpdateRequestto the list of actions to execute.
-
add
public BulkRequestBuilder add(UpdateRequestBuilder request)
Adds anUpdateRequestto the list of actions to execute.
-
add
public BulkRequestBuilder add(byte[] data, int from, int length, XContentType xContentType) throws java.lang.Exception
Adds a framed data in binary format- Throws:
java.lang.Exception
-
add
public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable java.lang.String defaultIndex, @Nullable java.lang.String defaultType, XContentType xContentType) throws java.lang.Exception
Adds a framed data in binary format- Throws:
java.lang.Exception
-
setWaitForActiveShards
public BulkRequestBuilder setWaitForActiveShards(ActiveShardCount waitForActiveShards)
Sets the number of shard copies that must be active before proceeding with the write. SeeReplicationRequest.waitForActiveShards(ActiveShardCount)for details.
-
setWaitForActiveShards
public BulkRequestBuilder setWaitForActiveShards(int waitForActiveShards)
A shortcut forsetWaitForActiveShards(ActiveShardCount)where the numerical shard count is passed in, instead of having to first callActiveShardCount.from(int)to get the ActiveShardCount.
-
setTimeout
public final BulkRequestBuilder setTimeout(TimeValue timeout)
A timeout to wait if the index operation can't be performed immediately. Defaults to1m.
-
setTimeout
public final BulkRequestBuilder setTimeout(java.lang.String timeout)
A timeout to wait if the index operation can't be performed immediately. Defaults to1m.
-
numberOfActions
public int numberOfActions()
The number of actions currently in the bulk.
-
pipeline
public BulkRequestBuilder pipeline(java.lang.String globalPipeline)
-
routing
public BulkRequestBuilder routing(java.lang.String globalRouting)
-
-