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.Deprecated, for removal: This API element is subject to removal in a future version.since 6.0@Nullable StringReturns 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
-
getHostNameVerifier
Deprecated, for removal: This API element is subject to removal in a future version.since 6.0Returns theHostnameVerifierto use. Must beOptional.empty()if not configured. Cannot be used with the Rest5Client used from Elasticsearch 9 on as the underlying Apache http components 5 does not offer a way to set this. Users that need a hostname verifier must integrate this in a SSLContext. Returning a value here is ignored in this case- Returns:
- the
HostnameVerifierto use. Can beOptional.empty()if not configured.
-
getConnectTimeout
-
getSocketTimeout
Duration getSocketTimeout()Returns thesocket timeoutwhich is typically applied as SO-timeout/read timeout.- See Also:
-
getPathPrefix
@Nullable String 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
-
getClientConfigurers
- Returns:
- the client configuration callbacks
- Since:
- 4.3
-
getHeadersSupplier
Supplier<HttpHeaders> getHeadersSupplier()- Returns:
- the supplier for custom headers.
-