@Internal public class Elasticsearch6ApiCallBridge extends Object implements ElasticsearchApiCallBridge<org.elasticsearch.client.RestHighLevelClient>
ElasticsearchApiCallBridge
for Elasticsearch 6 and later versions.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.RestHighLevelClient client,
org.elasticsearch.action.bulk.BulkProcessor.Listener listener)
Creates a
BulkProcessor.Builder for creating the bulk processor. |
RequestIndexer |
createBulkProcessorIndexer(org.elasticsearch.action.bulk.BulkProcessor bulkProcessor,
boolean flushOnCheckpoint,
AtomicLong numPendingRequestsRef)
Creates a
RequestIndexer that is able to work with BulkProcessor binary
compatible. |
org.elasticsearch.client.RestHighLevelClient |
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.RestHighLevelClient 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
public org.elasticsearch.client.RestHighLevelClient createClient(Map<String,String> clientConfig)
ElasticsearchApiCallBridge
AutoCloseable
.createClient
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.RestHighLevelClient>
clientConfig
- The configuration to use when constructing the client.public org.elasticsearch.action.bulk.BulkProcessor.Builder createBulkProcessorBuilder(org.elasticsearch.client.RestHighLevelClient client, org.elasticsearch.action.bulk.BulkProcessor.Listener listener)
ElasticsearchApiCallBridge
BulkProcessor.Builder
for creating the bulk processor.createBulkProcessorBuilder
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.RestHighLevelClient>
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.RestHighLevelClient>
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.RestHighLevelClient>
builder
- the BulkProcessor.Builder
to configure.flushBackoffPolicy
- user-provided backoff retry settings (null
if the user
disabled backoff retries).public RequestIndexer createBulkProcessorIndexer(org.elasticsearch.action.bulk.BulkProcessor bulkProcessor, boolean flushOnCheckpoint, AtomicLong numPendingRequestsRef)
ElasticsearchApiCallBridge
RequestIndexer
that is able to work with BulkProcessor
binary
compatible.createBulkProcessorIndexer
in interface ElasticsearchApiCallBridge<org.elasticsearch.client.RestHighLevelClient>
public void verifyClientConnection(org.elasticsearch.client.RestHighLevelClient client) throws IOException
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.RestHighLevelClient>
client
- the Elasticsearch client.IOException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.