Skip to content

Commit 5a0f556

Browse files
authored
Upgrade Elasticsearch dependencies to 8.18.0
Original Pull request #3101 Adjust to changes in Elasticsearch. Closes #3100 Signed-off-by: Peter-Josef Meisch <[email protected]>
1 parent a07ac3c commit 5a0f556

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<springdata.commons>3.5.0-SNAPSHOT</springdata.commons>
2222

2323
<!-- version of the ElasticsearchClient -->
24-
<elasticsearch-java>8.17.4</elasticsearch-java>
24+
<elasticsearch-java>8.18.0</elasticsearch-java>
2525

2626
<hoverfly>0.19.0</hoverfly>
2727
<log4j>2.23.1</log4j>
@@ -131,6 +131,12 @@
131131
</exclusion>
132132
</exclusions>
133133
</dependency>
134+
<dependency>
135+
<groupId>org.elasticsearch.client</groupId>
136+
<artifactId>elasticsearch-rest-client</artifactId>
137+
<version>${elasticsearch-java}</version>
138+
</dependency>
139+
134140

135141
<!-- Jackson JSON Mapper -->
136142
<dependency>

src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[[new-features.5-5-0]]
55
== New in Spring Data Elasticsearch 5.5
66

7-
* Upgrade to Elasticsearch 8.17.4.
7+
* Upgrade to Elasticsearch 8.18.0.
88
* Add support for the `@SearchTemplateQuery` annotation on repository methods.
99
* Scripted field properties of type collection can be populated from scripts returning arrays.
1010

src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The following table shows the Elasticsearch and Spring versions that are used by
66
[cols="^,^,^,^",options="header"]
77
|===
88
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
9-
| 2025.0 (in development) | 5.5.x | 8.17.4 | 6.2.x
9+
| 2025.0 (in development) | 5.5.x | 8.18.0 | 6.2.x
1010
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
1111
| 2024.0 | 5.3.x | 8.13.4 | 6.1.x
1212
| 2023.1 (Vaughan) | 5.2.xfootnote:oom[Out of maintenance] | 8.11.1 | 6.1.x

src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import co.elastic.clients.json.JsonData;
5656
import co.elastic.clients.json.JsonpDeserializer;
5757
import co.elastic.clients.json.JsonpMapper;
58+
import co.elastic.clients.util.NamedValue;
5859
import co.elastic.clients.util.ObjectBuilder;
5960
import jakarta.json.stream.JsonParser;
6061

@@ -72,6 +73,7 @@
7273
import java.util.Set;
7374
import java.util.function.Function;
7475
import java.util.stream.Collectors;
76+
import java.util.stream.Stream;
7577

7678
import org.apache.commons.logging.Log;
7779
import org.apache.commons.logging.LogFactory;
@@ -1365,9 +1367,14 @@ public MsearchRequest searchMsearchRequest(
13651367
}
13661368

13671369
if (!isEmpty(query.getIndicesBoost())) {
1368-
bb.indicesBoost(query.getIndicesBoost().stream()
1369-
.map(indexBoost -> Map.of(indexBoost.getIndexName(), (double) indexBoost.getBoost()))
1370-
.collect(Collectors.toList()));
1370+
Stream<NamedValue<Double>> namedValueStream = query.getIndicesBoost().stream()
1371+
.map(indexBoost -> {
1372+
var namedValue = new NamedValue(indexBoost.getIndexName(),
1373+
Float.valueOf(indexBoost.getBoost()).doubleValue());
1374+
return namedValue;
1375+
});
1376+
List<NamedValue<Double>> namedValueList = namedValueStream.collect(Collectors.toList());
1377+
bb.indicesBoost(namedValueList);
13711378
}
13721379

13731380
query.getScriptedFields().forEach(scriptedField -> bb.scriptFields(scriptedField.getFieldName(),
@@ -1576,9 +1583,14 @@ private <T> void prepareSearchRequest(Query query, @Nullable String routing, @Nu
15761583
}
15771584

15781585
if (!isEmpty(query.getIndicesBoost())) {
1579-
builder.indicesBoost(query.getIndicesBoost().stream()
1580-
.map(indexBoost -> Map.of(indexBoost.getIndexName(), (double) indexBoost.getBoost()))
1581-
.collect(Collectors.toList()));
1586+
Stream<NamedValue<Double>> namedValueStream = query.getIndicesBoost().stream()
1587+
.map(indexBoost -> {
1588+
var namedValue = new NamedValue(indexBoost.getIndexName(),
1589+
Float.valueOf(indexBoost.getBoost()).doubleValue());
1590+
return namedValue;
1591+
});
1592+
List<NamedValue<Double>> namedValueList = namedValueStream.collect(Collectors.toList());
1593+
builder.indicesBoost(namedValueList);
15821594
}
15831595

15841596
if (!isEmpty(query.getDocValueFields())) {

src/main/java/org/springframework/data/elasticsearch/client/elc/ResponseConverter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public ClusterHealth clusterHealth(HealthResponse healthResponse) {
9292
return ClusterHealth.builder() //
9393
.withActivePrimaryShards(healthResponse.activePrimaryShards()) //
9494
.withActiveShards(healthResponse.activeShards()) //
95-
.withActiveShardsPercent(Double.parseDouble(healthResponse.activeShardsPercentAsNumber()))//
95+
.withActiveShardsPercent(healthResponse.activeShardsPercentAsNumber())//
9696
.withClusterName(healthResponse.clusterName()) //
9797
.withDelayedUnassignedShards(healthResponse.delayedUnassignedShards()) //
9898
.withInitializingShards(healthResponse.initializingShards()) //

src/test/resources/testcontainers-elasticsearch.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#
1616
#
1717
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
18-
sde.testcontainers.image-version=8.17.4
18+
sde.testcontainers.image-version=8.18.0
1919
#
2020
#
2121
# 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

0 commit comments

Comments
 (0)