diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java index d1c24fa78cc..ec72161790f 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java @@ -37,12 +37,14 @@ import org.springframework.data.elasticsearch.client.TransportClientFactoryBean; * @author Mohsin Husen * @author Andy Wilkinson * @since 1.1.0 + * @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass({ Client.class, TransportClientFactoryBean.class }) @ConditionalOnProperty(prefix = "spring.data.elasticsearch", name = "cluster-nodes", matchIfMissing = false) @EnableConfigurationProperties(ElasticsearchProperties.class) +@Deprecated public class ElasticsearchAutoConfiguration { private final ElasticsearchProperties properties; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java index a2ffc2c6719..02f628781cd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java @@ -42,11 +42,13 @@ import org.springframework.util.Assert; * * @author Stephane Nicoll * @since 1.4.0 + * @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients */ @Configuration(proxyBeanMethods = false) @ConditionalOnClass(JestClient.class) @EnableConfigurationProperties(JestProperties.class) @AutoConfigureAfter(GsonAutoConfiguration.class) +@Deprecated public class JestAutoConfiguration { @Bean(destroyMethod = "shutdownClient") diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 19f06f3c521..14b067436d1 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -305,6 +305,30 @@ "level": "error" } }, + { + "name": "spring.data.elasticsearch.cluster-name", + "type": "java.lang.String", + "description": "Elasticsearch cluster name.", + "deprecation": { + "reason": "The transport client support is deprecated. Use other supported clients instead." + } + }, + { + "name": "spring.data.elasticsearch.cluster-nodes", + "type": "java.lang.String", + "description": "Comma-separated list of cluster node addresses.", + "deprecation": { + "reason": "The transport client support is deprecated. Use other supported clients instead." + } + }, + { + "name": "spring.data.elasticsearch.properties", + "type": "java.util.Map", + "description": "Additional properties used to configure the client.", + "deprecation": { + "reason": "The transport client support is deprecated. Use other supported clients instead." + } + }, { "name": "spring.data.elasticsearch.repositories.enabled", "type": "java.lang.Boolean", @@ -389,7 +413,10 @@ "name": "spring.elasticsearch.jest.uris", "defaultValue": [ "http://localhost:9200" - ] + ], + "deprecation": { + "reason": "The Jest client support is deprecated. Use other supported clients instead." + } }, { "name": "spring.elasticsearch.rest.uris", diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index 6bca9b34429..f8f20bf183a 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -4782,17 +4782,18 @@ https://www.elastic.co/products/elasticsearch[Elasticsearch] is an open source, distributed, RESTful search and analytics engine. Spring Boot offers basic auto-configuration for Elasticsearch. -Spring Boot supports several HTTP clients: +Spring Boot supports several clients: * The official Java "Low Level" and "High Level" REST clients * https://github.com/searchbox-io/Jest[Jest] -The transport client is still being used by -https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch], -which you can start using with the `spring-boot-starter-data-elasticsearch` "`Starter`". +The transport client is still available but its support has been deprecated in +https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch] +and will be removed in a future release. Spring Boot provides a dedicated "`Starter`", +`spring-boot-starter-data-elasticsearch`. [[boot-features-connecting-to-elasticsearch-rest]] -==== Connecting to Elasticsearch by REST clients +==== Connecting to Elasticsearch using REST clients Elasticsearch ships https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html[two different REST clients] that you can use to query a cluster: the "Low Level" client and the "High Level" client. @@ -4819,7 +4820,10 @@ any existing `RestClient` bean, reusing its HTTP configuration. [[boot-features-connecting-to-elasticsearch-jest]] -==== Connecting to Elasticsearch by Using Jest +==== Connecting to Elasticsearch using Jest +Now that Spring Boot supports the official `RestHighLevelClient`, Jest support is +deprecated. + If you have `Jest` on the classpath, you can inject an auto-configured `JestClient` that by default targets `http://localhost:9200`. You can further tune how the client is configured, as shown in the following example: