Skip to content

Commit 87be6db

Browse files
authored
Upgrade to Elasticsearch 7.17.8.
Original Pull Request #2413 Closes #2401
1 parent bb05d0b commit 87be6db

File tree

7 files changed

+37
-11
lines changed

7 files changed

+37
-11
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919

2020
<properties>
2121
<!-- version of the RestHighLevelClient -->
22-
<elasticsearch-rhlc>7.17.7</elasticsearch-rhlc>
22+
<elasticsearch-rhlc>7.17.8</elasticsearch-rhlc>
2323
<!-- version of the new ElasticsearchClient -->
24-
<elasticsearch-java>7.17.7</elasticsearch-java>
24+
<elasticsearch-java>7.17.8</elasticsearch-java>
2525
<log4j>2.17.1</log4j>
2626
<netty>4.1.65.Final</netty>
2727
<springdata.commons>2.7.7-SNAPSHOT</springdata.commons>

src/main/asciidoc/preface.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ built and tested.
3737
[cols="^,^,^,^,^",options="header"]
3838
|===
3939
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework | Spring Boot
40-
| 2021.2 (Raj) | 4.4.x | 7.17.7 | 5.3.x | 2.7.x
40+
| 2021.2 (Raj) | 4.4.x | 7.17.8 | 5.3.x | 2.7.x
4141
| 2021.1 (Q) | 4.3.x | 7.15.2 | 5.3.x | 2.6.x
4242
| 2021.0 (Pascal) | 4.2.xfootnote:oom[Out of maintenance] | 7.12.0 | 5.3.x | 2.5.x
4343
| 2020.0 (Ockham)footnote:oom[] | 4.1.xfootnote:oom[] | 7.9.3 | 5.3.2 | 2.4.x

src/main/asciidoc/reference/elasticsearch-migration-guide-4.3-4.4.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ The dependencies for the new Elasticsearch client are still optional in Spring D
8282
<dependency>
8383
<groupId>co.elastic.clients</groupId>
8484
<artifactId>elasticsearch-java</artifactId>
85-
<version>7.17.7</version>
85+
<version>7.17.8</version>
8686
<exclusions>
8787
<exclusion>
8888
<groupId>commons-logging</groupId>
@@ -93,7 +93,7 @@ The dependencies for the new Elasticsearch client are still optional in Spring D
9393
<dependency>
9494
<groupId>org.elasticsearch.client</groupId>
9595
<artifactId>elasticsearch-rest-client</artifactId> <!-- is Apache 2-->
96-
<version>7.17.7</version>
96+
<version>7.17.8</version>
9797
<exclusions>
9898
<exclusion>
9999
<groupId>commons-logging</groupId>

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,8 @@ public static SearchDocument from(Hit<?> hit, JsonpMapper jsonpMapper) {
138138
document.setPrimaryTerm(hit.primaryTerm() != null && hit.primaryTerm() > 0 ? hit.primaryTerm() : 0);
139139

140140
float score = hit.score() != null ? hit.score().floatValue() : Float.NaN;
141-
return new SearchDocumentAdapter(document, score, hit.sort().toArray(new String[0]), documentFields,
142-
highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing());
143-
}
141+
return new SearchDocumentAdapter(document, score, hit.sort().stream().map(TypeUtils::toString).toArray(),
142+
documentFields, highlightFields, innerHits, nestedMetaData, explanation, matchedQueries, hit.routing()); }
144143

145144
@Nullable
146145
private static Explanation from(@Nullable co.elastic.clients.elasticsearch.core.explain.Explanation explanation) {

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static org.springframework.util.CollectionUtils.*;
2020

2121
import co.elastic.clients.elasticsearch._types.Conflicts;
22+
import co.elastic.clients.elasticsearch._types.FieldValue;
2223
import co.elastic.clients.elasticsearch._types.InlineScript;
2324
import co.elastic.clients.elasticsearch._types.OpType;
2425
import co.elastic.clients.elasticsearch._types.SortOptions;
@@ -754,7 +755,7 @@ public co.elastic.clients.elasticsearch.core.ReindexRequest reindex(ReindexReque
754755

755756
ReindexRequest.Slice slice = source.getSlice();
756757
if (slice != null) {
757-
s.slice(sl -> sl.id(slice.getId()).max(slice.getMax()));
758+
s.slice(sl -> sl.id(String.valueOf(slice.getId())).max(slice.getMax()));
758759
}
759760

760761
if (source.getQuery() != null) {
@@ -1168,7 +1169,8 @@ private <T> void prepareSearchRequest(Query query, @Nullable Class<T> clazz, Ind
11681169
}
11691170

11701171
if (!isEmpty(query.getSearchAfter())) {
1171-
builder.searchAfter(query.getSearchAfter().stream().map(Object::toString).collect(Collectors.toList()));
1172+
builder.searchAfter(
1173+
query.getSearchAfter().stream().map(it -> FieldValue.of(it.toString())).collect(Collectors.toList()));
11721174
}
11731175

11741176
query.getRescorerQueries().forEach(rescorerQuery -> {

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,31 @@ static FieldType fieldType(String type) {
122122
return null;
123123
}
124124

125+
@Nullable
126+
static String toString(@Nullable FieldValue fieldValue) {
127+
128+
if (fieldValue == null) {
129+
return null;
130+
}
131+
132+
switch (fieldValue._kind()) {
133+
case Double:
134+
return String.valueOf(fieldValue.doubleValue());
135+
case Long:
136+
return String.valueOf(fieldValue.longValue());
137+
case Boolean:
138+
return String.valueOf(fieldValue.booleanValue());
139+
case String:
140+
return fieldValue.stringValue();
141+
case Null:
142+
return null;
143+
case Any:
144+
return fieldValue.anyValue().toString();
145+
default:
146+
throw new IllegalStateException("Unexpected value: " + fieldValue._kind());
147+
}
148+
}
149+
125150
@Nullable
126151
static GeoDistanceType geoDistanceType(GeoDistanceOrder.DistanceType distanceType) {
127152

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