From 562627fb42b845739f7d5ec45da9448855928dcc Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Tue, 12 Apr 2022 21:42:38 +0100 Subject: [PATCH] Deprecate auto-configuration for RestHighLevelClient Closes gh-28598 --- .../elasticsearch/ElasticsearchRestHealthIndicator.java | 9 ++++++++- .../spring-boot-docs/src/docs/asciidoc/data/nosql.adoc | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java index 468f235c3b..57c9235d1d 100644 --- a/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java +++ b/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchRestHealthIndicator.java @@ -49,7 +49,14 @@ public class ElasticsearchRestHealthIndicator extends AbstractHealthIndicator { private final JsonParser jsonParser; - @SuppressWarnings("deprecation") + /** + * Create a new {@code ElasticsearchRestHealthIndicator} using the {@link RestClient} + * obtained from the given high-level client. + * @param client the high-level client + * @deprecated since 2.7.0 for removal in 2.9.0 in favor of + * {@link #ElasticsearchRestHealthIndicator(RestClient)} + */ + @Deprecated public ElasticsearchRestHealthIndicator(org.elasticsearch.client.RestHighLevelClient client) { this(client.getLowLevelClient()); } diff --git a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc index 122a91afe9..10f8d029ed 100644 --- a/spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc +++ b/spring-boot-project/spring-boot-docs/src/docs/asciidoc/data/nosql.adoc @@ -270,7 +270,8 @@ You can use `spring.elasticsearch.*` properties to further tune how the clients [[data.nosql.elasticsearch.connecting-using-rest.restclient]] ===== Connecting to Elasticsearch using RestClient If you have `elasticsearch-rest-client` on the classpath, Spring Boot will auto-configure and register a `RestClient` bean. -If you have `elasticsearch-rest-high-level-client` on the classpath a `RestHighLevelClient` bean will be registered as well. +If you have `elasticsearch-rest-high-level-client` on the classpath a `RestHighLevelClient` bean will be auto-configured as well. +Following Elasticsearch's deprecation of `RestHighLevelClient`, its auto-configuration is deprecated and will be removed in a future release. In addition to the properties described previously, to fine-tune the `RestClient` and `RestHighLevelClient`, you can register an arbitrary number of beans that implement `RestClientBuilderCustomizer` for more advanced customizations. To take full control over the clients' configuration, define a `RestClientBuilder` bean.