Skip to content

Commit 4bb7b5e

Browse files
committed
DATAES-495 - Deprecate TransportClient support.
Original PR: spring-projects#306
1 parent 165e02d commit 4bb7b5e

File tree

6 files changed

+30
-14
lines changed

6 files changed

+30
-14
lines changed

README.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This project is lead and maintained by the community.
1111
== Features
1212

1313
* Spring configuration support using Java based `@Configuration` classes or an XML namespace for a ES clients instances.
14-
* `ElasticsearchTemplate` helper class that increases productivity performing common ES operations. Includes integrated object mapping between documents and POJOs.
14+
* `ElasticsearchRestTemplate` helper class that increases productivity performing common ES operations. Includes integrated object mapping between documents and POJOs.
1515
* Feature Rich Object Mapping integrated with Spring’s Conversion Service
1616
* Annotation based mapping metadata but extensible to support other metadata formats
1717
* Automatic implementation of `Repository` interfaces including support for custom finder methods.
@@ -60,6 +60,9 @@ public class MyService {
6060

6161
Using Node Client
6262

63+
NOTE: Usage of the Node Client is deprecated as of version 4.0, use RestClient instead.
64+
65+
6366
[source,xml]
6467
----
6568
<?xml version="1.0" encoding="UTF-8"?>
@@ -80,6 +83,9 @@ Using Node Client
8083

8184
Using Transport Client
8285

86+
NOTE: Usage of the Transport Client is deprecated as of version 4.0, use RestClient instead.
87+
88+
8389
[source,xml]
8490
----
8591
<?xml version="1.0" encoding="UTF-8"?>

src/main/asciidoc/reference/elasticsearch-operations.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The default implementations of the interfaces offer:
1212
[[elasticsearch.operations.template]]
1313
== ElasticsearchTemplate
1414

15+
NOTE: Usage of the ElasticsearchTemplate is deprecated as of version 4.0, use ElasticsearchRestTemplate instead.
16+
1517
The `ElasticsearchTemplate` is an implementation of the `ElasticsearchOperations` interface using the <<elasticsearch.clients.transport>>.
1618

1719
.ElasticsearchTemplate configuration
@@ -45,7 +47,7 @@ public class TransportClientConfig extends ElasticsearchConfigurationSupport {
4547
}
4648
}
4749
----
48-
<1> Setting up the <<elasticsearch.clients.transport>>.
50+
<1> Setting up the <<elasticsearch.clients.transport>>. Deprecatedas of version 4.0.
4951
<2> Creating the `ElasticsearchTemplate` bean, offering both names, _elasticsearchOperations_ and _elasticsearchTemplate_.
5052
<3> Using the <<elasticsearch.mapping.meta-model>> ElasticsearchMapper.
5153
====

src/main/java/org/springframework/data/elasticsearch/client/TransportClientFactoryBean.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
* @author Piotr Betkier
3636
* @author Ilkang Na
3737
* @author Oliver Gierke
38+
* @author Peter-Josef Meisch
39+
* @deprecated as of 4.0
3840
*/
41+
@Deprecated
3942
public class TransportClientFactoryBean implements FactoryBean<TransportClient>, InitializingBean, DisposableBean {
4043

4144
private static final Logger logger = LoggerFactory.getLogger(TransportClientFactoryBean.class);
@@ -101,13 +104,10 @@ private Settings settings() {
101104

102105
return builder.build();
103106
}
104-
return Settings.builder()
105-
.put("cluster.name", clusterName)
106-
.put("client.transport.sniff", clientTransportSniff)
107+
return Settings.builder().put("cluster.name", clusterName).put("client.transport.sniff", clientTransportSniff)
107108
.put("client.transport.ignore_cluster_name", clientIgnoreClusterName)
108109
.put("client.transport.ping_timeout", clientPingTimeout)
109-
.put("client.transport.nodes_sampler_interval", clientNodesSamplerInterval)
110-
.build();
110+
.put("client.transport.nodes_sampler_interval", clientNodesSamplerInterval).build();
111111
}
112112

113113
public void setClusterNodes(String clusterNodes) {

src/main/java/org/springframework/data/elasticsearch/config/TransportClientBeanDefinitionParser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
*
2828
* @author Rizwan Idrees
2929
* @author Mohsin Husen
30+
* @deprecated as of 4.0
3031
*/
31-
32+
@Deprecated
3233
public class TransportClientBeanDefinitionParser extends AbstractBeanDefinitionParser {
3334

3435
@Override

src/main/java/org/springframework/data/elasticsearch/core/ElasticsearchTemplate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@
124124
* @author Martin Choraine
125125
* @author Farid Azaza
126126
* @author Gyula Attila Csorogi
127+
* @deprecated as of 4.0
127128
*/
128-
public class ElasticsearchTemplate extends AbstractElasticsearchTemplate
129-
implements ElasticsearchOperations, EsClient<Client>, ApplicationContextAware {
129+
@Deprecated
130+
public class ElasticsearchTemplate extends AbstractElasticsearchTemplate implements ElasticsearchOperations, EsClient<Client>, ApplicationContextAware {
130131

131132
private static final Logger QUERY_LOGGER = LoggerFactory
132133
.getLogger("org.springframework.data.elasticsearch.core.QUERY");

src/main/java/org/springframework/data/elasticsearch/repository/config/EnableElasticsearchRepositories.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@
1515
*/
1616
package org.springframework.data.elasticsearch.repository.config;
1717

18-
import java.lang.annotation.*;
18+
import java.lang.annotation.Documented;
19+
import java.lang.annotation.ElementType;
20+
import java.lang.annotation.Inherited;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
1924

2025
import org.springframework.context.annotation.ComponentScan.Filter;
2126
import org.springframework.context.annotation.Import;
22-
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
2327
import org.springframework.data.elasticsearch.repository.support.ElasticsearchRepositoryFactoryBean;
2428
import org.springframework.data.repository.config.DefaultRepositoryBaseClass;
2529
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
@@ -31,6 +35,7 @@
3135
* @author Rizwan Idrees
3236
* @author Mohsin Husen
3337
* @author Kevin Leturc
38+
* @author Peter-Josef Meisch
3439
*/
3540
@Target(ElementType.TYPE)
3641
@Retention(RetentionPolicy.RUNTIME)
@@ -114,8 +119,9 @@
114119
// Elasticsearch specific configuration
115120

116121
/**
117-
* Configures the name of the {@link ElasticsearchTemplate} bean definition to be used to create repositories
118-
* discovered through this annotation. Defaults to {@code elasticsearchTemplate}.
122+
* Configures the name of the {@link org.springframework.data.elasticsearch.core.ElasticsearchOperations} bean
123+
* definition to be used to create repositories discovered through this annotation. Defaults to
124+
* {@code elasticsearchTemplate}.
119125
*
120126
* @return
121127
*/

0 commit comments

Comments
 (0)