Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 589961022d | |||
| 851525a052 | |||
| 1bc42a9a9a | |||
| 971dcda1f5 | |||
| 93d03830e0 | |||
| 16ce9444da | |||
| d59c32d29e | |||
| 5713e5bfa6 | |||
| 56a2548156 | |||
| 91ff345cf2 | |||
| 168242fbd0 | |||
| 138760dad7 | |||
| 4bb6cb6f86 | |||
| 09af4f9917 | |||
| cdd0df7dd4 | |||
| 3fee02c17e | |||
| a92b57aedd | |||
| 0b6a77be3b | |||
| 9a2b3b1317 | |||
| 171ea62b9b | |||
| 3b2ff95702 |
@@ -5,12 +5,12 @@
|
||||
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-elasticsearch</artifactId>
|
||||
<version>4.1.4</version>
|
||||
<version>4.1.7</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.data.build</groupId>
|
||||
<artifactId>spring-data-parent</artifactId>
|
||||
<version>2.4.4</version>
|
||||
<version>2.4.7</version>
|
||||
</parent>
|
||||
|
||||
<name>Spring Data Elasticsearch</name>
|
||||
@@ -22,7 +22,7 @@
|
||||
<elasticsearch>7.9.3</elasticsearch>
|
||||
<log4j>2.13.3</log4j>
|
||||
<netty>4.1.52.Final</netty>
|
||||
<springdata.commons>2.4.4</springdata.commons>
|
||||
<springdata.commons>2.4.7</springdata.commons>
|
||||
<testcontainers>1.15.1</testcontainers>
|
||||
<java-module-name>spring.data.elasticsearch</java-module-name>
|
||||
</properties>
|
||||
|
||||
+4
@@ -823,6 +823,10 @@ public class DefaultReactiveElasticsearchClient implements ReactiveElasticsearch
|
||||
String mediaType = response.headers().contentType().map(MediaType::toString).orElse(XContentType.JSON.mediaType());
|
||||
|
||||
return response.body(BodyExtractors.toMono(byte[].class)) //
|
||||
.switchIfEmpty(Mono
|
||||
.error(new ElasticsearchStatusException(String.format("%s request to %s returned error code %s and no body.",
|
||||
request.getMethod(), request.getEndpoint(), statusCode), status))
|
||||
)
|
||||
.map(bytes -> new String(bytes, StandardCharsets.UTF_8)) //
|
||||
.flatMap(content -> contentOrError(content, mediaType, status))
|
||||
.flatMap(unused -> Mono
|
||||
|
||||
@@ -1,6 +1,83 @@
|
||||
Spring Data Elasticsearch Changelog
|
||||
===================================
|
||||
|
||||
Changes in version 4.1.7 (2021-03-31)
|
||||
-------------------------------------
|
||||
|
||||
|
||||
Changes in version 4.2.0-RC1 (2021-03-31)
|
||||
-----------------------------------------
|
||||
* #1745 - Automatically close scroll context when returning streamed results.
|
||||
* #1741 - Upgrade to Elasticsearch 7.12.
|
||||
* #1738 - Readme lists artifacts with .RELEASE and .BUILD-SNAPSHOT suffixes.
|
||||
* #1736 - Upgrade to OpenWebBeans 2.0.
|
||||
* #1734 - Remove lombok.
|
||||
* #1733 - Update CI to Java 16.
|
||||
* #1727 - Allow multiple date formats for date fields.
|
||||
* #1719 - Configure index settings with @Setting annotation.
|
||||
|
||||
|
||||
Changes in version 4.2.0-M5 (2021-03-17)
|
||||
----------------------------------------
|
||||
* #1725 - Add support for SearchTemplate for reactive client.
|
||||
* #1721 - IndexOps.getMapping raises exception if mapping contains "dynamic_templates".
|
||||
* #1718 - Create index with mapping in one step.
|
||||
* #1712 - Requests with ReactiveElasticsearchRepository methods doesn't fail if it can't connect with Elasticsearch.
|
||||
* #1711 - Add the type hint _class attribute to the index mapping.
|
||||
* #1704 - Add SearchFailure field in ByQueryResponse.
|
||||
* #1700 - Add missing "Document ranking types".
|
||||
* #1687 - Upgrade to Elasticsearch 7.11.
|
||||
* #1686 - Add rescore functionality.
|
||||
* #1678 - Errors are silent in multiGet.
|
||||
* #1658 - ReactiveElasticsearchClient should use the same request parameters as non-reactive code.
|
||||
* #1646 - Add function to list all indexes.
|
||||
* #1514 - Add `matched_queries` field in SearchHit [DATAES-979].
|
||||
|
||||
|
||||
Changes in version 4.1.6 (2021-03-17)
|
||||
-------------------------------------
|
||||
* #1712 - Requests with ReactiveElasticsearchRepository methods doesn't fail if it can't connect with Elasticsearch.
|
||||
|
||||
|
||||
Changes in version 4.0.8.RELEASE (2021-03-17)
|
||||
---------------------------------------------
|
||||
* #1712 - Requests with ReactiveElasticsearchRepository methods doesn't fail if it can't connect with Elasticsearch.
|
||||
|
||||
|
||||
Changes in version 4.2.0-M4 (2021-02-18)
|
||||
----------------------------------------
|
||||
|
||||
|
||||
Changes in version 4.1.5 (2021-02-18)
|
||||
-------------------------------------
|
||||
|
||||
|
||||
Changes in version 4.2.0-M3 (2021-02-17)
|
||||
----------------------------------------
|
||||
* #1689 - Missing anchor links in documentation.
|
||||
* #1680 - After upgrade to 4.x can't read property id from _source named (different value from _id).
|
||||
* #1679 - Errors are silent in delete by query in ReactiveElasticsearchTemplate.
|
||||
* #1676 - Align MappingElasticsearchConverter with other Spring Data converters.
|
||||
* #1675 - Consider Document as simple type.
|
||||
* #1669 - Cleanup Deprecations from 4.0.
|
||||
* #1668 - Writing a more complex CriteriaQuery.
|
||||
* #1667 - Couldn't find PersistentEntity for type class com.example.demo.dto.Address.
|
||||
* #1665 - ReactiveElasticsearchOperations indexName twice endcoding.
|
||||
* #1662 - Documentation fix.
|
||||
* #1659 - Fix source filter setup in multiget requests.
|
||||
* #1655 - GeoJson types can be lowercase in Elasticsearch.
|
||||
* #1649 - Upgrade to Elasticsearch 7.10.2.
|
||||
* #1647 - Use own implementation of date formatters.
|
||||
* #1644 - Implement update by query.
|
||||
* #1565 - Allow using FieldNamingStrategy for property to fieldname matching [DATAES-993].
|
||||
* #1370 - Add enabled mapping parameter to FieldType configuration [DATAES-798].
|
||||
* #1218 - Add routing parameter to ElasticsearchOperations [DATAES-644].
|
||||
* #1156 - Add @CountQuery annotation [DATAES-584].
|
||||
* #1143 - Support for search_after [DATAES-571].
|
||||
* #803 - Don't update indexed object if it is no persistent entity [DATAES-229].
|
||||
* #725 - Add query Explain Support [DATAES-149].
|
||||
|
||||
|
||||
Changes in version 4.1.4 (2021-02-17)
|
||||
-------------------------------------
|
||||
* #1667 - Couldn't find PersistentEntity for type class com.example.demo.dto.Address.
|
||||
@@ -1484,6 +1561,14 @@ Release Notes - Spring Data Elasticsearch - Version 1.0 M1 (2014-02-07)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Spring Data Elasticsearch 4.1.4 (2020.0.4)
|
||||
Spring Data Elasticsearch 4.1.7 (2020.0.7)
|
||||
Copyright (c) [2013-2019] Pivotal Software, Inc.
|
||||
|
||||
This product is licensed to you under the Apache License, Version 2.0 (the "License").
|
||||
@@ -24,3 +24,6 @@ conditions of the subcomponent's license, as noted in the LICENSE file.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+49
-17
@@ -22,20 +22,29 @@ import static org.mockito.Mockito.*;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.test.StepVerifier;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.elasticsearch.ElasticsearchStatusException;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.reactive.function.client.ClientResponse;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
import org.springframework.web.reactive.function.client.WebClient.ResponseSpec;
|
||||
import org.springframework.web.util.UriBuilder;
|
||||
|
||||
/**
|
||||
* @author Peter-Josef Meisch
|
||||
@@ -46,29 +55,23 @@ class DefaultReactiveElasticsearchClientTest {
|
||||
@Mock private HostProvider hostProvider;
|
||||
|
||||
@Mock private Function<SearchRequest, Request> searchRequestConverter;
|
||||
@Spy private RequestCreator requestCreator;
|
||||
|
||||
private DefaultReactiveElasticsearchClient client;
|
||||
@Mock private WebClient webClient;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
client = new DefaultReactiveElasticsearchClient(hostProvider, new RequestCreator() {
|
||||
@Override
|
||||
public Function<SearchRequest, Request> search() {
|
||||
return searchRequestConverter;
|
||||
}
|
||||
}) {
|
||||
@Test
|
||||
void shouldSetAppropriateRequestParametersOnCount() {
|
||||
|
||||
when(requestCreator.search()).thenReturn(searchRequestConverter);
|
||||
SearchRequest searchRequest = new SearchRequest("someindex") //
|
||||
.source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery()));
|
||||
|
||||
ReactiveElasticsearchClient client = new DefaultReactiveElasticsearchClient(hostProvider, requestCreator) {
|
||||
@Override
|
||||
public Mono<ResponseSpec> execute(ReactiveElasticsearchClientCallback callback) {
|
||||
return Mono.empty();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldSetAppropriateRequestParametersOnCount() {
|
||||
|
||||
SearchRequest searchRequest = new SearchRequest("someindex") //
|
||||
.source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery()));
|
||||
|
||||
client.count(searchRequest).as(StepVerifier::create).verifyComplete();
|
||||
|
||||
@@ -79,4 +82,33 @@ class DefaultReactiveElasticsearchClientTest {
|
||||
assertThat(source.trackTotalHitsUpTo()).isEqualTo(TRACK_TOTAL_HITS_ACCURATE);
|
||||
assertThat(source.fetchSource()).isEqualTo(FetchSourceContext.DO_NOT_FETCH_SOURCE);
|
||||
}
|
||||
|
||||
@Test // #1712
|
||||
@DisplayName("should throw ElasticsearchStatusException on server 5xx with empty body")
|
||||
void shouldThrowElasticsearchStatusExceptionOnServer5xxWithEmptyBody() {
|
||||
|
||||
when(hostProvider.getActive(any())).thenReturn(Mono.just(webClient));
|
||||
WebClient.RequestBodyUriSpec requestBodyUriSpec = mock(WebClient.RequestBodyUriSpec.class);
|
||||
when(requestBodyUriSpec.uri((Function<UriBuilder, URI>) any())).thenReturn(requestBodyUriSpec);
|
||||
when(requestBodyUriSpec.attribute(any(), any())).thenReturn(requestBodyUriSpec);
|
||||
when(requestBodyUriSpec.headers(any())).thenReturn(requestBodyUriSpec);
|
||||
when(webClient.method(any())).thenReturn(requestBodyUriSpec);
|
||||
when(requestBodyUriSpec.exchangeToMono(any())).thenAnswer(invocationOnMock -> {
|
||||
Function<ClientResponse, ? extends Mono<?>> responseHandler = invocationOnMock.getArgument(0);
|
||||
ClientResponse clientResponse = mock(ClientResponse.class);
|
||||
when(clientResponse.statusCode()).thenReturn(HttpStatus.SERVICE_UNAVAILABLE);
|
||||
ClientResponse.Headers headers = mock(ClientResponse.Headers.class);
|
||||
when(headers.contentType()).thenReturn(Optional.empty());
|
||||
when(clientResponse.headers()).thenReturn(headers);
|
||||
when(clientResponse.body(any())).thenReturn(Mono.empty());
|
||||
return responseHandler.apply(clientResponse);
|
||||
});
|
||||
|
||||
ReactiveElasticsearchClient client = new DefaultReactiveElasticsearchClient(hostProvider, requestCreator);
|
||||
|
||||
client.get(new GetRequest("42")) //
|
||||
.as(StepVerifier::create) //
|
||||
.expectError(ElasticsearchStatusException.class) //
|
||||
.verify(); //
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user