Interface ClientConfiguration
public interface ClientConfiguration
Configuration interface exposing common client configuration properties for Elasticsearch clients.
- Since:
- 3.2
- Author:
- Mark Paluch, Peter-Josef Meisch, Huw Ayling-Miller, Henrique Amaral
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
static interface
Callback to be executed to configure a client.static interface
static interface
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a newClientConfigurationBuilder
instance.static ClientConfiguration
Creates a newClientConfiguration
instance configured to a single host givenhostAndPort
.static ClientConfiguration
create
(InetSocketAddress socketAddress) Creates a newClientConfiguration
instance configured to a single host givenInetSocketAddress
.Returns theconnect timeout
.Obtain theHttpHeaders
to be used by default.Returns the configured endpoints.Returns theHostnameVerifier
to use.Returns the path prefix that should be prepended to HTTP(s) requests for Elasticsearch behind a proxy.getProxy()
returns an optionally set proxy in the form host:portReturns thesocket timeout
which is typically applied as SO-timeout/read timeout.Returns theSSLContext
to use.static ClientConfiguration
Creates a newClientConfiguration
instance configured to localhost.boolean
useSsl()
Returns true when the client should use SSL.
-
Method Details
-
builder
Creates a newClientConfigurationBuilder
instance.- Returns:
- a new
ClientConfigurationBuilder
instance.
-
localhost
Creates a newClientConfiguration
instance configured to localhost.// "localhost:9200" ClientConfiguration configuration = ClientConfiguration.localhost();
- Returns:
- a new
ClientConfiguration
instance - See Also:
-
create
Creates a newClientConfiguration
instance configured to a single host givenhostAndPort
. For example given the endpoint http://localhost:9200ClientConfiguration configuration = ClientConfiguration.create("localhost:9200");
- Returns:
- a new
ClientConfigurationBuilder
instance.
-
create
Creates a newClientConfiguration
instance configured to a single host givenInetSocketAddress
. For example given the endpoint http://localhost:9200ClientConfiguration configuration = ClientConfiguration .create(InetSocketAddress.createUnresolved("localhost", 9200));
- Returns:
- a new
ClientConfigurationBuilder
instance.
-
getEndpoints
List<InetSocketAddress> getEndpoints()Returns the configured endpoints.- Returns:
- the configured endpoints.
-
getDefaultHeaders
HttpHeaders getDefaultHeaders()Obtain theHttpHeaders
to be used by default.- Returns:
- the
HttpHeaders
to be used by default.
-
useSsl
boolean useSsl()Returns true when the client should use SSL.- Returns:
- true when the client should use SSL.
-
getSslContext
Optional<SSLContext> getSslContext()Returns theSSLContext
to use. Can beOptional.empty()
if not configured.- Returns:
- the
SSLContext
to use. Can beOptional.empty()
if not configured.
-
getCaFingerprint
- Returns:
- the optional SHA-256 fingerprint of the self-signed http_ca.crt certificate output by Elasticsearch at startup time.
-
getHostNameVerifier
Optional<HostnameVerifier> getHostNameVerifier()Returns theHostnameVerifier
to use. Can beOptional.empty()
if not configured.- Returns:
- the
HostnameVerifier
to use. Can beOptional.empty()
if not configured.
-
getConnectTimeout
Duration getConnectTimeout()Returns theconnect timeout
.- See Also:
-
getSocketTimeout
Duration getSocketTimeout()Returns thesocket timeout
which is typically applied as SO-timeout/read timeout.- See Also:
-
getPathPrefix
Returns the path prefix that should be prepended to HTTP(s) requests for Elasticsearch behind a proxy.- Returns:
- the path prefix.
- Since:
- 4.0
-
getProxy
returns an optionally set proxy in the form host:port- Returns:
- the optional proxy
- Since:
- 4.0
-
getClientConfigurers
- Returns:
- the client configuration callbacks
- Since:
- 4.3
-
getHeadersSupplier
Supplier<HttpHeaders> getHeadersSupplier()- Returns:
- the supplier for custom headers.
-