Package io.micronaut.elasticsearch
Class DefaultElasticsearchConfigurationProperties
java.lang.Object
io.micronaut.elasticsearch.DefaultElasticsearchConfigurationProperties
- All Implemented Interfaces:
DefaultElasticsearchConfiguration
@Requires(classes=org.elasticsearch.client.RestClientBuilder.class)
@ConfigurationProperties("elasticsearch")
public class DefaultElasticsearchConfigurationProperties
extends Object
implements DefaultElasticsearchConfiguration
Default configurations for Elasticsearch.
- Since:
- 1.0.0
- Author:
- lishuai, Puneet Behl
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.apache.http.impl.nio.client.HttpAsyncClientBuilder
protected org.apache.http.client.config.RequestConfig.Builder
The default request configurations. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionorg.apache.http.Header[]
The default headers that need to be sent with each request, to prevent having to specify them with each single request.org.apache.http.impl.nio.client.HttpAsyncClientBuilder
The http client configuration (e.g.org.apache.http.HttpHost[]
The one or more hosts that the client will communicate with, provided as instances ofHttpHost
.int
The timeout that should be honoured in case multiple attempts are made for the same request.org.elasticsearch.client.NodeSelector
The node selector to be used to filter the nodes the client will send requests to among the ones that are set to the client itself.org.apache.http.client.config.RequestConfig.Builder
void
setDefaultHeaders
(org.apache.http.Header[] defaultHeaders) void
setHttpAsyncClientBuilder
(org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder) void
setHttpHosts
(org.apache.http.HttpHost[] httpHosts) void
setMaxRetryTimeoutMillis
(int maxRetryTimeoutMillis) void
setNodeSelector
(org.elasticsearch.client.NodeSelector nodeSelector)
-
Field Details
-
httpAsyncClientBuilder
protected org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder -
requestConfigBuilder
@ConfigurationBuilder(configurationPrefix="request.default") protected org.apache.http.client.config.RequestConfig.Builder requestConfigBuilderThe default request configurations.
-
-
Constructor Details
-
DefaultElasticsearchConfigurationProperties
public DefaultElasticsearchConfigurationProperties()
-
-
Method Details
-
getHttpHosts
public org.apache.http.HttpHost[] getHttpHosts()Description copied from interface:DefaultElasticsearchConfiguration
The one or more hosts that the client will communicate with, provided as instances ofHttpHost
.- Specified by:
getHttpHosts
in interfaceDefaultElasticsearchConfiguration
- Returns:
- An array of
HttpHost
-
getDefaultHeaders
public org.apache.http.Header[] getDefaultHeaders()Description copied from interface:DefaultElasticsearchConfiguration
The default headers that need to be sent with each request, to prevent having to specify them with each single request.- Specified by:
getDefaultHeaders
in interfaceDefaultElasticsearchConfiguration
- Returns:
- An array of
Header
.
-
getMaxRetryTimeoutMillis
public int getMaxRetryTimeoutMillis()Description copied from interface:DefaultElasticsearchConfiguration
The timeout that should be honoured in case multiple attempts are made for the same request. The default value is 30 seconds.- Specified by:
getMaxRetryTimeoutMillis
in interfaceDefaultElasticsearchConfiguration
- Returns:
- The maximum retry timeout in millis.
-
getNodeSelector
public org.elasticsearch.client.NodeSelector getNodeSelector()Description copied from interface:DefaultElasticsearchConfiguration
The node selector to be used to filter the nodes the client will send requests to among the ones that are set to the client itself. By default the client sends requests to every configured node.- Specified by:
getNodeSelector
in interfaceDefaultElasticsearchConfiguration
- Returns:
- The
NodeSelector
to be used.
-
getRequestConfigBuilder
public org.apache.http.client.config.RequestConfig.Builder getRequestConfigBuilder()- Specified by:
getRequestConfigBuilder
in interfaceDefaultElasticsearchConfiguration
- Returns:
- The builder to create default request configurations.
-
getHttpAsyncClientBuilder
public org.apache.http.impl.nio.client.HttpAsyncClientBuilder getHttpAsyncClientBuilder()Description copied from interface:DefaultElasticsearchConfiguration
The http client configuration (e.g. encrypted communication over ssl, or anything that theHttpAsyncClientBuilder
allows to set).- Specified by:
getHttpAsyncClientBuilder
in interfaceDefaultElasticsearchConfiguration
- Returns:
- The
HttpAsyncClientBuilder
bean
-
setHttpHosts
public void setHttpHosts(org.apache.http.HttpHost[] httpHosts) - Parameters:
httpHosts
- One or more hosts that client will connect to.
-
setDefaultHeaders
public void setDefaultHeaders(org.apache.http.Header[] defaultHeaders) - Parameters:
defaultHeaders
- The defaultsHeader
to sent with each request.
-
setMaxRetryTimeoutMillis
public void setMaxRetryTimeoutMillis(int maxRetryTimeoutMillis) - Parameters:
maxRetryTimeoutMillis
- The maximum retry timeout in millis.
-
setNodeSelector
public void setNodeSelector(org.elasticsearch.client.NodeSelector nodeSelector) - Parameters:
nodeSelector
- TheNodeSelector
to be used, in case of multiple nodes.
-
setHttpAsyncClientBuilder
@Inject public void setHttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder) - Parameters:
httpAsyncClientBuilder
- TheHttpAsyncClientBuilder
bean
-