public final class ElasticClients extends Object
RestClientBuilder
Supposed to be used as a parameter to ElasticSourceBuilder.clientFn(SupplierEx)
and ElasticSinkBuilder.clientFn(SupplierEx)
, for example:
builder.clientFn(() -> client());
Modifier and Type | Method and Description |
---|---|
static org.elasticsearch.client.RestClientBuilder |
client()
Create Elastic client for an instance running on localhost
on default port (9200)
|
static org.elasticsearch.client.RestClientBuilder |
client(String location)
Convenience method to create
RestClientBuilder with given string, it must contain host, and optionally
the scheme and a port. |
static org.elasticsearch.client.RestClientBuilder |
client(String hostname,
int port)
Convenience method to create
RestClientBuilder with given
hostname and port |
static org.elasticsearch.client.RestClientBuilder |
client(String username,
String password,
String hostname,
int port)
Convenience method to create
RestClientBuilder with basic authentication
and given hostname and port |
@Nonnull public static org.elasticsearch.client.RestClientBuilder client()
@Nonnull public static org.elasticsearch.client.RestClientBuilder client(@Nonnull String location)
RestClientBuilder
with given string, it must contain host, and optionally
the scheme and a port.
Valid examples:
elastic-host
elastic-host:9200
http://elastic-host:9200
HttpHost.create(String)
@Nonnull public static org.elasticsearch.client.RestClientBuilder client(@Nonnull String hostname, int port)
RestClientBuilder
with given
hostname and port@Nonnull public static org.elasticsearch.client.RestClientBuilder client(@Nonnull String username, @Nonnull String password, @Nonnull String hostname, int port)
RestClientBuilder
with basic authentication
and given hostname and port
Usage:
BatchSource<SearchHit> source = elastic(() -> client("user", "password", "host", 9200));
Copyright © 2023 Hazelcast, Inc.. All rights reserved.