diff --git a/pom.xml b/pom.xml
index 1e35a6d69..a564adf40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,7 +21,7 @@
3.3.0-SNAPSHOT
- 8.12.2
+ 8.13.2
1.0.8.RELEASE
0.14.4
diff --git a/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc b/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc
index 17781c994..c383f3009 100644
--- a/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc
+++ b/src/main/antora/modules/ROOT/pages/elasticsearch/elasticsearch-new.adoc
@@ -4,7 +4,7 @@
[[new-features.5-3-0]]
== New in Spring Data Elasticsearch 5.3
-* Upgrade to Elasticsearch 8.12.2.
+* Upgrade to Elasticsearch 8.13.2.
* Add support for highlight queries in highlighting.
* Add shard statistics to the `SearchHit` class.
* Add support for multi search template API.
diff --git a/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc b/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc
index 9f88a8173..8fe2fc70e 100644
--- a/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc
+++ b/src/main/antora/modules/ROOT/pages/elasticsearch/versions.adoc
@@ -6,7 +6,7 @@ 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
-| 2024.0 (?) | 5.3.x | 8.12.2 | ?
+| 2024.0 (?) | 5.3.x | 8.13.2 | ?
| 2023.1 (Vaughan) | 5.2.x | 8.11.1 | 6.1.x
| 2023.0 (Ullmann) | 5.1.x | 8.7.1 | 6.0.x
| 2022.0 (Turing) | 5.0.xfootnote:oom[Out of maintenance] | 8.5.3 | 6.0.x
diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/CriteriaFilterProcessor.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/CriteriaFilterProcessor.java
index d692743f9..8d56aebc4 100644
--- a/src/main/java/org/springframework/data/elasticsearch/client/elc/CriteriaFilterProcessor.java
+++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/CriteriaFilterProcessor.java
@@ -39,6 +39,7 @@
import org.springframework.data.elasticsearch.core.geo.GeoJson;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import org.springframework.data.elasticsearch.core.query.Criteria;
+import org.springframework.data.elasticsearch.utils.geohash.Geohash;
import org.springframework.data.geo.Box;
import org.springframework.data.geo.Distance;
import org.springframework.data.geo.Metrics;
@@ -73,6 +74,9 @@ public static Optional createQuery(Criteria criteria) {
queriesForEntries(chainedCriteria).forEach(boolQueryBuilder::should);
filterQueries.add(new Query(boolQueryBuilder.build()));
} else if (chainedCriteria.isNegating()) {
+
+ Assert.notNull(criteria.getField(), "criteria must have a field");
+
Collection extends Query> negatingFilters = buildNegatingFilter(criteria.getField().getName(),
criteria.getFilterCriteriaEntries());
filterQueries.addAll(negatingFilters);
@@ -116,6 +120,7 @@ private static Collection extends Query> buildNegatingFilter(String fieldName,
private static Collection extends Query> queriesForEntries(Criteria criteria) {
Assert.notNull(criteria.getField(), "criteria must have a field");
+
String fieldName = criteria.getField().getName();
Assert.notNull(fieldName, "Unknown field");
@@ -177,7 +182,7 @@ private static ObjectBuilder withinQuery(String fieldName, Obj
.distance(dist) //
.distanceType(GeoDistanceType.Plane) //
.location(location -> {
- if (values[0]instanceof GeoPoint loc) {
+ if (values[0] instanceof GeoPoint loc) {
location.latlon(latlon -> latlon.lat(loc.getLat()).lon(loc.getLon()));
} else if (values[0] instanceof Point point) {
GeoPoint loc = GeoPoint.fromPoint(point);
@@ -245,7 +250,7 @@ private static void twoParameterBBox(GeoBoundingBoxQuery.Builder queryBuilder, O
Assert.isTrue(allElementsAreOfType(values, GeoPoint.class) || allElementsAreOfType(values, String.class),
" both elements of boundedBy filter must be type of GeoPoint or text(format lat,lon or geohash)");
- if (values[0]instanceof GeoPoint topLeft) {
+ if (values[0] instanceof GeoPoint topLeft) {
GeoPoint bottomRight = (GeoPoint) values[1];
queryBuilder.boundingBox(bb -> bb //
.tlbr(tlbr -> tlbr //
@@ -267,7 +272,10 @@ private static void twoParameterBBox(GeoBoundingBoxQuery.Builder queryBuilder, O
.tlbr(tlbr -> tlbr //
.topLeft(glb -> {
if (isGeoHash) {
- glb.geohash(gh -> gh.geohash(topLeft));
+ // although the builder in 8.13.2 supports geohash, the server throws an error, so we convert to a
+ // lat,lon string here
+ glb.text(Geohash.toLatLon(topLeft));
+ // glb.geohash(gh -> gh.geohash(topLeft));
} else {
glb.text(topLeft);
}
@@ -275,7 +283,8 @@ private static void twoParameterBBox(GeoBoundingBoxQuery.Builder queryBuilder, O
}) //
.bottomRight(glb -> {
if (isGeoHash) {
- glb.geohash(gh -> gh.geohash(bottomRight));
+ glb.text(Geohash.toLatLon(bottomRight));
+ // glb.geohash(gh -> gh.geohash(bottomRight));
} else {
glb.text(bottomRight);
}
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/BitUtil.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/BitUtil.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/BitUtil.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/BitUtil.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java
similarity index 96%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java
index 034c28d5e..410f06778 100644
--- a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java
+++ b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/Geohash.java
@@ -18,6 +18,8 @@
import java.util.ArrayList;
import java.util.Collection;
+import org.springframework.util.Assert;
+
/**
* Code copied from Elasticsearch 7.10, Apache License V2
* https://github.com/elastic/elasticsearch/blob/7.10/libs/geo/src/main/java/org/elasticsearch/geometry/utils/Geohash.java
@@ -70,6 +72,21 @@ public static Point toPoint(final String geohash) throws IllegalArgumentExceptio
return new Point(decodeLongitude(hash), decodeLatitude(hash));
}
+ /**
+ * Converts a geohash to a string in the format "lat,lon"
+ *
+ * @param geohash the geohash to convert
+ * @return the lat lon pair in a String
+ * @since 5.3
+ */
+ public static String toLatLon(final String geohash) {
+
+ Assert.notNull(geohash, "geohash must not be null");
+
+ var point = Geohash.toPoint(geohash);
+ return String.format("%f,%f", point.getLat(), point.getLon());
+ }
+
/**
* Computes the bounding box coordinates from a given geohash
*
@@ -143,7 +160,7 @@ public static > E addNeighbors(String geoha
* @return the given list
*/
public static > E addNeighborsAtLevel(String geohash, int level,
- E neighbors) {
+ E neighbors) {
String south = getNeighbor(geohash, level, 0, -1);
String north = getNeighbor(geohash, level, 0, +1);
if (north != null) {
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geometry.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/Geometry.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/Geometry.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/Geometry.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/GeometryValidator.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/GeometryValidator.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/GeometryValidator.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/GeometryValidator.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/GeometryVisitor.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/GeometryVisitor.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/GeometryVisitor.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/GeometryVisitor.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Point.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/Point.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/Point.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/Point.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/Rectangle.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/Rectangle.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/Rectangle.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/Rectangle.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/ShapeType.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/ShapeType.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/ShapeType.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/ShapeType.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/StandardValidator.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/StandardValidator.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/StandardValidator.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/StandardValidator.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/WellKnownText.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/WellKnownText.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/WellKnownText.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/WellKnownText.java
diff --git a/src/test/java/org/springframework/data/elasticsearch/utils/geohash/package-info.java b/src/main/java/org/springframework/data/elasticsearch/utils/geohash/package-info.java
similarity index 100%
rename from src/test/java/org/springframework/data/elasticsearch/utils/geohash/package-info.java
rename to src/main/java/org/springframework/data/elasticsearch/utils/geohash/package-info.java
diff --git a/src/test/resources/testcontainers-elasticsearch.properties b/src/test/resources/testcontainers-elasticsearch.properties
index 50314dfd3..487a77738 100644
--- a/src/test/resources/testcontainers-elasticsearch.properties
+++ b/src/test/resources/testcontainers-elasticsearch.properties
@@ -15,7 +15,7 @@
#
#
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
-sde.testcontainers.image-version=8.12.2
+sde.testcontainers.image-version=8.13.2
#
#
# 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