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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfaceCallback to be executed to configure a client.static interfacestatic interface -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Creates a newClientConfigurationBuilderinstance.static ClientConfigurationCreates a newClientConfigurationinstance configured to a single host givenhostAndPort.static ClientConfigurationcreate(InetSocketAddress socketAddress) Creates a newClientConfigurationinstance configured to a single host givenInetSocketAddress.Returns theconnect timeout.Obtain theHttpHeadersto be used by default.Returns the configured endpoints.Returns theHostnameVerifierto 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 timeoutwhich is typically applied as SO-timeout/read timeout.Returns theSSLContextto use.static ClientConfigurationCreates a newClientConfigurationinstance configured to localhost.booleanuseSsl()Returns true when the client should use SSL.
-
Method Details
-
builder
Creates a newClientConfigurationBuilderinstance.- Returns:
- a new
ClientConfigurationBuilderinstance.
-
localhost
Creates a newClientConfigurationinstance configured to localhost.// "localhost:9200" ClientConfiguration configuration = ClientConfiguration.localhost();
- Returns:
- a new
ClientConfigurationinstance - See Also:
-
create
Creates a newClientConfigurationinstance configured to a single host givenhostAndPort. For example given the endpoint http://localhost:9200ClientConfiguration configuration = ClientConfiguration.create("localhost:9200");- Returns:
- a new
ClientConfigurationBuilderinstance.
-
create
Creates a newClientConfigurationinstance configured to a single host givenInetSocketAddress. For example given the endpoint http://localhost:9200ClientConfiguration configuration = ClientConfiguration .create(InetSocketAddress.createUnresolved("localhost", 9200));- Returns:
- a new
ClientConfigurationBuilderinstance.
-
getEndpoints
List<InetSocketAddress> getEndpoints()Returns the configured endpoints.- Returns:
- the configured endpoints.
-
getDefaultHeaders
HttpHeaders getDefaultHeaders()Obtain theHttpHeadersto be used by default.- Returns:
- the
HttpHeadersto 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 theSSLContextto use. Can beOptional.empty()if not configured.- Returns:
- the
SSLContextto 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 theHostnameVerifierto use. Can beOptional.empty()if not configured.- Returns:
- the
HostnameVerifierto use. Can beOptional.empty()if not configured.
-
getConnectTimeout
Duration getConnectTimeout()Returns theconnect timeout.- See Also:
-
Socket.connect(SocketAddress, int)ChannelOption.CONNECT_TIMEOUT_MILLIS
-
getSocketTimeout
Duration getSocketTimeout()Returns thesocket timeoutwhich is typically applied as SO-timeout/read timeout.- See Also:
-
Socket.setSoTimeout(int)ReadTimeoutHandlerWriteTimeoutHandler
-
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.
-