mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-22 12:02:10 +00:00
Upgrade to Elasticsearch 8.16.1.
Original Pull Request #3019 Closes #3017
This commit is contained in:
parent
028239fbdb
commit
5f297f1dc3
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
||||
<springdata.commons>3.5.0-SNAPSHOT</springdata.commons>
|
||||
|
||||
<!-- version of the ElasticsearchClient -->
|
||||
<elasticsearch-java>8.15.3</elasticsearch-java>
|
||||
<elasticsearch-java>8.16.1</elasticsearch-java>
|
||||
|
||||
<hoverfly>0.19.0</hoverfly>
|
||||
<log4j>2.23.1</log4j>
|
||||
|
@ -1,13 +1,17 @@
|
||||
[[new-features]]
|
||||
= What's new
|
||||
|
||||
[[new-features.5-5-0]]
|
||||
== New in Spring Data Elasticsearch 5.5
|
||||
* Upgrade to Elasticsearch 8.16.1.
|
||||
|
||||
[[new-features.5-4-0]]
|
||||
== New in Spring Data Elasticsearch 5.4
|
||||
|
||||
* Upgrade to Elasticsearch 8.15.3.
|
||||
* Allow to customize the mapped type name for `@InnerField` and `@Field` annotations.
|
||||
* Support for Elasticsearch SQL.
|
||||
* Add support for retrieving request executionDuration.
|
||||
* Add support for retrieving request executionDuration.
|
||||
|
||||
[[new-features.5-3-0]]
|
||||
== New in Spring Data Elasticsearch 5.3
|
||||
|
@ -6,8 +6,8 @@ The following table shows the Elasticsearch and Spring versions that are used by
|
||||
[cols="^,^,^,^",options="header"]
|
||||
|===
|
||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
|
||||
| 2025.0 (in development) | 5.5.x | 8.15.3 | 6.2.x
|
||||
| 2024.1 | 5.4.x | 8.15.3 | 6.1.x
|
||||
| 2025.0 (in development) | 5.5.x | 8.16.1 | 6.2.x
|
||||
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
|
||||
| 2024.0 | 5.3.x | 8.13.4 | 6.1.x
|
||||
| 2023.1 (Vaughan) | 5.2.xfootnote:oom[Out of maintenance] | 8.11.1 | 6.1.x
|
||||
| 2023.0 (Ullmann) | 5.1.xfootnote:oom[] | 8.7.1 | 6.0.x
|
||||
|
@ -18,6 +18,8 @@ package org.springframework.data.elasticsearch.client.elc;
|
||||
import co.elastic.clients.elasticsearch.ElasticsearchClient;
|
||||
import co.elastic.clients.transport.ElasticsearchTransport;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
@ -36,7 +38,10 @@ public class AutoCloseableElasticsearchClient extends ElasticsearchClient implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
transport.close();
|
||||
public void close() throws IOException {
|
||||
// since Elasticsearch 8.16 the ElasticsearchClient implements (through ApiClient) the Closeable interface and
|
||||
// handles closing of the underlying transport. We now just call the base class, but keep this as we
|
||||
// have been implementing AutoCloseable since 4.4 and won't change that to a mere Closeable
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ public final class ElasticsearchClients {
|
||||
Assert.notNull(jsonpMapper, "jsonpMapper must not be null");
|
||||
|
||||
TransportOptions.Builder transportOptionsBuilder = transportOptions != null ? transportOptions.toBuilder()
|
||||
: new RestClientOptions(RequestOptions.DEFAULT).toBuilder();
|
||||
: new RestClientOptions(RequestOptions.DEFAULT, false).toBuilder();
|
||||
|
||||
RestClientOptions.Builder restClientOptionsBuilder = getRestClientOptionsBuilder(transportOptions);
|
||||
|
||||
|
@ -135,6 +135,6 @@ public abstract class ElasticsearchConfiguration extends ElasticsearchConfigurat
|
||||
* @return the options that should be added to every request. Must not be {@literal null}
|
||||
*/
|
||||
public TransportOptions transportOptions() {
|
||||
return new RestClientOptions(RequestOptions.DEFAULT);
|
||||
return new RestClientOptions(RequestOptions.DEFAULT, false);
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ import co.elastic.clients.transport.endpoints.EndpointWithResponseMapperAttr;
|
||||
import co.elastic.clients.util.ObjectBuilder;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
@ -56,8 +57,11 @@ public class ReactiveElasticsearchClient extends ApiClient<ElasticsearchTranspor
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
transport.close();
|
||||
public void close() throws IOException {
|
||||
// since Elasticsearch 8.16 the ElasticsearchClient implements (through ApiClient) the Closeable interface and
|
||||
// handles closing of the underlying transport. We now just call the base class, but keep this as we
|
||||
// have been implementing AutoCloseable since 4.4 and won't change that to a mere Closeable
|
||||
super.close();
|
||||
}
|
||||
|
||||
// region child clients
|
||||
@ -127,7 +131,8 @@ public class ReactiveElasticsearchClient extends ApiClient<ElasticsearchTranspor
|
||||
// java.lang.Class<TDocument>)
|
||||
// noinspection unchecked
|
||||
JsonEndpoint<GetRequest, GetResponse<T>, ErrorResponse> endpoint = (JsonEndpoint<GetRequest, GetResponse<T>, ErrorResponse>) GetRequest._ENDPOINT;
|
||||
endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:_global.get.Response.TDocument",
|
||||
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
|
||||
"co.elastic.clients:Deserializer:_global.get.Response.TDocument",
|
||||
getDeserializer(tClass));
|
||||
|
||||
return Mono.fromFuture(transport.performRequestAsync(request, endpoint, transportOptions));
|
||||
@ -172,7 +177,8 @@ public class ReactiveElasticsearchClient extends ApiClient<ElasticsearchTranspor
|
||||
|
||||
// noinspection unchecked
|
||||
JsonEndpoint<MgetRequest, MgetResponse<T>, ErrorResponse> endpoint = (JsonEndpoint<MgetRequest, MgetResponse<T>, ErrorResponse>) MgetRequest._ENDPOINT;
|
||||
endpoint = new EndpointWithResponseMapperAttr<>(endpoint, "co.elastic.clients:Deserializer:_global.mget.Response.TDocument",
|
||||
endpoint = new EndpointWithResponseMapperAttr<>(endpoint,
|
||||
"co.elastic.clients:Deserializer:_global.mget.Response.TDocument",
|
||||
this.getDeserializer(clazz));
|
||||
|
||||
return Mono.fromFuture(transport.performRequestAsync(request, endpoint, transportOptions));
|
||||
|
@ -125,6 +125,6 @@ public abstract class ReactiveElasticsearchConfiguration extends ElasticsearchCo
|
||||
* @return the options that should be added to every request. Must not be {@literal null}
|
||||
*/
|
||||
public TransportOptions transportOptions() {
|
||||
return new RestClientOptions(RequestOptions.DEFAULT).toBuilder().build();
|
||||
return new RestClientOptions(RequestOptions.DEFAULT, false).toBuilder().build();
|
||||
}
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ import co.elastic.clients.elasticsearch.indices.*;
|
||||
import co.elastic.clients.elasticsearch.indices.ExistsIndexTemplateRequest;
|
||||
import co.elastic.clients.elasticsearch.indices.ExistsRequest;
|
||||
import co.elastic.clients.elasticsearch.indices.update_aliases.Action;
|
||||
import co.elastic.clients.elasticsearch.sql.query.SqlFormat;
|
||||
import co.elastic.clients.json.JsonData;
|
||||
import co.elastic.clients.json.JsonpDeserializer;
|
||||
import co.elastic.clients.json.JsonpMapper;
|
||||
@ -533,17 +534,22 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
public co.elastic.clients.elasticsearch.sql.QueryRequest sqlQueryRequest(SqlQuery query) {
|
||||
Assert.notNull(query, "Query must not be null.");
|
||||
|
||||
return co.elastic.clients.elasticsearch.sql.QueryRequest.of(sqb -> {
|
||||
sqb.query(query.getQuery()).catalog(query.getCatalog()).columnar(query.getColumnar()).cursor(query.getCursor())
|
||||
.fetchSize(query.getFetchSize()).fieldMultiValueLeniency(query.getFieldMultiValueLeniency())
|
||||
.indexUsingFrozen(query.getIndexIncludeFrozen()).keepAlive(time(query.getKeepAlive()))
|
||||
.keepOnCompletion(query.getKeepOnCompletion()).pageTimeout(time(query.getPageTimeout()))
|
||||
.requestTimeout(time(query.getRequestTimeout()))
|
||||
.waitForCompletionTimeout(time(query.getWaitForCompletionTimeout())).filter(getQuery(query.getFilter(), null))
|
||||
.timeZone(Objects.toString(query.getTimeZone(), null)).format("json");
|
||||
|
||||
return sqb;
|
||||
});
|
||||
return co.elastic.clients.elasticsearch.sql.QueryRequest.of(sqb -> sqb
|
||||
.query(query.getQuery())
|
||||
.catalog(query.getCatalog())
|
||||
.columnar(query.getColumnar())
|
||||
.cursor(query.getCursor())
|
||||
.fetchSize(query.getFetchSize())
|
||||
.fieldMultiValueLeniency(query.getFieldMultiValueLeniency())
|
||||
.indexUsingFrozen(query.getIndexIncludeFrozen())
|
||||
.keepAlive(time(query.getKeepAlive()))
|
||||
.keepOnCompletion(query.getKeepOnCompletion())
|
||||
.pageTimeout(time(query.getPageTimeout()))
|
||||
.requestTimeout(time(query.getRequestTimeout()))
|
||||
.waitForCompletionTimeout(time(query.getWaitForCompletionTimeout()))
|
||||
.filter(getQuery(query.getFilter(), null))
|
||||
.timeZone(Objects.toString(query.getTimeZone(), null))
|
||||
.format(SqlFormat.Json));
|
||||
}
|
||||
|
||||
// endregion
|
||||
|
@ -80,6 +80,10 @@ public abstract class HighlightCommonParameters {
|
||||
return boundaryScannerLocale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated the underlying functionality is deprecated since Elasticsearch 8.8.
|
||||
*/
|
||||
@Deprecated(since = "5.5")
|
||||
public boolean getForceSource() {
|
||||
return forceSource;
|
||||
}
|
||||
@ -173,6 +177,10 @@ public abstract class HighlightCommonParameters {
|
||||
return (SELF) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated the underlying functionality is deprecated since Elasticsearch 8.8.
|
||||
*/
|
||||
@Deprecated(since = "5.5")
|
||||
public SELF withForceSource(boolean forceSource) {
|
||||
this.forceSource = forceSource;
|
||||
return (SELF) this;
|
||||
|
@ -33,11 +33,11 @@ inline fun <reified T : Any> SearchOperations.searchOne(query: Query): SearchHit
|
||||
inline fun <reified T : Any> SearchOperations.searchOne(query: Query, index: IndexCoordinates): SearchHit<T>? =
|
||||
searchOne(query, T::class.java, index)
|
||||
|
||||
inline fun <reified T : Any> SearchOperations.multiSearch(queries: List<out Query>): List<SearchHits<T>> =
|
||||
inline fun <reified T : Any> SearchOperations.multiSearch(queries: List<Query>): List<SearchHits<T>> =
|
||||
multiSearch(queries, T::class.java)
|
||||
|
||||
inline fun <reified T : Any> SearchOperations.multiSearch(
|
||||
queries: List<out Query>,
|
||||
queries: List<Query>,
|
||||
index: IndexCoordinates
|
||||
): List<SearchHits<T>> =
|
||||
multiSearch(queries, T::class.java, index)
|
||||
|
@ -77,7 +77,7 @@ public class DevTests {
|
||||
private static final SimpleElasticsearchMappingContext mappingContext = new SimpleElasticsearchMappingContext();
|
||||
private static final MappingElasticsearchConverter converter = new MappingElasticsearchConverter(mappingContext);
|
||||
|
||||
private final TransportOptions transportOptions = new RestClientOptions(RequestOptions.DEFAULT).toBuilder()
|
||||
private final TransportOptions transportOptions = new RestClientOptions(RequestOptions.DEFAULT, false).toBuilder()
|
||||
.addHeader("X-SpringDataElasticsearch-AlwaysThere", "true").setParameter("pretty", "true").build();
|
||||
|
||||
private final JsonpMapper jsonpMapper = new JacksonJsonpMapper();
|
||||
|
@ -15,7 +15,7 @@
|
||||
#
|
||||
#
|
||||
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
|
||||
sde.testcontainers.image-version=8.15.3
|
||||
sde.testcontainers.image-version=8.16.1
|
||||
#
|
||||
#
|
||||
# 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