Skip to content

Commit 949e5c1

Browse files
committed
Upgrade to Elasticsearch 9.2.0
Elasticsearch removed version type FORCE test fix for wrong geojson polygon, the server does some sanity checks now Signed-off-by: Peter-Josef Meisch <[email protected]>
1 parent 21bc62b commit 949e5c1

File tree

9 files changed

+40
-43
lines changed

9 files changed

+40
-43
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
<springdata.commons>4.0.0-SNAPSHOT</springdata.commons>
2222

2323
<!-- version of the ElasticsearchClient -->
24-
<elasticsearch-java>9.1.5</elasticsearch-java>
25-
<elasticsearch-rest-client>9.1.5</elasticsearch-rest-client>
24+
<elasticsearch-java>9.2.0</elasticsearch-java>
25+
<elasticsearch-rest-client>9.2.0</elasticsearch-rest-client>
2626

2727
<hoverfly>0.20.2</hoverfly>
2828
<log4j>2.25.1</log4j>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
* Upgrade to Spring 7
88
* Switch to jspecify nullability annotations
9-
* Upgrade to Elasticsearch 9.1.5
9+
* Upgrade to Elasticsearch 9.2.0
1010
* Use the new Elasticsearch Rest5Client as default
1111
* Add support for SpEL expressions in the `settingPath` parameter of the `@Setting` annotation
1212

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.1 (in development) | 6.0.x | 9.1.5 | 7.0.x
9+
| 2025.1 (in development) | 6.0.x | 9.2.0 | 7.0.x
1010
| 2025.0 | 5.5.x | 8.18.1 | 6.2.x
1111
| 2024.1 | 5.4.x | 8.15.5 | 6.1.x
1212
| 2024.0 | 5.3.xfootnote:oom[Out of maintenance] | 8.13.4 | 6.1.x

src/main/java/org/springframework/data/elasticsearch/annotations/Document.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,15 @@
107107
*/
108108
Alias[] aliases() default {};
109109

110-
/**
110+
/**
111+
* Note: the enum value FORCE, which was introduced in 4.4 has been removed
112+
* again by Elasticsearch.
111113
* @since 4.3
112114
*/
113115
enum VersionType {
114116
INTERNAL("internal"), //
115117
EXTERNAL("external"), //
116-
EXTERNAL_GTE("external_gte"), //
117-
/**
118-
* @since 4.4
119-
*/
120-
FORCE("force");
118+
EXTERNAL_GTE("external_gte"); //
121119

122120
private final String esName;
123121

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,7 +1992,6 @@ private VersionType retrieveVersionTypeFromPersistentEntity(@Nullable Class<?> c
19921992
case INTERNAL -> VersionType.Internal;
19931993
case EXTERNAL -> VersionType.External;
19941994
case EXTERNAL_GTE -> VersionType.ExternalGte;
1995-
case FORCE -> VersionType.Force;
19961995
};
19971996
}
19981997
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,6 @@ static VersionType versionType(
424424
case INTERNAL -> VersionType.Internal;
425425
case EXTERNAL -> VersionType.External;
426426
case EXTERNAL_GTE -> VersionType.ExternalGte;
427-
case FORCE -> VersionType.Force;
428427
};
429428
}
430429

src/test/java/org/springframework/data/elasticsearch/core/geo/GeoJsonEntity.java

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.util.Objects;
1919

20+
import org.jspecify.annotations.NonNull;
2021
import org.jspecify.annotations.Nullable;
2122
import org.springframework.data.annotation.Id;
2223
import org.springframework.data.elasticsearch.annotations.Document;
@@ -30,31 +31,31 @@ public class GeoJsonEntity {
3031
@Nullable
3132
@Id private String id;
3233
@Nullable private GeoJsonPoint point1;
33-
@Nullable private GeoJson<? extends Iterable<?>> point2;
34+
@Nullable private GeoJson<? extends @NonNull Iterable<?>> point2;
3435
@Nullable private GeoJsonMultiPoint multiPoint1;
35-
@Nullable private GeoJson<Iterable<Point>> multiPoint2;
36+
@Nullable private GeoJson<@NonNull Iterable<Point>> multiPoint2;
3637
@Nullable private GeoJsonLineString lineString1;
37-
@Nullable private GeoJson<Iterable<Point>> lineString2;
38+
@Nullable private GeoJson<@NonNull Iterable<Point>> lineString2;
3839
@Nullable private GeoJsonMultiLineString multiLineString1;
39-
@Nullable private GeoJson<Iterable<GeoJsonLineString>> multiLineString2;
40+
@Nullable private GeoJson<@NonNull Iterable<GeoJsonLineString>> multiLineString2;
4041
@Nullable private GeoJsonPolygon polygon1;
41-
@Nullable private GeoJson<Iterable<GeoJsonLineString>> polygon2;
42+
@Nullable private GeoJson<@NonNull Iterable<GeoJsonLineString>> polygon2;
4243
@Nullable private GeoJsonMultiPolygon multiPolygon1;
43-
@Nullable private GeoJson<Iterable<GeoJsonPolygon>> multiPolygon2;
44+
@Nullable private GeoJson<@NonNull Iterable<GeoJsonPolygon>> multiPolygon2;
4445
@Nullable private GeoJsonGeometryCollection geometryCollection1;
45-
@Nullable private GeoJson<Iterable<GeoJson<?>>> geometryCollection2;
46+
@Nullable private GeoJson<@NonNull Iterable<GeoJson<?>>> geometryCollection2;
4647

4748
public GeoJsonEntity() {}
4849

4950
public GeoJsonEntity(@Nullable String id, @Nullable GeoJsonPoint point1,
50-
@Nullable GeoJson<? extends Iterable<?>> point2, @Nullable GeoJsonMultiPoint multiPoint1,
51-
@Nullable GeoJson<Iterable<Point>> multiPoint2, @Nullable GeoJsonLineString lineString1,
52-
@Nullable GeoJson<Iterable<Point>> lineString2, @Nullable GeoJsonMultiLineString multiLineString1,
53-
@Nullable GeoJson<Iterable<GeoJsonLineString>> multiLineString2, @Nullable GeoJsonPolygon polygon1,
54-
@Nullable GeoJson<Iterable<GeoJsonLineString>> polygon2, @Nullable GeoJsonMultiPolygon multiPolygon1,
55-
@Nullable GeoJson<Iterable<GeoJsonPolygon>> multiPolygon2,
56-
@Nullable GeoJsonGeometryCollection geometryCollection1,
57-
@Nullable GeoJson<Iterable<GeoJson<?>>> geometryCollection2) {
51+
@Nullable GeoJson<? extends @NonNull Iterable<?>> point2, @Nullable GeoJsonMultiPoint multiPoint1,
52+
@Nullable GeoJson<@NonNull Iterable<Point>> multiPoint2, @Nullable GeoJsonLineString lineString1,
53+
@Nullable GeoJson<@NonNull Iterable<Point>> lineString2, @Nullable GeoJsonMultiLineString multiLineString1,
54+
@Nullable GeoJson<@NonNull Iterable<GeoJsonLineString>> multiLineString2, @Nullable GeoJsonPolygon polygon1,
55+
@Nullable GeoJson<@NonNull Iterable<GeoJsonLineString>> polygon2, @Nullable GeoJsonMultiPolygon multiPolygon1,
56+
@Nullable GeoJson<@NonNull Iterable<GeoJsonPolygon>> multiPolygon2,
57+
@Nullable GeoJsonGeometryCollection geometryCollection1,
58+
@Nullable GeoJson<@NonNull Iterable<GeoJson<?>>> geometryCollection2) {
5859
this.id = id;
5960
this.point1 = point1;
6061
this.point2 = point2;
@@ -91,11 +92,11 @@ public void setPoint1(@Nullable GeoJsonPoint point1) {
9192
}
9293

9394
@Nullable
94-
public GeoJson<? extends Iterable<?>> getPoint2() {
95+
public GeoJson<? extends @NonNull Iterable<?>> getPoint2() {
9596
return point2;
9697
}
9798

98-
public void setPoint2(@Nullable GeoJson<? extends Iterable<?>> point2) {
99+
public void setPoint2(@Nullable GeoJson<? extends @NonNull Iterable<?>> point2) {
99100
this.point2 = point2;
100101
}
101102

@@ -109,11 +110,11 @@ public void setMultiPoint1(@Nullable GeoJsonMultiPoint multiPoint1) {
109110
}
110111

111112
@Nullable
112-
public GeoJson<Iterable<Point>> getMultiPoint2() {
113+
public GeoJson<@NonNull Iterable<Point>> getMultiPoint2() {
113114
return multiPoint2;
114115
}
115116

116-
public void setMultiPoint2(@Nullable GeoJson<Iterable<Point>> multiPoint2) {
117+
public void setMultiPoint2(@Nullable GeoJson<@NonNull Iterable<Point>> multiPoint2) {
117118
this.multiPoint2 = multiPoint2;
118119
}
119120

@@ -127,11 +128,11 @@ public void setLineString1(@Nullable GeoJsonLineString lineString1) {
127128
}
128129

129130
@Nullable
130-
public GeoJson<Iterable<Point>> getLineString2() {
131+
public GeoJson<@NonNull Iterable<Point>> getLineString2() {
131132
return lineString2;
132133
}
133134

134-
public void setLineString2(@Nullable GeoJson<Iterable<Point>> lineString2) {
135+
public void setLineString2(@Nullable GeoJson<@NonNull Iterable<Point>> lineString2) {
135136
this.lineString2 = lineString2;
136137
}
137138

@@ -145,11 +146,11 @@ public void setMultiLineString1(@Nullable GeoJsonMultiLineString multiLineString
145146
}
146147

147148
@Nullable
148-
public GeoJson<Iterable<GeoJsonLineString>> getMultiLineString2() {
149+
public GeoJson<@NonNull Iterable<GeoJsonLineString>> getMultiLineString2() {
149150
return multiLineString2;
150151
}
151152

152-
public void setMultiLineString2(@Nullable GeoJson<Iterable<GeoJsonLineString>> multiLineString2) {
153+
public void setMultiLineString2(@Nullable GeoJson<@NonNull Iterable<GeoJsonLineString>> multiLineString2) {
153154
this.multiLineString2 = multiLineString2;
154155
}
155156

@@ -163,11 +164,11 @@ public void setPolygon1(@Nullable GeoJsonPolygon polygon1) {
163164
}
164165

165166
@Nullable
166-
public GeoJson<Iterable<GeoJsonLineString>> getPolygon2() {
167+
public GeoJson<@NonNull Iterable<GeoJsonLineString>> getPolygon2() {
167168
return polygon2;
168169
}
169170

170-
public void setPolygon2(@Nullable GeoJson<Iterable<GeoJsonLineString>> polygon2) {
171+
public void setPolygon2(@Nullable GeoJson<@NonNull Iterable<GeoJsonLineString>> polygon2) {
171172
this.polygon2 = polygon2;
172173
}
173174

@@ -181,11 +182,11 @@ public void setMultiPolygon1(@Nullable GeoJsonMultiPolygon multiPolygon1) {
181182
}
182183

183184
@Nullable
184-
public GeoJson<Iterable<GeoJsonPolygon>> getMultiPolygon2() {
185+
public GeoJson<@NonNull Iterable<GeoJsonPolygon>> getMultiPolygon2() {
185186
return multiPolygon2;
186187
}
187188

188-
public void setMultiPolygon2(@Nullable GeoJson<Iterable<GeoJsonPolygon>> multiPolygon2) {
189+
public void setMultiPolygon2(@Nullable GeoJson<@NonNull Iterable<GeoJsonPolygon>> multiPolygon2) {
189190
this.multiPolygon2 = multiPolygon2;
190191
}
191192

@@ -199,11 +200,11 @@ public void setGeometryCollection1(@Nullable GeoJsonGeometryCollection geometryC
199200
}
200201

201202
@Nullable
202-
public GeoJson<Iterable<GeoJson<?>>> getGeometryCollection2() {
203+
public GeoJson<@NonNull Iterable<GeoJson<?>>> getGeometryCollection2() {
203204
return geometryCollection2;
204205
}
205206

206-
public void setGeometryCollection2(@Nullable GeoJson<Iterable<GeoJson<?>>> geometryCollection2) {
207+
public void setGeometryCollection2(@Nullable GeoJson<@NonNull Iterable<GeoJson<?>>> geometryCollection2) {
207208
this.geometryCollection2 = geometryCollection2;
208209
}
209210

src/test/java/org/springframework/data/elasticsearch/core/geo/GeoJsonIntegrationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void shouldWriteAndReadAnEntityWithGeoJsonProperties() {
115115
));
116116
GeoJsonPolygon geoJsonPolygon = GeoJsonPolygon
117117
.of(new Point(12, 34), new Point(56, 78), new Point(90, 12), new Point(12, 34))
118-
.withInnerRing(new Point(21, 43), new Point(65, 87), new Point(9, 21), new Point(21, 43));
118+
.withInnerRing(new Point(35, 35), new Point(65, 30), new Point(55, 50), new Point(35, 35));
119119
GeoJsonMultiPolygon geoJsonMultiPolygon = GeoJsonMultiPolygon
120120
.of(Arrays.asList(GeoJsonPolygon.of(new Point(12, 34), new Point(56, 78), new Point(90, 12), new Point(12, 34)),
121121
GeoJsonPolygon.of(new Point(21, 43), new Point(65, 87), new Point(9, 21), new Point(21, 43))));

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=9.1.5
18+
sde.testcontainers.image-version=9.2.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)