Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f1ae49765 | |||
| b29fbeeecf | |||
| 8c05e42a1b | |||
| c5fbdfc0ce |
@@ -5,12 +5,12 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-elasticsearch</artifactId>
|
||||
<version>6.1.1</version>
|
||||
<version>6.1.2-SNAPSHOT</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<version>4.1.2-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<name>Spring Data Elasticsearch</name>
|
||||
@@ -18,10 +18,10 @@
|
||||
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
|
||||
|
||||
<properties>
|
||||
<springdata.commons>4.1.1</springdata.commons>
|
||||
<springdata.commons>4.1.2-SNAPSHOT</springdata.commons>
|
||||
|
||||
<!-- version of the ElasticsearchClient -->
|
||||
<elasticsearch-java>9.4.5</elasticsearch-java>
|
||||
<elasticsearch-java>9.4.6</elasticsearch-java>
|
||||
<elasticsearch-rest-client>9.4.5</elasticsearch-rest-client>
|
||||
|
||||
<hoverfly>0.20.2</hoverfly>
|
||||
@@ -508,8 +508,20 @@
|
||||
</profiles>
|
||||
|
||||
<repositories>
|
||||
|
||||
|
||||
<repository>
|
||||
<id>spring-snapshot</id>
|
||||
<url>https://repo.spring.io/snapshot</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>spring-milestone</id>
|
||||
<url>https://repo.spring.io/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
[[new-features]]
|
||||
= What's new
|
||||
|
||||
[[new-features.6-1-2]]
|
||||
== New in Spring Data Elasticsearch 6.1.2
|
||||
|
||||
* Upgrade to Elasticsearch client 9.4.6
|
||||
* Fix formatting of DateFormat.strict_date_optional_time_nanos (https://github.com/spring-projects/spring-data-elasticsearch/issues/3334[GH #3334])
|
||||
|
||||
[[new-features.6-1-1]]
|
||||
== New in Spring Data Elasticsearch 6.1.1
|
||||
|
||||
|
||||
@@ -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
|
||||
| 2026.0 | 6.1.x | 9.4.5 | 7.0.x
|
||||
| 2026.0 | 6.1.x | 9.4.6 | 7.0.x
|
||||
| 2025.1 | 6.0.x | 9.2.2 | 7.0.x
|
||||
| 2025.0 | 5.5.xfootnote:oom[Out of maintenance] | 8.18.1 | 6.2.x
|
||||
| 2024.1 | 5.4.xfootnote:oom[] | 8.15.5 | 6.1.x
|
||||
|
||||
@@ -88,7 +88,7 @@ public enum DateFormat {
|
||||
* @since 5.3
|
||||
*/
|
||||
strict_date_optional_time("uuuu-MM-dd['T'HH:mm:ss.SSSXXX]"), //
|
||||
strict_date_optional_time_nanos("uuuu-MM-dd['T'HH:mm:ss.SSSSSSXXX]"), //
|
||||
strict_date_optional_time_nanos("uuuu-MM-dd['T'HH:mm:ss.SSSSSSSSSXXX]"), //
|
||||
date_time("uuuu-MM-dd'T'HH:mm:ss.SSSXXX"), //
|
||||
/**
|
||||
* @since 5.3
|
||||
|
||||
+7
-27
@@ -70,11 +70,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
@@ -234,7 +234,8 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
for (Alias alias : indexSettings.getAliases()) {
|
||||
co.elastic.clients.elasticsearch.indices.Alias esAlias = co.elastic.clients.elasticsearch.indices.Alias
|
||||
.of(ab -> {
|
||||
co.elastic.clients.elasticsearch.indices.Alias.Builder aliasBuilder = ab.filter(getQuery(alias.getFilter(), null))
|
||||
co.elastic.clients.elasticsearch.indices.Alias.Builder aliasBuilder = ab
|
||||
.filter(getQuery(alias.getFilter(), null))
|
||||
.isHidden(alias.getHidden())
|
||||
.isWriteIndex(alias.getWriteIndex());
|
||||
getRouting(alias.getRouting()).ifPresent(aliasBuilder::routing);
|
||||
@@ -807,7 +808,7 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
Assert.notNull(indexCoordinates, "indexCoordinates must not be null");
|
||||
|
||||
return GetRequest.of(grb -> {
|
||||
GetRequest.Builder builder = grb //
|
||||
GetRequest.Builder builder = grb //
|
||||
.index(indexCoordinates.getIndexName()) //
|
||||
.id(id); //
|
||||
getRouting(routing).ifPresent(builder::routing);
|
||||
@@ -846,7 +847,7 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
|
||||
List<MultiGetOperation> multiGetOperations = query.getIdsWithRouting().stream()
|
||||
.map(idWithRouting -> MultiGetOperation.of(mgo -> {
|
||||
MultiGetOperation.Builder builder = mgo //
|
||||
MultiGetOperation.Builder builder = mgo //
|
||||
.index(index.getIndexName()) //
|
||||
.id(idWithRouting.id()) //
|
||||
.source(sourceConfig);
|
||||
@@ -1071,29 +1072,7 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
return UpdateRequest.of(uqb -> {
|
||||
uqb.index(indexName).id(query.getId());
|
||||
|
||||
var scriptData = query.getScriptData();
|
||||
var script = scriptData != null ? scriptData.script() : null;
|
||||
|
||||
if (script != null) {
|
||||
Map<String, JsonData> params = new HashMap<>();
|
||||
|
||||
if (query.getParams() != null) {
|
||||
query.getParams().forEach((key, value) -> params.put(key, JsonData.of(value, jsonpMapper)));
|
||||
}
|
||||
|
||||
uqb.script(sb -> {
|
||||
sb
|
||||
.lang(scriptData.language())
|
||||
.params(params);
|
||||
|
||||
if (script != null) {
|
||||
sb.source(s -> s.scriptString(script));
|
||||
}
|
||||
sb.id(scriptData.scriptName());
|
||||
|
||||
return sb;
|
||||
});
|
||||
}
|
||||
uqb.script(getScript(query.getScriptData()));
|
||||
|
||||
uqb
|
||||
.doc(query.getDocument())
|
||||
@@ -1980,6 +1959,7 @@ class RequestConverter extends AbstractQueryProcessor {
|
||||
}
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
Optional<String> getRouting(@Nullable String routing1, @Nullable String routing2) {
|
||||
return getRouting(routing1).or(() -> getRouting(routing2));
|
||||
}
|
||||
|
||||
+22
-1
@@ -16,6 +16,10 @@
|
||||
package org.springframework.data.elasticsearch.client.elc;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
@@ -131,10 +135,28 @@ class RequestConverterTest {
|
||||
.documentUpdateRequest(updateQuery, IndexCoordinates.of("foo"), null, null);
|
||||
|
||||
assertThat(updateRequest.id()).isEqualTo("queryId");
|
||||
assertThat(updateRequest.script()).isNotNull();
|
||||
assertThat(updateRequest.script().source().scriptString()).isEqualTo("script");
|
||||
assertThat(updateRequest.script().id()).isEqualTo("scriptName");
|
||||
}
|
||||
|
||||
@Test // #3324
|
||||
@DisplayName("should allow update script with only an id and no script code")
|
||||
void shouldAllowUpdateScriptWithOnlyAnIdAndNoScriptCode() {
|
||||
var updateQuery = UpdateQuery
|
||||
.builder("queryId")
|
||||
.withScriptName("scriptName")
|
||||
.build();
|
||||
|
||||
UpdateRequest<org.springframework.data.elasticsearch.core.document.Document, ?> updateRequest = requestConverter
|
||||
.documentUpdateRequest(updateQuery, IndexCoordinates.of("foo"), null, null);
|
||||
|
||||
assertThat(updateRequest.id()).isEqualTo("queryId");
|
||||
assertThat(updateRequest.script()).isNotNull();
|
||||
assertThat(updateRequest.script().source()).isNull();
|
||||
assertThat(updateRequest.script().id()).isEqualTo("scriptName");
|
||||
}
|
||||
|
||||
@Test
|
||||
void getRouting() {
|
||||
|
||||
@@ -148,5 +170,4 @@ class RequestConverterTest {
|
||||
assertEquals("5", requestConverter.getRouting(null, "5").get());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+10
-4
@@ -27,7 +27,8 @@ import org.springframework.data.elasticsearch.annotations.DateFormat;
|
||||
*/
|
||||
class ElasticsearchDateConverterUnitTests {
|
||||
|
||||
private final ZonedDateTime zdt = ZonedDateTime.now(ZoneId.of("Europe/Berlin"));
|
||||
public static final ZoneId zoneEuropeBerlin = ZoneId.of("Europe/Berlin");
|
||||
private final ZonedDateTime zdt = ZonedDateTime.now(zoneEuropeBerlin);
|
||||
|
||||
@ParameterizedTest // DATAES-716
|
||||
@EnumSource(DateFormat.class)
|
||||
@@ -274,10 +275,14 @@ class ElasticsearchDateConverterUnitTests {
|
||||
check(ElasticsearchDateConverter.of(DateFormat.date_optional_time), LocalDateTime.class);
|
||||
}
|
||||
|
||||
@Test // #2676
|
||||
@Test // #2676, #3334
|
||||
@DisplayName("should convert strict_date_optional_time_nanos")
|
||||
void shouldConvertStrictDateOptionalTime() {
|
||||
check(ElasticsearchDateConverter.of(DateFormat.strict_date_optional_time_nanos), LocalDateTime.class);
|
||||
LocalDateTime parsed = check(ElasticsearchDateConverter.of(DateFormat.strict_date_optional_time_nanos),
|
||||
LocalDateTime.class);
|
||||
// additional check that all nanoseconds are re-read
|
||||
var zoned = ZonedDateTime.of(parsed, zoneEuropeBerlin);
|
||||
assertThat(zoned).isEqualTo(zdt);
|
||||
}
|
||||
|
||||
@Test // #1647
|
||||
@@ -418,11 +423,12 @@ class ElasticsearchDateConverterUnitTests {
|
||||
check(ElasticsearchDateConverter.of("basic_date_time ||invalid-pattern"), LocalDateTime.class);
|
||||
}
|
||||
|
||||
private <T extends TemporalAccessor> void check(ElasticsearchDateConverter converter, Class<T> type) {
|
||||
private <T extends TemporalAccessor> T check(ElasticsearchDateConverter converter, Class<T> type) {
|
||||
|
||||
String formatted = converter.format(zdt);
|
||||
T parsed = converter.parse(formatted, type);
|
||||
|
||||
assertThat(parsed).isNotNull();
|
||||
return parsed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user