Skip to content

Commit b354244

Browse files
committed
Deprecate Elasticsearch transport and Jest clients
As of Spring Data Moore, the Elasticsearch high level REST client is supported for Spring Data repositories. The transport client is now deprecated and is likely to be removed in a future Spring Data release. This commit deprecates the transport client and marks all the associated configuration properties as deprecated. The Spring Boot starter depends on the `spring-data-elasticsearch` project, which now depends on both transport client and high level REST client. This commit also deprecates the Jest client, as Spring Boot will focus on supporting the high level REST client and the reactive client provided by Spring Data - both being in sync with the fast release pace of Elasticsearch. Closes gh-15008
1 parent fe9da06 commit b354244

File tree

4 files changed

+42
-7
lines changed

4 files changed

+42
-7
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/elasticsearch/ElasticsearchAutoConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,14 @@
3737
* @author Mohsin Husen
3838
* @author Andy Wilkinson
3939
* @since 1.1.0
40+
* @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients
4041
*/
4142
@Configuration(proxyBeanMethods = false)
4243
@ConditionalOnClass({ Client.class, TransportClientFactoryBean.class })
4344
@ConditionalOnProperty(prefix = "spring.data.elasticsearch", name = "cluster-nodes",
4445
matchIfMissing = false)
4546
@EnableConfigurationProperties(ElasticsearchProperties.class)
47+
@Deprecated
4648
public class ElasticsearchAutoConfiguration {
4749

4850
private final ElasticsearchProperties properties;

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/elasticsearch/jest/JestAutoConfiguration.java

+2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,13 @@
4242
*
4343
* @author Stephane Nicoll
4444
* @since 1.4.0
45+
* @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients
4546
*/
4647
@Configuration(proxyBeanMethods = false)
4748
@ConditionalOnClass(JestClient.class)
4849
@EnableConfigurationProperties(JestProperties.class)
4950
@AutoConfigureAfter(GsonAutoConfiguration.class)
51+
@Deprecated
5052
public class JestAutoConfiguration {
5153

5254
@Bean(destroyMethod = "shutdownClient")

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json

+28-1
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,30 @@
305305
"level": "error"
306306
}
307307
},
308+
{
309+
"name": "spring.data.elasticsearch.cluster-name",
310+
"type": "java.lang.String",
311+
"description": "Elasticsearch cluster name.",
312+
"deprecation": {
313+
"reason": "The transport client support is deprecated. Use other supported clients instead."
314+
}
315+
},
316+
{
317+
"name": "spring.data.elasticsearch.cluster-nodes",
318+
"type": "java.lang.String",
319+
"description": "Comma-separated list of cluster node addresses.",
320+
"deprecation": {
321+
"reason": "The transport client support is deprecated. Use other supported clients instead."
322+
}
323+
},
324+
{
325+
"name": "spring.data.elasticsearch.properties",
326+
"type": "java.util.Map<java.lang.String,java.lang.String>",
327+
"description": "Additional properties used to configure the client.",
328+
"deprecation": {
329+
"reason": "The transport client support is deprecated. Use other supported clients instead."
330+
}
331+
},
308332
{
309333
"name": "spring.data.elasticsearch.repositories.enabled",
310334
"type": "java.lang.Boolean",
@@ -389,7 +413,10 @@
389413
"name": "spring.elasticsearch.jest.uris",
390414
"defaultValue": [
391415
"http://localhost:9200"
392-
]
416+
],
417+
"deprecation": {
418+
"reason": "The Jest client support is deprecated. Use other supported clients instead."
419+
}
393420
},
394421
{
395422
"name": "spring.elasticsearch.rest.uris",

Diff for: spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

+10-6
Original file line numberDiff line numberDiff line change
@@ -4782,17 +4782,18 @@ https://www.elastic.co/products/elasticsearch[Elasticsearch] is an open source,
47824782
distributed, RESTful search and analytics engine. Spring Boot offers basic
47834783
auto-configuration for Elasticsearch.
47844784

4785-
Spring Boot supports several HTTP clients:
4785+
Spring Boot supports several clients:
47864786

47874787
* The official Java "Low Level" and "High Level" REST clients
47884788
* https://github.com/searchbox-io/Jest[Jest]
47894789

4790-
The transport client is still being used by
4791-
https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch],
4792-
which you can start using with the `spring-boot-starter-data-elasticsearch` "`Starter`".
4790+
The transport client is still available but its support has been deprecated in
4791+
https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch]
4792+
and will be removed in a future release. Spring Boot provides a dedicated "`Starter`",
4793+
`spring-boot-starter-data-elasticsearch`.
47934794

47944795
[[boot-features-connecting-to-elasticsearch-rest]]
4795-
==== Connecting to Elasticsearch by REST clients
4796+
==== Connecting to Elasticsearch using REST clients
47964797
Elasticsearch ships
47974798
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html[two different REST clients]
47984799
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.
48194820

48204821

48214822
[[boot-features-connecting-to-elasticsearch-jest]]
4822-
==== Connecting to Elasticsearch by Using Jest
4823+
==== Connecting to Elasticsearch using Jest
4824+
Now that Spring Boot supports the official `RestHighLevelClient`, Jest support is
4825+
deprecated.
4826+
48234827
If you have `Jest` on the classpath, you can inject an auto-configured `JestClient` that
48244828
by default targets `http://localhost:9200`. You can further tune how the client is
48254829
configured, as shown in the following example:

0 commit comments

Comments
 (0)