mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-10-12 21:38:54 +00:00
Upgrade Elasticsearch to 9.1.0.
Original Pull Request #3147 Closes #3145 Signed-off-by: Peter-Josef Meisch <pj.meisch@sothawo.com>
This commit is contained in:
parent
e49bb63df4
commit
6697755b45
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
|||||||
<springdata.commons>4.0.0-SNAPSHOT</springdata.commons>
|
<springdata.commons>4.0.0-SNAPSHOT</springdata.commons>
|
||||||
|
|
||||||
<!-- version of the ElasticsearchClient -->
|
<!-- version of the ElasticsearchClient -->
|
||||||
<elasticsearch-java>9.0.4</elasticsearch-java>
|
<elasticsearch-java>9.1.0</elasticsearch-java>
|
||||||
|
|
||||||
<hoverfly>0.19.0</hoverfly>
|
<hoverfly>0.19.0</hoverfly>
|
||||||
<log4j>2.23.1</log4j>
|
<log4j>2.23.1</log4j>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
* Upgarde to Spring 7
|
* Upgarde to Spring 7
|
||||||
* Switch to jspecify nullability annotations
|
* Switch to jspecify nullability annotations
|
||||||
* Upgrade to Elasticsearch 9.0.4
|
* Upgrade to Elasticsearch 9.1.0
|
||||||
* Use the new Elasticsearch Rest5Client as default
|
* Use the new Elasticsearch Rest5Client as default
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ The following table shows the Elasticsearch and Spring versions that are used by
|
|||||||
[cols="^,^,^,^",options="header"]
|
[cols="^,^,^,^",options="header"]
|
||||||
|===
|
|===
|
||||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
|
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
|
||||||
| 2025.1 (in development) | 6.0.x | 9.0.4 | 7.0.x
|
| 2025.1 (in development) | 6.0.x | 9.1.0 | 7.0.x
|
||||||
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
|
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
|
||||||
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
|
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
|
||||||
| 2024.0 | 5.3.xfootnote:oom[Out of maintenance] | 8.13.4 | 6.1.x
|
| 2024.0 | 5.3.xfootnote:oom[Out of maintenance] | 8.13.4 | 6.1.x
|
||||||
|
@ -17,6 +17,8 @@ package org.springframework.data.elasticsearch.client.elc;
|
|||||||
|
|
||||||
import static org.springframework.data.elasticsearch.client.elc.TypeUtils.*;
|
import static org.springframework.data.elasticsearch.client.elc.TypeUtils.*;
|
||||||
|
|
||||||
|
import co.elastic.clients.util.NamedValue;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -60,10 +62,11 @@ class HighlightQueryBuilder {
|
|||||||
|
|
||||||
for (HighlightField highlightField : highlight.getFields()) {
|
for (HighlightField highlightField : highlight.getFields()) {
|
||||||
String mappedName = mapFieldName(highlightField.getName(), type);
|
String mappedName = mapFieldName(highlightField.getName(), type);
|
||||||
highlightBuilder.fields(mappedName, hf -> {
|
highlightBuilder.fields(
|
||||||
|
NamedValue.of(mappedName, co.elastic.clients.elasticsearch.core.search.HighlightField.of(hf -> {
|
||||||
addParameters(highlightField.getParameters(), hf, type);
|
addParameters(highlightField.getParameters(), hf, type);
|
||||||
return hf;
|
return hf;
|
||||||
});
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
return highlightBuilder.build();
|
return highlightBuilder.build();
|
||||||
|
@ -30,6 +30,7 @@ import java.util.Set;
|
|||||||
import org.jspecify.annotations.Nullable;
|
import org.jspecify.annotations.Nullable;
|
||||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||||
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||||
|
import org.springframework.data.elasticsearch.ResourceNotFoundException;
|
||||||
import org.springframework.data.elasticsearch.UncategorizedElasticsearchException;
|
import org.springframework.data.elasticsearch.UncategorizedElasticsearchException;
|
||||||
import org.springframework.data.elasticsearch.annotations.Mapping;
|
import org.springframework.data.elasticsearch.annotations.Mapping;
|
||||||
import org.springframework.data.elasticsearch.core.IndexInformation;
|
import org.springframework.data.elasticsearch.core.IndexInformation;
|
||||||
@ -315,15 +316,20 @@ public class IndicesTemplate extends ChildTemplate<ElasticsearchTransport, Elast
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TemplateData getTemplate(GetTemplateRequest getTemplateRequest) {
|
public @Nullable TemplateData getTemplate(GetTemplateRequest getTemplateRequest) {
|
||||||
|
|
||||||
Assert.notNull(getTemplateRequest, "getTemplateRequest must not be null");
|
Assert.notNull(getTemplateRequest, "getTemplateRequest must not be null");
|
||||||
|
|
||||||
co.elastic.clients.elasticsearch.indices.GetTemplateRequest getTemplateRequestES = requestConverter
|
co.elastic.clients.elasticsearch.indices.GetTemplateRequest getTemplateRequestES = requestConverter
|
||||||
.indicesGetTemplateRequest(getTemplateRequest);
|
.indicesGetTemplateRequest(getTemplateRequest);
|
||||||
GetTemplateResponse getTemplateResponse = execute(client -> client.getTemplate(getTemplateRequestES));
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
GetTemplateResponse getTemplateResponse = execute(client -> client.getTemplate(getTemplateRequestES));
|
||||||
return responseConverter.indicesGetTemplateData(getTemplateResponse, getTemplateRequest.getTemplateName());
|
return responseConverter.indicesGetTemplateData(getTemplateResponse, getTemplateRequest.getTemplateName());
|
||||||
|
} catch (ResourceNotFoundException e) {
|
||||||
|
// since Elasticsearch 9.1.0 we get an exception (404) instead of an empty result
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -21,6 +21,7 @@ import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase;
|
|||||||
import co.elastic.clients.elasticsearch.indices.*;
|
import co.elastic.clients.elasticsearch.indices.*;
|
||||||
import co.elastic.clients.transport.ElasticsearchTransport;
|
import co.elastic.clients.transport.ElasticsearchTransport;
|
||||||
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
import co.elastic.clients.transport.endpoints.BooleanResponse;
|
||||||
|
import org.springframework.data.elasticsearch.ResourceNotFoundException;
|
||||||
import reactor.core.publisher.Flux;
|
import reactor.core.publisher.Flux;
|
||||||
import reactor.core.publisher.Mono;
|
import reactor.core.publisher.Mono;
|
||||||
|
|
||||||
@ -389,7 +390,8 @@ public class ReactiveIndicesTemplate
|
|||||||
co.elastic.clients.elasticsearch.indices.GetTemplateRequest getTemplateRequestES = requestConverter
|
co.elastic.clients.elasticsearch.indices.GetTemplateRequest getTemplateRequestES = requestConverter
|
||||||
.indicesGetTemplateRequest(getTemplateRequest);
|
.indicesGetTemplateRequest(getTemplateRequest);
|
||||||
Mono<GetTemplateResponse> getTemplateResponse = Mono
|
Mono<GetTemplateResponse> getTemplateResponse = Mono
|
||||||
.from(execute(client -> client.getTemplate(getTemplateRequestES)));
|
.from(execute(client -> client.getTemplate(getTemplateRequestES)))
|
||||||
|
.onErrorComplete(ResourceNotFoundException.class);
|
||||||
|
|
||||||
return getTemplateResponse.flatMap(response -> {
|
return getTemplateResponse.flatMap(response -> {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
|
@ -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=9.0.4
|
sde.testcontainers.image-version=9.1.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