Skip to content

Commit

Permalink
upgrade to Elasticsearch 7.14.1.
Browse files Browse the repository at this point in the history
Original Pull Request #1933 
Closes #1892
  • Loading branch information
sothawo authored Sep 14, 2021
1 parent fa66702 commit 3128fab
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<url>https://github.com/spring-projects/spring-data-elasticsearch</url>

<properties>
<elasticsearch>7.13.4</elasticsearch>
<elasticsearch>7.14.1</elasticsearch>
<log4j>2.14.1</log4j>
<netty>4.1.65.Final</netty>
<springdata.commons>2.6.0-SNAPSHOT</springdata.commons>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
import org.elasticsearch.client.GetAliasesResponse;
import org.elasticsearch.client.Request;
import org.elasticsearch.client.indices.*;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.get.GetResult;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
import org.elasticsearch.client.analytics.ParsedTopMetrics;
import org.elasticsearch.client.analytics.StringStatsAggregationBuilder;
import org.elasticsearch.client.analytics.TopMetricsAggregationBuilder;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.xcontent.ContextParser;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ParseField;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrixAggregationBuilder;
import org.elasticsearch.search.aggregations.bucket.adjacency.ParsedAdjacencyMatrix;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,8 @@
import org.elasticsearch.cluster.health.ClusterHealthStatus;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.SuppressForbidden;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.lucene.uid.Versions;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.DeprecationHandler;
import org.elasticsearch.common.xcontent.NamedXContentRegistry;
import org.elasticsearch.common.xcontent.ToXContent;
Expand All @@ -90,6 +88,8 @@
import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.mapper.MapperService;
import org.elasticsearch.index.rankeval.RankEvalRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
import org.elasticsearch.index.reindex.UpdateByQueryRequest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import org.elasticsearch.action.support.WriteRequestBuilder;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.UpdateByQueryRequestBuilder;
import org.elasticsearch.search.suggest.SuggestBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import org.elasticsearch.client.indices.PutMappingRequest;
import org.elasticsearch.common.geo.GeoDistance;
import org.elasticsearch.common.unit.DistanceUnit;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.query.MoreLikeThisQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.matching.AnythingPattern;
import com.github.tomakehurst.wiremock.matching.EqualToPattern;
import com.github.tomakehurst.wiremock.stubbing.StubMapping;

/**
* We need hoverfly for testing the reactive code to use a proxy. Wiremock cannot intercept the proxy calls as WebClient
Expand All @@ -66,6 +67,7 @@ void shouldUseConfiguredProxy(ClientUnderTestFactory clientUnderTestFactory, Hov

// wiremock is the dummy server, hoverfly the proxy
WireMock.configureFor(server.port());
stubForElasticsearchVersionCheck();
stubFor(head(urlEqualTo("/")).willReturn(aResponse() //
.withHeader("Content-Type", "application/json; charset=UTF-8")));

Expand Down Expand Up @@ -95,6 +97,7 @@ void shouldConfigureClientAndSetAllRequiredHeaders(ClientUnderTestFactory client

WireMock.configureFor(server.port());

stubForElasticsearchVersionCheck();
stubFor(head(urlEqualTo("/")).willReturn(aResponse() //
.withHeader("Content-Type", "application/json; charset=UTF-8")));

Expand Down Expand Up @@ -144,14 +147,38 @@ void shouldConfigureClientAndSetAllRequiredHeaders(ClientUnderTestFactory client
.withHeader("def1", new EqualToPattern("def1-2")) //
.withHeader("def2", new EqualToPattern("def2-1")) //
.withHeader("supplied", new EqualToPattern("val0")) //
.withHeader("supplied", new EqualToPattern("val" + i)) //
// on the first call Elasticsearch does the version check and thus already increments the counter
.withHeader("supplied", new EqualToPattern("val" + (i + 1))) //
);
}

assertThat(clientConfigurerCount).hasValue(1);
});
}

private StubMapping stubForElasticsearchVersionCheck() {
return stubFor(get(urlEqualTo("/")) //
.willReturn(okJson("{\n" + //
" \"cluster_name\": \"docker-cluster\",\n" + //
" \"cluster_uuid\": \"nKasrfHjRo6ge0eBmMUuAQ\",\n" + //
" \"name\": \"c1a6e517d001\",\n" + //
" \"tagline\": \"You Know, for Search\",\n" + //
" \"version\": {\n" + //
" \"build_date\": \"2021-08-26T09:01:05.390870785Z\",\n" + //
" \"build_flavor\": \"default\",\n" + //
" \"build_hash\": \"66b55ebfa59c92c15db3f69a335d500018b3331e\",\n" + //
" \"build_snapshot\": false,\n" + //
" \"build_type\": \"docker\",\n" + //
" \"lucene_version\": \"8.9.0\",\n" + //
" \"minimum_index_compatibility_version\": \"6.0.0-beta1\",\n" + //
" \"minimum_wire_compatibility_version\": \"6.8.0\",\n" + //
" \"number\": \"7.14.1\"\n" + //
" }\n" + //
"}") //
.withHeader("Content-Type", "application/json; charset=UTF-8") //
.withHeader("X-Elastic-Product", "Elasticsearch")));
}

/**
* Consumer extension that catches checked exceptions and wraps them in a RuntimeException.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import java.util.stream.IntStream;

import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.bulk.BulkRequest;
import org.elasticsearch.action.delete.DeleteRequest;
Expand All @@ -43,7 +42,7 @@
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.client.indices.GetMappingsRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.reindex.BulkByScrollResponse;
import org.elasticsearch.index.reindex.DeleteByQueryRequest;
Expand Down Expand Up @@ -157,7 +156,7 @@ public void pingForUnknownHostShouldReturnFalse() {
public void infoShouldReturnClusterInformation() {

client.info().as(StepVerifier::create) //
.consumeNextWith(it -> assertThat(it.getVersion()).isGreaterThanOrEqualTo(Version.CURRENT)) //
.consumeNextWith(it -> assertThat(it.getVersion()).isNotNull()) //
.verifyComplete();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.VersionType;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms;
Expand Down Expand Up @@ -304,13 +304,13 @@ public void multiGetShouldWorkForNonExistingDocuments() {
.consumeNextWith(result -> {

assertThat(result.isFailed()).isFalse();
assertThat(result.getIndex()).isEqualTo("twitter");
assertThat(result.getId()).isEqualTo("3");
assertThat(result.getIndex()).isEqualTo("twitter");
assertThat(result.getId()).isEqualTo("3");
assertThat(result.getResponse().isExists()).isTrue();
assertThat(result.getResponse().getSource()) //
.containsEntry("user", "elastic") //
.containsEntry("message", "Building the site, should be kewl") //
.containsKey("post_date");
assertThat(result.getResponse().getSource()) //
.containsEntry("user", "elastic") //
.containsEntry("message", "Building the site, should be kewl") //
.containsKey("post_date");
}) //
.verifyComplete();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.elasticsearch.action.support.ActiveShardCount;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequest;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.reindex.UpdateByQueryRequest;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.json.JSONException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.bytes.BytesArray;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.action.update.UpdateRequestBuilder;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.index.engine.DocumentMissingException;
import org.elasticsearch.index.reindex.UpdateByQueryRequestBuilder;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/testcontainers-elasticsearch.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# properties defining the image, these are not passed to the container on startup
#
sde.testcontainers.image-name=docker.elastic.co/elasticsearch/elasticsearch
sde.testcontainers.image-version=7.13.4
sde.testcontainers.image-version=7.14.1
#
#
# 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
Expand Down

0 comments on commit 3128fab

Please # to comment.