@Internal public class Elasticsearch2ApiCallBridge extends Object implements ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
ElasticsearchApiCallBridge
for Elasticsearch 2.x.Modifier and Type | Method and Description |
---|---|
void |
configureBulkProcessorBackoff(org.elasticsearch.action.bulk.BulkProcessor.Builder builder,
ElasticsearchSinkBase.BulkFlushBackoffPolicy flushBackoffPolicy)
Set backoff-related configurations on the provided
BulkProcessor.Builder . |
org.elasticsearch.action.bulk.BulkProcessor.Builder |
createBulkProcessorBuilder(org.elasticsearch.client.transport.TransportClient client,
org.elasticsearch.action.bulk.BulkProcessor.Listener listener)
Creates a
BulkProcessor.Builder for creating the bulk processor. |
org.elasticsearch.client.transport.TransportClient |
createClient(Map<String,String> clientConfig)
Creates an Elasticsearch client implementing
AutoCloseable . |
Throwable |
extractFailureCauseFromBulkItemResponse(org.elasticsearch.action.bulk.BulkItemResponse bulkItemResponse)
Extracts the cause of failure of a bulk item action.
|
void |
verifyClientConnection(org.elasticsearch.client.transport.TransportClient client)
Verify the client connection by making a test request/ping to the Elasticsearch cluster.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanup, createBulkProcessorIndexer
public org.elasticsearch.client.transport.TransportClient createClient(Map<String,String> clientConfig)
ElasticsearchApiCallBridge
AutoCloseable
.createClient
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
clientConfig
- The configuration to use when constructing the client.public org.elasticsearch.action.bulk.BulkProcessor.Builder createBulkProcessorBuilder(org.elasticsearch.client.transport.TransportClient client, org.elasticsearch.action.bulk.BulkProcessor.Listener listener)
ElasticsearchApiCallBridge
BulkProcessor.Builder
for creating the bulk processor.createBulkProcessorBuilder
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
client
- the Elasticsearch client.listener
- the bulk processor listender.public Throwable extractFailureCauseFromBulkItemResponse(org.elasticsearch.action.bulk.BulkItemResponse bulkItemResponse)
ElasticsearchApiCallBridge
extractFailureCauseFromBulkItemResponse
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
bulkItemResponse
- the bulk item response to extract cause of failureThrowable
from the response (null
is the response is successful).public void configureBulkProcessorBackoff(org.elasticsearch.action.bulk.BulkProcessor.Builder builder, @Nullable ElasticsearchSinkBase.BulkFlushBackoffPolicy flushBackoffPolicy)
ElasticsearchApiCallBridge
BulkProcessor.Builder
.
The builder will be later on used to instantiate the actual BulkProcessor
.configureBulkProcessorBackoff
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
builder
- the BulkProcessor.Builder
to configure.flushBackoffPolicy
- user-provided backoff retry settings (null
if the user disabled backoff retries).public void verifyClientConnection(org.elasticsearch.client.transport.TransportClient client)
ElasticsearchApiCallBridge
Called by ElasticsearchSinkBase.open(org.apache.flink.configuration.Configuration)
after creating the client. This makes sure the underlying
client is closed if the connection is not successful and preventing thread leak.
verifyClientConnection
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.transport.TransportClient>
client
- the Elasticsearch client.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.