java.lang.Object
org.elasticsearch.action.ActionRequestLazyBuilder<BulkRequest,BulkResponse>
org.elasticsearch.action.bulk.BulkRequestBuilder
- All Implemented Interfaces:
RequestBuilder<BulkRequest,
,BulkResponse> WriteRequestBuilder<BulkRequestBuilder>
public class BulkRequestBuilder
extends ActionRequestLazyBuilder<BulkRequest,BulkResponse>
implements WriteRequestBuilder<BulkRequestBuilder>
A bulk request holds an ordered
IndexRequest
s and DeleteRequest
s and allows to executes
it in a single batch.-
Field Summary
Fields inherited from class org.elasticsearch.action.ActionRequestLazyBuilder
action, client
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(byte[] data, int from, int length, String defaultIndex, XContentType xContentType) Adds a framed data in binary formatadd
(byte[] data, int from, int length, XContentType xContentType) Adds a framed data in binary formatadd
(DeleteRequest request) Deprecated.add
(DeleteRequestBuilder request) Adds anDeleteRequest
to the list of actions to execute.add
(IndexRequest request) Deprecated.useadd(IndexRequestBuilder)
insteadadd
(IndexRequestBuilder request) Adds anIndexRequest
to the list of actions to execute.add
(UpdateRequest request) Deprecated.useadd(UpdateRequestBuilder)
insteadadd
(UpdateRequestBuilder request) Adds anUpdateRequest
to the list of actions to execute.int
The number of actions currently in the bulk.request()
This method creates the request.setRefreshPolicy
(String refreshPolicy) Parse the refresh policy from a string, only modifying it if the string is non null.setRefreshPolicy
(WriteRequest.RefreshPolicy refreshPolicy) Should this request trigger a refresh (WriteRequest.RefreshPolicy.IMMEDIATE), wait for a refresh ( WriteRequest.RefreshPolicy.WAIT_UNTIL), or proceed ignore refreshes entirely (WriteRequest.RefreshPolicy.NONE, the default).final BulkRequestBuilder
setTimeout
(String timeout) A timeout to wait if the index operation can't be performed immediately.final BulkRequestBuilder
setTimeout
(TimeValue timeout) A timeout to wait if the index operation can't be performed immediately.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.setWaitForActiveShards
(ActiveShardCount waitForActiveShards) Sets the number of shard copies that must be active before proceeding with the write.Methods inherited from class org.elasticsearch.action.ActionRequestLazyBuilder
execute, execute, get, get
-
Constructor Details
-
BulkRequestBuilder
-
BulkRequestBuilder
-
-
Method Details
-
add
Deprecated.useadd(IndexRequestBuilder)
insteadAdds anIndexRequest
to 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
Adds anIndexRequest
to 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
Deprecated.useadd(DeleteRequestBuilder)
insteadAdds anDeleteRequest
to the list of actions to execute. -
add
Adds anDeleteRequest
to the list of actions to execute. -
add
Deprecated.useadd(UpdateRequestBuilder)
insteadAdds anUpdateRequest
to the list of actions to execute. -
add
Adds anUpdateRequest
to the list of actions to execute. -
add
public BulkRequestBuilder add(byte[] data, int from, int length, XContentType xContentType) throws Exception Adds a framed data in binary format- Throws:
Exception
-
add
public BulkRequestBuilder add(byte[] data, int from, int length, @Nullable String defaultIndex, XContentType xContentType) throws Exception Adds a framed data in binary format- Throws:
Exception
-
setWaitForActiveShards
Sets the number of shard copies that must be active before proceeding with the write. SeeReplicationRequest.waitForActiveShards(ActiveShardCount)
for details. -
setWaitForActiveShards
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
A timeout to wait if the index operation can't be performed immediately. Defaults to1m
. -
setTimeout
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
-
routing
-
setRefreshPolicy
Description copied from interface:WriteRequestBuilder
Should this request trigger a refresh (WriteRequest.RefreshPolicy.IMMEDIATE), wait for a refresh ( WriteRequest.RefreshPolicy.WAIT_UNTIL), or proceed ignore refreshes entirely (WriteRequest.RefreshPolicy.NONE, the default).- Specified by:
setRefreshPolicy
in interfaceWriteRequestBuilder<BulkRequestBuilder>
-
setRefreshPolicy
Description copied from interface:WriteRequestBuilder
Parse the refresh policy from a string, only modifying it if the string is non null. Convenient to use with request parsing.- Specified by:
setRefreshPolicy
in interfaceWriteRequestBuilder<BulkRequestBuilder>
-
request
Description copied from class:ActionRequestLazyBuilder
This method creates the request. The caller of this method is responsible for calling Request#decRef.- Specified by:
request
in interfaceRequestBuilder<BulkRequest,
BulkResponse> - Specified by:
request
in interfaceWriteRequestBuilder<BulkRequestBuilder>
- Specified by:
request
in classActionRequestLazyBuilder<BulkRequest,
BulkResponse> - Returns:
- A newly-built Request, fully initialized by this builder.
-
add(DeleteRequestBuilder)
instead