1
0
mirror of synced 2026-05-23 20:53:17 +00:00

Compare commits

...

8 Commits

Author SHA1 Message Date
Jens Schauder 950ca0fc2a Release version 5.3.4 (2024.0.4).
See #2966
2024-09-13 11:36:55 +02:00
Jens Schauder 95a86f558b Prepare 5.3.4 (2024.0.4).
See #2966
2024-09-13 11:36:35 +02:00
Peter-Josef Meisch 8117e5a174 Remove Blockhound
Original Pull Request #2978
Closes #2977

(cherry picked from commit d06c122fd5)
2024-09-04 18:17:42 +02:00
HAN SEUNGWOO 3a9a959918 Set refresh on DeleteByQueryRequest by DeleteQuery.
Original Pull Request #2976
Closes #2973

(cherry picked from commit b1b232d354)
2024-09-03 20:27:14 +02:00
Peter-Josef Meisch a179dd0643 Add excludeFromSource handling to multifield.
Original Pull Request #2975
Closes #2971

(cherry picked from commit 555b570246)
2024-08-31 21:25:40 +02:00
Peter-Josef Meisch 310ea07c6f Update versions.adoc 2024-08-19 20:27:42 +02:00
Jens Schauder 34a277cd7d After release cleanups.
See #2939
2024-08-16 10:08:54 +02:00
Jens Schauder 878dc029ec Prepare next development iteration.
See #2939
2024-08-16 10:08:53 +02:00
10 changed files with 79 additions and 166 deletions
+3 -30
View File
@@ -5,12 +5,12 @@
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>5.3.3</version>
<version>5.3.4</version>
<parent>
<groupId>org.springframework.data.build</groupId>
<artifactId>spring-data-parent</artifactId>
<version>3.3.3</version>
<version>3.3.4</version>
</parent>
<name>Spring Data Elasticsearch</name>
@@ -18,12 +18,11 @@
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>
<properties>
<springdata.commons>3.3.3</springdata.commons>
<springdata.commons>3.3.4</springdata.commons>
<!-- version of the ElasticsearchClient -->
<elasticsearch-java>8.13.4</elasticsearch-java>
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
<hoverfly>0.14.4</hoverfly>
<log4j>2.18.0</log4j>
<jsonassert>1.5.1</jsonassert>
@@ -248,13 +247,6 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor.tools</groupId>
<artifactId>blockhound-junit-platform</artifactId>
<version>${blockhound-junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
@@ -443,25 +435,6 @@
</build>
</profile>
<profile>
<id>jdk13+</id>
<!-- on jDK13+, Blockhound needs this JVM flag set -->
<activation>
<jdk>[13,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-XX:+AllowRedefinitionToAddDeleteMethods</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>antora-process-resources</id>
<build>
@@ -8,8 +8,8 @@ The following table shows the Elasticsearch and Spring versions that are used by
| Spring Data Release Train | Spring Data Elasticsearch | Elasticsearch | Spring Framework
| 2024.0 | 5.3.3 | 8.13.4 | 6.1.x
| 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
| 2023.0 (Ullmann) | 5.1.xfootnote:oom[Out of maintenance] | 8.7.1 | 6.0.x
| 2022.0 (Turing) | 5.0.xfootnote:oom[] | 8.5.3 | 6.0.x
| 2021.2 (Raj) | 4.4.xfootnote:oom[] | 7.17.3 | 5.3.x
| 2021.1 (Q) | 4.3.xfootnote:oom[] | 7.15.2 | 5.3.x
| 2021.0 (Pascal) | 4.2.xfootnote:oom[] | 7.12.0 | 5.3.x
@@ -1021,6 +1021,9 @@ class RequestConverter extends AbstractQueryProcessor {
.collect(Collectors.toList()));
}
}
if (query.getRefresh() != null) {
dqb.refresh(query.getRefresh());
}
dqb.allowNoIndices(query.getAllowNoIndices())
.conflicts(conflicts(query.getConflicts()))
.ignoreUnavailable(query.getIgnoreUnavailable())
@@ -345,8 +345,10 @@ public class MappingBuilder {
: nestedPropertyPrefix + '.' + property.getFieldName();
Field fieldAnnotation = property.findAnnotation(Field.class);
MultiField multiFieldAnnotation = property.findAnnotation(MultiField.class);
if (fieldAnnotation != null && fieldAnnotation.excludeFromSource()) {
if ((fieldAnnotation != null && fieldAnnotation.excludeFromSource()) ||
multiFieldAnnotation != null && multiFieldAnnotation.mainField().excludeFromSource()) {
excludeFromSource.add(nestedPropertyPath);
}
@@ -377,8 +379,6 @@ public class MappingBuilder {
}
}
MultiField multiField = property.findAnnotation(MultiField.class);
if (isCompletionProperty) {
CompletionField completionField = property.findAnnotation(CompletionField.class);
applyCompletionFieldMapping(propertiesNode, property, completionField);
@@ -386,8 +386,8 @@ public class MappingBuilder {
if (isRootObject && fieldAnnotation != null && property.isIdProperty()) {
applyDefaultIdFieldMapping(propertiesNode, property);
} else if (multiField != null) {
addMultiFieldMapping(propertiesNode, property, multiField, isNestedOrObjectProperty, dynamicMapping);
} else if (multiFieldAnnotation != null) {
addMultiFieldMapping(propertiesNode, property, multiFieldAnnotation, isNestedOrObjectProperty, dynamicMapping);
} else if (fieldAnnotation != null) {
addSingleFieldMapping(propertiesNode, property, fieldAnnotation, isNestedOrObjectProperty, dynamicMapping);
}
+2 -1
View File
@@ -1,4 +1,4 @@
Spring Data Elasticsearch 5.3.3 (2024.0.3)
Spring Data Elasticsearch 5.3.4 (2024.0.4)
Copyright (c) [2013-2022] Pivotal Software, Inc.
This product is licensed to you under the Apache License, Version 2.0 (the "License").
@@ -25,3 +25,4 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
@@ -1,48 +0,0 @@
/*
* Copyright 2021-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.blockhound;
import reactor.blockhound.BlockHound;
import reactor.blockhound.BlockingOperationError;
import reactor.blockhound.integration.BlockHoundIntegration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* @author Peter-Josef Meisch
*/
public class BlockHoundIntegrationCustomizer implements BlockHoundIntegration {
private static final Log LOGGER = LogFactory.getLog(BlockHoundIntegrationCustomizer.class);
@Override
public void applyTo(BlockHound.Builder builder) {
// Elasticsearch classes reading from the classpath on initialization, needed for parsing Elasticsearch responses
builder //
.allowBlockingCallsInside("org.elasticsearch.Build", "<clinit>") //
.allowBlockingCallsInside("org.elasticsearch.common.xcontent.XContentBuilder", "<clinit>") // pre 7.16
.allowBlockingCallsInside("org.elasticsearch.common.XContentBuilder", "<clinit>") // from 7.16 on
.allowBlockingCallsInside("org.elasticsearch.xcontent.json.JsonXContent", "contentBuilder") // from 7.16 on
.allowBlockingCallsInside("jakarta.json.spi.JsonProvider", "provider") //
;
builder.blockingMethodCallback(it -> {
LOGGER.error("BlockHound error", new Error(it.toString()));
throw new BlockingOperationError(it);
});
}
}
@@ -1,47 +0,0 @@
/*
* Copyright 2021-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.elasticsearch.blockhound;
import static org.assertj.core.api.Assertions.*;
import reactor.blockhound.BlockingOperationError;
import reactor.core.publisher.Mono;
import java.time.Duration;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
/**
* @author Peter-Josef Meisch
*/
public class BlockHoundTests {
@Test // #1822
@DisplayName("should fail if BlockHound is not installed")
void shouldFailIfBlockHoundIsNotInstalled() {
assertThatThrownBy(() -> {
Mono.delay(Duration.ofMillis(1)).doOnNext(it -> {
try {
Thread.sleep(10);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}).block(); // should throw an exception about Thread.sleep
}).hasCauseInstanceOf(BlockingOperationError.class);
}
}
@@ -30,12 +30,16 @@ import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.convert.MappingElasticsearchConverter;
import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates;
import org.springframework.data.elasticsearch.core.mapping.SimpleElasticsearchMappingContext;
import org.springframework.data.elasticsearch.core.query.Criteria;
import org.springframework.data.elasticsearch.core.query.CriteriaQuery;
import org.springframework.data.elasticsearch.core.query.DeleteQuery;
import org.springframework.data.elasticsearch.core.query.DocValueField;
import org.springframework.data.elasticsearch.core.query.StringQuery;
import org.springframework.lang.Nullable;
/**
* @author Peter-Josef Meisch
* @author Han Seungwoo
*/
class RequestConverterTest {
@@ -72,6 +76,19 @@ class RequestConverterTest {
assertThat(fieldAndFormats.get(1).format()).isEqualTo("format2");
}
@Test // #2973
@DisplayName("should set refresh based on deleteRequest")
void refreshSetByDeleteRequest() {
var query = new CriteriaQuery(new Criteria("text").contains("test"));
var deleteQuery = DeleteQuery.builder(query).withRefresh(true).build();
var deleteByQueryRequest = requestConverter.documentDeleteByQueryRequest(deleteQuery, null, SampleEntity.class,
IndexCoordinates.of("foo"),
null);
assertThat(deleteByQueryRequest.refresh()).isTrue();
}
@Document(indexName = "does-not-matter")
static class SampleEntity {
@Nullable
@@ -1090,38 +1090,49 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
String expected = """
{
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-date": {
"type": "date",
"format": "date"
},
"nestedEntity": {
"type": "nested",
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-text": {
"type": "text"
}
}
}
},
"_source": {
"excludes": [
"excluded-date",
"nestedEntity.excluded-text"
]
}
}
"""; //
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-date": {
"type": "date",
"format": "date"
},
"nestedEntity": {
"type": "nested",
"properties": {
"_class": {
"type": "keyword",
"index": false,
"doc_values": false
},
"excluded-text": {
"type": "text"
}
}
},
"excluded-multifield": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword"
}
}
}
},
"_source": {
"excludes": [
"excluded-date",
"nestedEntity.excluded-text",
"excluded-multifield"
]
}
}
"""; //
String mapping = getMappingBuilder().buildPropertyMapping(ExcludedFieldEntity.class);
@@ -2395,6 +2406,10 @@ public class MappingBuilderUnitTests extends MappingContextBaseTests {
excludeFromSource = true) private LocalDate excludedDate;
@Nullable
@Field(type = Nested) private NestedExcludedFieldEntity nestedEntity;
@Nullable
@MultiField(mainField = @Field(name = "excluded-multifield", type = Text, excludeFromSource = true), otherFields = {
@InnerField(suffix = "keyword", type = Keyword)
}) private String excludedMultifield;
}
@SuppressWarnings("unused")
@@ -1 +0,0 @@
org.springframework.data.elasticsearch.blockhound.BlockHoundIntegrationCustomizer