public class BulkProcessor extends Object implements Closeable
In order to create a new bulk processor, use the Builder
.
Modifier and Type | Method and Description |
---|---|
BulkProcessor |
add(org.elasticsearch.common.bytes.BytesReference data,
String defaultIndex,
String defaultType,
String defaultPipeline,
org.elasticsearch.common.xcontent.XContentType xContentType)
Adds the data from the bytes to be processed by the bulk processor
|
BulkProcessor |
add(org.elasticsearch.common.bytes.BytesReference data,
String defaultIndex,
String defaultType,
org.elasticsearch.common.xcontent.XContentType xContentType)
Adds the data from the bytes to be processed by the bulk processor
|
BulkProcessor |
add(org.elasticsearch.action.delete.DeleteRequest request)
Adds an
DeleteRequest to the list of actions to execute. |
BulkProcessor |
add(org.elasticsearch.action.DocWriteRequest<?> request)
Adds either a delete or an index request.
|
BulkProcessor |
add(org.elasticsearch.action.index.IndexRequest request)
Adds an
IndexRequest to the list of actions to execute. |
boolean |
awaitClose(long timeout,
TimeUnit unit)
Closes the processor.
|
static lumis.portal.bigdata.elasticsearch.BulkProcessor.Builder |
builder(java.util.function.BiConsumer<org.elasticsearch.action.bulk.BulkRequest,org.elasticsearch.action.ActionListener<org.elasticsearch.action.bulk.BulkResponse>> consumer,
lumis.portal.bigdata.elasticsearch.BulkProcessor.Listener listener) |
static lumis.portal.bigdata.elasticsearch.BulkProcessor.Builder |
builder(org.elasticsearch.client.Client client,
lumis.portal.bigdata.elasticsearch.BulkProcessor.Listener listener) |
void |
close()
Closes the processor.
|
protected void |
ensureOpen() |
void |
flush()
Flush pending delete or index requests.
|
public static lumis.portal.bigdata.elasticsearch.BulkProcessor.Builder builder(org.elasticsearch.client.Client client, lumis.portal.bigdata.elasticsearch.BulkProcessor.Listener listener)
public static lumis.portal.bigdata.elasticsearch.BulkProcessor.Builder builder(java.util.function.BiConsumer<org.elasticsearch.action.bulk.BulkRequest,org.elasticsearch.action.ActionListener<org.elasticsearch.action.bulk.BulkResponse>> consumer, lumis.portal.bigdata.elasticsearch.BulkProcessor.Listener listener)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public boolean awaitClose(long timeout, TimeUnit unit) throws InterruptedException
If concurrent requests are not enabled, returns true
immediately.
If concurrent requests are enabled, waits for up to the specified timeout for all bulk requests to complete then returns true
If the specified waiting time elapses before all bulk requests complete, false
is returned.
timeout
- The maximum time to wait for the bulk requests to completeunit
- The time unit of the timeout
argumenttrue
if all bulk requests completed and false
if the waiting time elapsed before all the bulk requests
completedInterruptedException
- If the current thread is interruptedpublic BulkProcessor add(org.elasticsearch.action.index.IndexRequest request)
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).public BulkProcessor add(org.elasticsearch.action.delete.DeleteRequest request)
DeleteRequest
to the list of actions to execute.public BulkProcessor add(org.elasticsearch.action.DocWriteRequest<?> request)
protected void ensureOpen()
public BulkProcessor add(org.elasticsearch.common.bytes.BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType, org.elasticsearch.common.xcontent.XContentType xContentType) throws Exception
Exception
public BulkProcessor add(org.elasticsearch.common.bytes.BytesReference data, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable String defaultPipeline, org.elasticsearch.common.xcontent.XContentType xContentType) throws Exception
Exception
public void flush()
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.