Auto-configure Elasticsearch REST client in Spring Data

This commit auto-configures the Elasticsearch REST client support
as a template for Spring Data Elasticsearch. As of this commit,
using the transport client is still possible but developers
should migrate.

This commit also removes the deprecated annotation on the
Elasticsearch auto-configuration for the transport client, since
this deprecation notice is already present on the configuration
property.

Closes gh-17024
Closes gh-16542
This commit is contained in:
Brian Clozel
2019-06-03 21:20:06 +02:00
parent ae5b5be597
commit c74badd4f2
9 changed files with 216 additions and 153 deletions

View File

@@ -16,7 +16,8 @@
package sample.data.elasticsearch;
import org.elasticsearch.client.transport.NoNodeAvailableException;
import java.net.ConnectException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -51,7 +52,7 @@ class SampleElasticsearchApplicationTests {
private boolean elasticsearchRunning(Exception ex) {
Throwable candidate = ex;
while (candidate != null) {
if (candidate instanceof NoNodeAvailableException) {
if (candidate instanceof ConnectException) {
return false;
}
candidate = candidate.getCause();