diff --git a/pom.xml b/pom.xml
index 4264b3b0c..c2046e22e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
3.2.0-SNAPSHOT
- 8.8.2
+ 8.9.0
1.0.8.RELEASE
0.14.4
diff --git a/src/main/asciidoc/preface.adoc b/src/main/asciidoc/preface.adoc
index e4c730d5e..71a51a4f9 100644
--- a/src/main/asciidoc/preface.adoc
+++ b/src/main/asciidoc/preface.adoc
@@ -37,7 +37,7 @@ built and tested.
[cols="^,^,^,^,^",options="header"]
|===
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
-| 2023.1 (Vaughan) | 5.2.x | 8.8.2 | 6.0.x | 3.1.x
+| 2023.1 (Vaughan) | 5.2.x | 8.9.0 | 6.0.x | 3.1.x
| 2023.0 (Ullmann) | 5.1.x | 8.7.1 | 6.0.x | 3.1.x
| 2022.0 (Turing) | 5.0.x | 8.5.3 | 6.0.x | 3.0.x
| 2021.2 (Raj) | 4.4.xfootnote:oom[Out of maintenance] | 7.17.3 | 5.3.x | 2.7.x
diff --git a/src/main/asciidoc/reference/elasticsearch-new.adoc b/src/main/asciidoc/reference/elasticsearch-new.adoc
index 3ebe684f1..e81ecfe4f 100644
--- a/src/main/asciidoc/reference/elasticsearch-new.adoc
+++ b/src/main/asciidoc/reference/elasticsearch-new.adoc
@@ -4,7 +4,7 @@
[[new-features.5-2-0]]
== New in Spring Data Elasticsearch 5.2
-* Upgrade to Elasticsearch 8.8.2
+* Upgrade to Elasticsearch 8.9.0
* The `JsonpMapper` for Elasticsearch is now configurable and provided as bean.
* Improved AOT runtime hints for Elasticsearch client library classes.
* Add Kotlin extensions and repository coroutine support.
diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchClients.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchClients.java
index a9d126303..71f6a43f8 100644
--- a/src/main/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchClients.java
+++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/ElasticsearchClients.java
@@ -34,7 +34,9 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;
-import org.apache.http.*;
+import org.apache.http.HttpHost;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpRequestInterceptor;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.entity.ContentType;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
@@ -261,26 +263,44 @@ private static ElasticsearchTransport getElasticsearchTransport(RestClient restC
TransportOptions.Builder transportOptionsBuilder = transportOptions != null ? transportOptions.toBuilder()
: new RestClientOptions(RequestOptions.DEFAULT).toBuilder();
+ RestClientOptions.Builder restClientOptionsBuilder = getRestClientOptionsBuilder(transportOptions);
+
ContentType jsonContentType = Version.VERSION == null ? ContentType.APPLICATION_JSON
: ContentType.create("application/vnd.elasticsearch+json",
new BasicNameValuePair("compatible-with", String.valueOf(Version.VERSION.major())));
Consumer setHeaderIfNotPresent = header -> {
- if (transportOptionsBuilder.build().headers().stream() //
+ if (restClientOptionsBuilder.build().headers().stream() //
.noneMatch((h) -> h.getKey().equalsIgnoreCase(header))) {
// need to add the compatibility header, this is only done automatically when not passing in custom options.
// code copied from RestClientTransport as it is not available outside the package
- transportOptionsBuilder.addHeader(header, jsonContentType.toString());
+ restClientOptionsBuilder.addHeader(header, jsonContentType.toString());
}
};
-
+ยง
setHeaderIfNotPresent.accept("Content-Type");
setHeaderIfNotPresent.accept("Accept");
- TransportOptions transportOptionsWithHeader = transportOptionsBuilder
- .addHeader(X_SPRING_DATA_ELASTICSEARCH_CLIENT, clientType).build();
+ restClientOptionsBuilder.addHeader(X_SPRING_DATA_ELASTICSEARCH_CLIENT, clientType);
+
+ return new RestClientTransport(restClient, jsonpMapper, restClientOptionsBuilder.build());
+ }
+
+ private static RestClientOptions.Builder getRestClientOptionsBuilder(@Nullable TransportOptions transportOptions) {
- return new RestClientTransport(restClient, jsonpMapper, transportOptionsWithHeader);
+ if (transportOptions instanceof RestClientOptions restClientOptions) {
+ return restClientOptions.toBuilder();
+ }
+
+ var builder = new RestClientOptions.Builder(RequestOptions.DEFAULT.toBuilder());
+
+ if (transportOptions != null) {
+ transportOptions.headers().forEach(header -> builder.addHeader(header.getKey(), header.getValue()));
+ transportOptions.queryParameters().forEach(builder::setParameter);
+ builder.onWarnings(transportOptions.onWarnings());
+ }
+
+ return builder;
}
private static List formattedHosts(List hosts, boolean useSsl) {
diff --git a/src/test/resources/testcontainers-elasticsearch.properties b/src/test/resources/testcontainers-elasticsearch.properties
index ae2c9ab1f..1f69b06fe 100644
--- a/src/test/resources/testcontainers-elasticsearch.properties
+++ b/src/test/resources/testcontainers-elasticsearch.properties
@@ -15,7 +15,7 @@
#
#
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
-sde.testcontainers.image-version=8.8.2
+sde.testcontainers.image-version=8.9.0
#
#
# needed as we do a DELETE /* at the end of the tests, will be required from 8.0 on, produces a warning since 7.13