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
FieldsModifier and TypeFieldDescriptionprotected org.apache.http.impl.nio.client.HttpAsyncClientBuilderprotected org.apache.http.client.config.RequestConfig.BuilderThe default request configurations. -
Constructor Summary
Constructors -
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.HttpAsyncClientBuilderThe http client configuration (e.g.org.apache.http.HttpHost[]The one or more hosts that the client will communicate with, provided as instances ofHttpHost.intThe timeout that should be honoured in case multiple attempts are made for the same request.org.elasticsearch.client.NodeSelectorThe 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.BuildervoidsetDefaultHeaders(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 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: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
-