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
pull/16575/head
Brian Clozel 6 years ago
parent fe9da06a7e
commit b35424478b

@ -37,12 +37,14 @@ import org.springframework.data.elasticsearch.client.TransportClientFactoryBean;
* @author Mohsin Husen * @author Mohsin Husen
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.1.0 * @since 1.1.0
* @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ Client.class, TransportClientFactoryBean.class }) @ConditionalOnClass({ Client.class, TransportClientFactoryBean.class })
@ConditionalOnProperty(prefix = "spring.data.elasticsearch", name = "cluster-nodes", @ConditionalOnProperty(prefix = "spring.data.elasticsearch", name = "cluster-nodes",
matchIfMissing = false) matchIfMissing = false)
@EnableConfigurationProperties(ElasticsearchProperties.class) @EnableConfigurationProperties(ElasticsearchProperties.class)
@Deprecated
public class ElasticsearchAutoConfiguration { public class ElasticsearchAutoConfiguration {
private final ElasticsearchProperties properties; private final ElasticsearchProperties properties;

@ -42,11 +42,13 @@ import org.springframework.util.Assert;
* *
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.4.0 * @since 1.4.0
* @deprecated since 2.2.0 in favor of other auto-configured Elasticsearch clients
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnClass(JestClient.class) @ConditionalOnClass(JestClient.class)
@EnableConfigurationProperties(JestProperties.class) @EnableConfigurationProperties(JestProperties.class)
@AutoConfigureAfter(GsonAutoConfiguration.class) @AutoConfigureAfter(GsonAutoConfiguration.class)
@Deprecated
public class JestAutoConfiguration { public class JestAutoConfiguration {
@Bean(destroyMethod = "shutdownClient") @Bean(destroyMethod = "shutdownClient")

@ -305,6 +305,30 @@
"level": "error" "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<java.lang.String,java.lang.String>",
"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", "name": "spring.data.elasticsearch.repositories.enabled",
"type": "java.lang.Boolean", "type": "java.lang.Boolean",
@ -389,7 +413,10 @@
"name": "spring.elasticsearch.jest.uris", "name": "spring.elasticsearch.jest.uris",
"defaultValue": [ "defaultValue": [
"http://localhost:9200" "http://localhost:9200"
] ],
"deprecation": {
"reason": "The Jest client support is deprecated. Use other supported clients instead."
}
}, },
{ {
"name": "spring.elasticsearch.rest.uris", "name": "spring.elasticsearch.rest.uris",

@ -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 distributed, RESTful search and analytics engine. Spring Boot offers basic
auto-configuration for Elasticsearch. 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 * The official Java "Low Level" and "High Level" REST clients
* https://github.com/searchbox-io/Jest[Jest] * https://github.com/searchbox-io/Jest[Jest]
The transport client is still being used by The transport client is still available but its support has been deprecated in
https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch], https://github.com/spring-projects/spring-data-elasticsearch[Spring Data Elasticsearch]
which you can start using with the `spring-boot-starter-data-elasticsearch` "`Starter`". 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]] [[boot-features-connecting-to-elasticsearch-rest]]
==== Connecting to Elasticsearch by REST clients ==== Connecting to Elasticsearch using REST clients
Elasticsearch ships Elasticsearch ships
https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/index.html[two different REST clients] 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. 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]] [[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 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 by default targets `http://localhost:9200`. You can further tune how the client is
configured, as shown in the following example: configured, as shown in the following example:

Loading…
Cancel
Save