mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-07-03 09:12:12 +00:00
Upgrade to Elasticsearch 8.5.0.
Original Pull Request #2348 Closes #2345 Closes #2300
This commit is contained in:
parent
5da1994b40
commit
744b3ed6b4
4
pom.xml
4
pom.xml
@ -21,9 +21,9 @@
|
|||||||
<springdata.commons>3.0.0-SNAPSHOT</springdata.commons>
|
<springdata.commons>3.0.0-SNAPSHOT</springdata.commons>
|
||||||
|
|
||||||
<!-- version of the RestHighLevelClient -->
|
<!-- version of the RestHighLevelClient -->
|
||||||
<elasticsearch-rhlc>7.17.6</elasticsearch-rhlc>
|
<elasticsearch-rhlc>7.17.7</elasticsearch-rhlc>
|
||||||
<!-- version of the new ElasticsearchClient -->
|
<!-- version of the new ElasticsearchClient -->
|
||||||
<elasticsearch-java>8.4.3</elasticsearch-java>
|
<elasticsearch-java>8.5.0</elasticsearch-java>
|
||||||
|
|
||||||
<log4j>2.18.0</log4j>
|
<log4j>2.18.0</log4j>
|
||||||
<netty>4.1.65.Final</netty>
|
<netty>4.1.65.Final</netty>
|
||||||
|
@ -37,7 +37,7 @@ built and tested.
|
|||||||
[cols="^,^,^,^,^",options="header"]
|
[cols="^,^,^,^,^",options="header"]
|
||||||
|===
|
|===
|
||||||
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
|
||||||
| 2022.0 (Turing) | 5.0.x | 8.4.3 | 6.0.x | 3.0.x?
|
| 2022.0 (Turing) | 5.0.x | 8.5.0 | 6.0.x | 3.0.x?
|
||||||
| 2021.2 (Raj) | 4.4.x | 7.17.3 | 5.3.x | 2.7.x
|
| 2021.2 (Raj) | 4.4.x | 7.17.3 | 5.3.x | 2.7.x
|
||||||
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
|
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
|
||||||
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
|
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
|
||||||
|
@ -159,4 +159,4 @@ The old deprecated `RestHighLevelClient` can still be used, but you will need to
|
|||||||
----
|
----
|
||||||
====
|
====
|
||||||
|
|
||||||
Make sure to specify the version 7.17.6 explicitly, otherwise maven will resolve to 8.4.3, and this does not exist.
|
Make sure to specify the version 7.17.6 explicitly, otherwise maven will resolve to 8.5.0, and this does not exist.
|
||||||
|
@ -138,8 +138,8 @@ final class DocumentAdapters {
|
|||||||
document.setPrimaryTerm(hit.primaryTerm() != null && hit.primaryTerm() > 0 ? hit.primaryTerm() : 0);
|
document.setPrimaryTerm(hit.primaryTerm() != null && hit.primaryTerm() > 0 ? hit.primaryTerm() : 0);
|
||||||
|
|
||||||
float score = hit.score() != null ? hit.score().floatValue() : Float.NaN;
|
float score = hit.score() != null ? hit.score().floatValue() : Float.NaN;
|
||||||
return new SearchDocumentAdapter(document, score, hit.sort().toArray(new String[0]), documentFields,
|
return new SearchDocumentAdapter(document, score, hit.sort().stream().map(TypeUtils::toString).toArray(),
|
||||||
highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());
|
documentFields, highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SearchDocument from(CompletionSuggestOption<EntityAsMap> completionSuggestOption) {
|
public static SearchDocument from(CompletionSuggestOption<EntityAsMap> completionSuggestOption) {
|
||||||
|
@ -19,6 +19,7 @@ import static org.springframework.data.elasticsearch.client.elc.TypeUtils.*;
|
|||||||
import static org.springframework.util.CollectionUtils.*;
|
import static org.springframework.util.CollectionUtils.*;
|
||||||
|
|
||||||
import co.elastic.clients.elasticsearch._types.Conflicts;
|
import co.elastic.clients.elasticsearch._types.Conflicts;
|
||||||
|
import co.elastic.clients.elasticsearch._types.FieldValue;
|
||||||
import co.elastic.clients.elasticsearch._types.InlineScript;
|
import co.elastic.clients.elasticsearch._types.InlineScript;
|
||||||
import co.elastic.clients.elasticsearch._types.OpType;
|
import co.elastic.clients.elasticsearch._types.OpType;
|
||||||
import co.elastic.clients.elasticsearch._types.SortOptions;
|
import co.elastic.clients.elasticsearch._types.SortOptions;
|
||||||
@ -735,7 +736,7 @@ class RequestConverter {
|
|||||||
|
|
||||||
ReindexRequest.Slice slice = source.getSlice();
|
ReindexRequest.Slice slice = source.getSlice();
|
||||||
if (slice != null) {
|
if (slice != null) {
|
||||||
s.slice(sl -> sl.id(slice.getId()).max(slice.getMax()));
|
s.slice(sl -> sl.id(String.valueOf(slice.getId())).max(slice.getMax()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.getQuery() != null) {
|
if (source.getQuery() != null) {
|
||||||
@ -1100,7 +1101,8 @@ class RequestConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(query.getSearchAfter())) {
|
if (!isEmpty(query.getSearchAfter())) {
|
||||||
bb.searchAfter(query.getSearchAfter().stream().map(Object::toString).collect(Collectors.toList()));
|
bb.searchAfter(query.getSearchAfter().stream().map(it -> FieldValue.of(it.toString()))
|
||||||
|
.collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
query.getRescorerQueries().forEach(rescorerQuery -> bb.rescore(getRescore(rescorerQuery)));
|
query.getRescorerQueries().forEach(rescorerQuery -> bb.rescore(getRescore(rescorerQuery)));
|
||||||
@ -1241,7 +1243,8 @@ class RequestConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isEmpty(query.getSearchAfter())) {
|
if (!isEmpty(query.getSearchAfter())) {
|
||||||
builder.searchAfter(query.getSearchAfter().stream().map(Object::toString).collect(Collectors.toList()));
|
builder.searchAfter(
|
||||||
|
query.getSearchAfter().stream().map(it -> FieldValue.of(it.toString())).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
|
|
||||||
query.getRescorerQueries().forEach(rescorerQuery -> builder.rescore(getRescore(rescorerQuery)));
|
query.getRescorerQueries().forEach(rescorerQuery -> builder.rescore(getRescore(rescorerQuery)));
|
||||||
|
@ -95,6 +95,37 @@ final class TypeUtils {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
static String toString(@Nullable FieldValue fieldValue) {
|
||||||
|
|
||||||
|
if (fieldValue == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (fieldValue._kind()) {
|
||||||
|
case Double -> {
|
||||||
|
return String.valueOf(fieldValue.doubleValue());
|
||||||
|
}
|
||||||
|
case Long -> {
|
||||||
|
return String.valueOf(fieldValue.longValue());
|
||||||
|
}
|
||||||
|
case Boolean -> {
|
||||||
|
return String.valueOf(fieldValue.booleanValue());
|
||||||
|
}
|
||||||
|
case String -> {
|
||||||
|
return fieldValue.stringValue();
|
||||||
|
}
|
||||||
|
case Null -> {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
case Any -> {
|
||||||
|
return fieldValue.anyValue().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
default -> throw new IllegalStateException("Unexpected value: " + fieldValue._kind());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
static GeoDistanceType geoDistanceType(GeoDistanceOrder.DistanceType distanceType) {
|
static GeoDistanceType geoDistanceType(GeoDistanceOrder.DistanceType distanceType) {
|
||||||
|
|
||||||
|
@ -104,15 +104,15 @@ public class ReactiveElasticsearchELCIntegrationTests extends ReactiveElasticsea
|
|||||||
assertThat(bucketList.size()).isEqualTo(3);
|
assertThat(bucketList.size()).isEqualTo(3);
|
||||||
AtomicInteger count = new AtomicInteger();
|
AtomicInteger count = new AtomicInteger();
|
||||||
bucketList.forEach(stringTermsBucket -> {
|
bucketList.forEach(stringTermsBucket -> {
|
||||||
if ("message".equals(stringTermsBucket.key())) {
|
if ("message".equals(stringTermsBucket.key().stringValue())) {
|
||||||
count.getAndIncrement();
|
count.getAndIncrement();
|
||||||
assertThat(stringTermsBucket.docCount()).isEqualTo(3);
|
assertThat(stringTermsBucket.docCount()).isEqualTo(3);
|
||||||
}
|
}
|
||||||
if ("some".equals(stringTermsBucket.key())) {
|
if ("some".equals(stringTermsBucket.key().stringValue())) {
|
||||||
count.getAndIncrement();
|
count.getAndIncrement();
|
||||||
assertThat(stringTermsBucket.docCount()).isEqualTo(2);
|
assertThat(stringTermsBucket.docCount()).isEqualTo(2);
|
||||||
}
|
}
|
||||||
if ("other".equals(stringTermsBucket.key())) {
|
if ("other".equals(stringTermsBucket.key().stringValue())) {
|
||||||
count.getAndIncrement();
|
count.getAndIncrement();
|
||||||
assertThat(stringTermsBucket.docCount()).isEqualTo(1);
|
assertThat(stringTermsBucket.docCount()).isEqualTo(1);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,6 @@ abstract class QueryKeywordsIntegrationTests {
|
|||||||
assertThat(products).isEmpty();
|
assertThat(products).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled("issue #2300, Elasticsearch bug https://github.com/elastic/elasticsearch/issues/89760")
|
|
||||||
@Test // #1909
|
@Test // #1909
|
||||||
@DisplayName("should find by property exists")
|
@DisplayName("should find by property exists")
|
||||||
void shouldFindByPropertyExists() {
|
void shouldFindByPropertyExists() {
|
||||||
@ -276,7 +275,6 @@ abstract class QueryKeywordsIntegrationTests {
|
|||||||
assertThat(searchHits.getTotalHits()).isEqualTo(6);
|
assertThat(searchHits.getTotalHits()).isEqualTo(6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Disabled("issue #2300, Elasticsearch bug https://github.com/elastic/elasticsearch/issues/89760")
|
|
||||||
@Test // #1909
|
@Test // #1909
|
||||||
@DisplayName("should find by property is not null")
|
@DisplayName("should find by property is not null")
|
||||||
void shouldFindByPropertyIsNotNull() {
|
void shouldFindByPropertyIsNotNull() {
|
||||||
|
@ -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=8.4.3
|
sde.testcontainers.image-version=8.5.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