mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-22 03:52:10 +00:00
Upgrade to Elasticsearch 8.13.2.
Original Pull Request #2893 Closes #2891
This commit is contained in:
parent
1d709f6c55
commit
bec3beb1eb
2
pom.xml
2
pom.xml
@ -21,7 +21,7 @@
|
||||
<springdata.commons>3.3.0-SNAPSHOT</springdata.commons>
|
||||
|
||||
<!-- version of the ElasticsearchClient -->
|
||||
<elasticsearch-java>8.12.2</elasticsearch-java>
|
||||
<elasticsearch-java>8.13.2</elasticsearch-java>
|
||||
|
||||
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
|
||||
<hoverfly>0.14.4</hoverfly>
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -39,6 +39,7 @@ import org.springframework.data.elasticsearch.core.geo.GeoBox;
|
||||
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 @@ class CriteriaFilterProcessor {
|
||||
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 @@ class CriteriaFilterProcessor {
|
||||
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");
|
||||
|
||||
@ -267,7 +272,10 @@ class CriteriaFilterProcessor {
|
||||
.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 @@ class CriteriaFilterProcessor {
|
||||
}) //
|
||||
.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);
|
||||
}
|
||||
|
@ -18,6 +18,8 @@ package org.springframework.data.elasticsearch.utils.geohash;
|
||||
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 class Geohash {
|
||||
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
|
||||
*
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user