Drop support for auto-configuring an embedded Elasticsearch node

Elastic have announced [1] that embedded Elasticsearch is no longer
supported. This commit brings us into line with that announcement by
removing the auto-configuration that would create an Elasticsearch
Node and NodeClient.

To use the Elasticsearch auto-configuration, a user must now provide
the address of one or more cluster nodes
(via the spring.elastisearch.cluster-nodes property) which will then
be used to create a TransportClient.

See gh-9374

[1] https://www.elastic.co/blog/elasticsearch-the-server
This commit is contained in:
Andy Wilkinson
2017-06-15 16:29:46 +01:00
parent dbabfc224c
commit 4a030d5a7a
13 changed files with 268 additions and 354 deletions

View File

@@ -3712,19 +3712,10 @@ To take full control over the registration, define a `JestClient` bean.
[[boot-features-connecting-to-elasticsearch-spring-data]]
==== Connecting to Elasticsearch using Spring Data
You can inject an auto-configured `ElasticsearchTemplate` or Elasticsearch `Client`
instance as you would any other Spring Bean. By default the instance will embed a
local in-memory server (a `Node` in Elasticsearch terms) and use the current working
directory as the home directory for the server. In this setup, the first thing to do
is to tell Elasticsearch where to store its files:
[source,properties,indent=0]
----
spring.data.elasticsearch.properties.path.home=/foo/bar
----
Alternatively, you can switch to a remote server (i.e. a `TransportClient`) by setting
`spring.data.elasticsearch.cluster-nodes` to a comma-separated '`host:port`' list.
To connect to Elasticsearch you must provide the address of one or more cluster nodes.
The address can be specified by setting the `spring.data.elasticsearch.cluster-nodes`
property to a comma-separated '`host:port`' list. With this configuration in place, an
`ElasticsearchTemplate` or `TransportClient` can be injected like any other Spring bean:
[source,properties,indent=0]
----
@@ -3736,9 +3727,8 @@ Alternatively, you can switch to a remote server (i.e. a `TransportClient`) by s
@Component
public class MyBean {
private ElasticsearchTemplate template;
private final ElasticsearchTemplate template;
@Autowired
public MyBean(ElasticsearchTemplate template) {
this.template = template;
}
@@ -3748,8 +3738,8 @@ Alternatively, you can switch to a remote server (i.e. a `TransportClient`) by s
}
----
If you add a `@Bean` of your own of type `ElasticsearchTemplate` it will replace the
default.
If you add your own `ElasticsearchTemplate` or `TransportClient` `@Bean` it will
replace the default.