mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-15 00:22:11 +00:00
Upgrade to Elasticsearch 8.9.0.
Original Pull Request #2656 Closes #2650
This commit is contained in:
parent
bd71a9311c
commit
412a2e2ea1
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
|||||||
<springdata.commons>3.2.0-SNAPSHOT</springdata.commons>
|
<springdata.commons>3.2.0-SNAPSHOT</springdata.commons>
|
||||||
|
|
||||||
<!-- version of the ElasticsearchClient -->
|
<!-- version of the ElasticsearchClient -->
|
||||||
<elasticsearch-java>8.8.2</elasticsearch-java>
|
<elasticsearch-java>8.9.0</elasticsearch-java>
|
||||||
|
|
||||||
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
|
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
|
||||||
<hoverfly>0.14.4</hoverfly>
|
<hoverfly>0.14.4</hoverfly>
|
||||||
|
@ -37,7 +37,7 @@ built and tested.
|
|||||||
[cols="^,^,^,^,^",options="header"]
|
[cols="^,^,^,^,^",options="header"]
|
||||||
|===
|
|===
|
||||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
| 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
|
| 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
|
| 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
|
| 2021.2 (Raj) | 4.4.xfootnote:oom[Out of maintenance] | 7.17.3 | 5.3.x | 2.7.x
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
[[new-features.5-2-0]]
|
[[new-features.5-2-0]]
|
||||||
== New in Spring Data Elasticsearch 5.2
|
== 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.
|
* The `JsonpMapper` for Elasticsearch is now configurable and provided as bean.
|
||||||
* Improved AOT runtime hints for Elasticsearch client library classes.
|
* Improved AOT runtime hints for Elasticsearch client library classes.
|
||||||
* Add Kotlin extensions and repository coroutine support.
|
* Add Kotlin extensions and repository coroutine support.
|
||||||
|
@ -34,7 +34,9 @@ import java.util.function.Function;
|
|||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
import java.util.stream.Collectors;
|
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.client.config.RequestConfig;
|
||||||
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.ContentType;
|
||||||
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
|
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
|
||||||
@ -261,26 +263,44 @@ public final class ElasticsearchClients {
|
|||||||
TransportOptions.Builder transportOptionsBuilder = transportOptions != null ? transportOptions.toBuilder()
|
TransportOptions.Builder transportOptionsBuilder = transportOptions != null ? transportOptions.toBuilder()
|
||||||
: new RestClientOptions(RequestOptions.DEFAULT).toBuilder();
|
: new RestClientOptions(RequestOptions.DEFAULT).toBuilder();
|
||||||
|
|
||||||
|
RestClientOptions.Builder restClientOptionsBuilder = getRestClientOptionsBuilder(transportOptions);
|
||||||
|
|
||||||
ContentType jsonContentType = Version.VERSION == null ? ContentType.APPLICATION_JSON
|
ContentType jsonContentType = Version.VERSION == null ? ContentType.APPLICATION_JSON
|
||||||
: ContentType.create("application/vnd.elasticsearch+json",
|
: ContentType.create("application/vnd.elasticsearch+json",
|
||||||
new BasicNameValuePair("compatible-with", String.valueOf(Version.VERSION.major())));
|
new BasicNameValuePair("compatible-with", String.valueOf(Version.VERSION.major())));
|
||||||
|
|
||||||
Consumer<String> setHeaderIfNotPresent = header -> {
|
Consumer<String> setHeaderIfNotPresent = header -> {
|
||||||
if (transportOptionsBuilder.build().headers().stream() //
|
if (restClientOptionsBuilder.build().headers().stream() //
|
||||||
.noneMatch((h) -> h.getKey().equalsIgnoreCase(header))) {
|
.noneMatch((h) -> h.getKey().equalsIgnoreCase(header))) {
|
||||||
// need to add the compatibility header, this is only done automatically when not passing in custom options.
|
// 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
|
// 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("Content-Type");
|
||||||
setHeaderIfNotPresent.accept("Accept");
|
setHeaderIfNotPresent.accept("Accept");
|
||||||
|
|
||||||
TransportOptions transportOptionsWithHeader = transportOptionsBuilder
|
restClientOptionsBuilder.addHeader(X_SPRING_DATA_ELASTICSEARCH_CLIENT, clientType);
|
||||||
.addHeader(X_SPRING_DATA_ELASTICSEARCH_CLIENT, clientType).build();
|
|
||||||
|
|
||||||
return new RestClientTransport(restClient, jsonpMapper, transportOptionsWithHeader);
|
return new RestClientTransport(restClient, jsonpMapper, restClientOptionsBuilder.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static RestClientOptions.Builder getRestClientOptionsBuilder(@Nullable TransportOptions transportOptions) {
|
||||||
|
|
||||||
|
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<String> formattedHosts(List<InetSocketAddress> hosts, boolean useSsl) {
|
private static List<String> formattedHosts(List<InetSocketAddress> hosts, boolean useSsl) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
|
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
|
# 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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user