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 java.lang.Object implements DefaultElasticsearchConfigurationDefault configurations for Elasticsearch.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.http.impl.nio.client.HttpAsyncClientBuilderhttpAsyncClientBuilderprotected org.apache.http.client.config.RequestConfig.BuilderrequestConfigBuilderThe default request configurations.
-
Constructor Summary
Constructors Constructor Description DefaultElasticsearchConfigurationProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.Header[]getDefaultHeaders()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.HttpAsyncClientBuildergetHttpAsyncClientBuilder()The http client configuration (e.g.org.apache.http.HttpHost[]getHttpHosts()The one or more hosts that the client will communicate with, provided as instances ofHttpHost.intgetMaxRetryTimeoutMillis()The timeout that should be honoured in case multiple attempts are made for the same request.org.elasticsearch.client.NodeSelectorgetNodeSelector()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.BuildergetRequestConfigBuilder()voidsetDefaultHeaders(org.apache.http.Header[] defaultHeaders)voidsetHttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder)voidsetHttpHosts(org.apache.http.HttpHost[] httpHosts)voidsetMaxRetryTimeoutMillis(int maxRetryTimeoutMillis)voidsetNodeSelector(org.elasticsearch.client.NodeSelector nodeSelector)
-
-
-
Field Detail
-
httpAsyncClientBuilder
protected org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder
-
requestConfigBuilder
@ConfigurationBuilder(configurationPrefix="request.default") protected org.apache.http.client.config.RequestConfig.Builder requestConfigBuilder
The default request configurations.
-
-
Method Detail
-
getHttpHosts
public org.apache.http.HttpHost[] getHttpHosts()
Description copied from interface:DefaultElasticsearchConfigurationThe one or more hosts that the client will communicate with, provided as instances ofHttpHost.- Specified by:
getHttpHostsin interfaceDefaultElasticsearchConfiguration- Returns:
- An array of
HttpHost
-
getDefaultHeaders
public org.apache.http.Header[] getDefaultHeaders()
Description copied from interface:DefaultElasticsearchConfigurationThe default headers that need to be sent with each request, to prevent having to specify them with each single request.- Specified by:
getDefaultHeadersin interfaceDefaultElasticsearchConfiguration- Returns:
- An array of
Header.
-
getMaxRetryTimeoutMillis
public int getMaxRetryTimeoutMillis()
Description copied from interface:DefaultElasticsearchConfigurationThe timeout that should be honoured in case multiple attempts are made for the same request. The default value is 30 seconds.- Specified by:
getMaxRetryTimeoutMillisin interfaceDefaultElasticsearchConfiguration- Returns:
- The maximum retry timeout in millis.
-
getNodeSelector
public org.elasticsearch.client.NodeSelector getNodeSelector()
Description copied from interface:DefaultElasticsearchConfigurationThe 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:
getNodeSelectorin interfaceDefaultElasticsearchConfiguration- Returns:
- The
NodeSelectorto be used.
-
getRequestConfigBuilder
public org.apache.http.client.config.RequestConfig.Builder getRequestConfigBuilder()
- Specified by:
getRequestConfigBuilderin interfaceDefaultElasticsearchConfiguration- Returns:
- The builder to create default request configurations.
-
getHttpAsyncClientBuilder
public org.apache.http.impl.nio.client.HttpAsyncClientBuilder getHttpAsyncClientBuilder()
Description copied from interface:DefaultElasticsearchConfigurationThe http client configuration (e.g. encrypted communication over ssl, or anything that theHttpAsyncClientBuilderallows to set).- Specified by:
getHttpAsyncClientBuilderin interfaceDefaultElasticsearchConfiguration- Returns:
- The
HttpAsyncClientBuilderbean
-
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 defaultsHeaderto 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- TheNodeSelectorto be used, in case of multiple nodes.
-
setHttpAsyncClientBuilder
@Inject public void setHttpAsyncClientBuilder(org.apache.http.impl.nio.client.HttpAsyncClientBuilder httpAsyncClientBuilder)
- Parameters:
httpAsyncClientBuilder- TheHttpAsyncClientBuilderbean
-
-