diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java index 64e67f59f6313..d2e61338a469a 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/SearchIT.java @@ -85,7 +85,6 @@ import org.elasticsearch.search.suggest.Suggest; import org.elasticsearch.search.suggest.SuggestBuilder; import org.elasticsearch.search.suggest.phrase.PhraseSuggestionBuilder; -import org.elasticsearch.xpack.core.index.query.PinnedQueryBuilder; import org.hamcrest.Matchers; import org.junit.Before; @@ -1385,8 +1384,6 @@ public void testCountAllIndicesMatchQuery() throws IOException { public void testSearchWithBasicLicensedQuery() throws IOException { SearchRequest searchRequest = new SearchRequest("index"); SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); - PinnedQueryBuilder pinnedQuery = new PinnedQueryBuilder(new MatchAllQueryBuilder(), "2", "1"); - searchSourceBuilder.query(pinnedQuery); searchRequest.source(searchSourceBuilder); SearchResponse searchResponse = execute(searchRequest, highLevelClient()::search, highLevelClient()::searchAsync); assertSearchHeader(searchResponse); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java index a6368338d146b..126d7353a7aca 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/documentation/MiscellaneousDocumentationIT.java @@ -20,8 +20,6 @@ package org.elasticsearch.client.documentation; import org.apache.http.HttpHost; -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.LatchedActionListener; import org.elasticsearch.client.ESRestHighLevelClientTestCase; import org.elasticsearch.client.RequestOptions; import org.elasticsearch.client.RestClient; @@ -29,14 +27,6 @@ import org.elasticsearch.client.core.MainResponse; import java.io.IOException; -import java.time.Instant; -import java.util.EnumSet; -import java.util.Map; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -import static org.hamcrest.Matchers.greaterThan; -import static org.hamcrest.Matchers.is; /** * Documentation for miscellaneous APIs in the high level java client. diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/ReloadAnalyzersResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/ReloadAnalyzersResponseTests.java deleted file mode 100644 index f1a9164b9f19b..0000000000000 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/indices/ReloadAnalyzersResponseTests.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Licensed to Elasticsearch under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch licenses this file to you 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 - * - * http://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.elasticsearch.client.indices; - -import org.elasticsearch.action.support.DefaultShardOperationFailedException; -import org.elasticsearch.client.AbstractResponseTestCase; -import org.elasticsearch.common.xcontent.XContentParser; -import org.elasticsearch.common.xcontent.XContentType; -import org.elasticsearch.index.seqno.RetentionLeaseNotFoundException; -import org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse.ReloadDetails; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.Matchers.in; - -public class ReloadAnalyzersResponseTests - extends AbstractResponseTestCase { - - private String index; - private String id; - private Set shardIds; - - @Override - protected org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse createServerTestInstance(XContentType xContentType) { - index = randomAlphaOfLength(8); - id = randomAlphaOfLength(8); - final int total = randomIntBetween(1, 16); - final int successful = total - scaledRandomIntBetween(0, total); - final int failed = scaledRandomIntBetween(0, total - successful); - final List failures = new ArrayList<>(); - shardIds = new HashSet<>(); - for (int i = 0; i < failed; i++) { - final DefaultShardOperationFailedException failure = new DefaultShardOperationFailedException( - index, - randomValueOtherThanMany(shardIds::contains, () -> randomIntBetween(0, total - 1)), - new RetentionLeaseNotFoundException(id)); - failures.add(failure); - shardIds.add(failure.shardId()); - } - Map reloadedDetailsMap = new HashMap<>(); - int randomIndices = randomIntBetween(0, 5); - for (int i = 0; i < randomIndices; i++) { - String indexName = randomAlphaOfLengthBetween(5, 10); - Set randomNodeIds = new HashSet<>(Arrays.asList(generateRandomStringArray(5, 5, false, true))); - Set randomAnalyzers = new HashSet<>(Arrays.asList(generateRandomStringArray(5, 5, false, true))); - - ReloadDetails reloadedDetails = new ReloadDetails(indexName, randomNodeIds, randomAnalyzers); - reloadedDetailsMap.put(indexName, reloadedDetails); - } - return new org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse(total, successful, failed, failures, reloadedDetailsMap); - } - - @Override - protected ReloadAnalyzersResponse doParseToClientInstance(XContentParser parser) throws IOException { - return ReloadAnalyzersResponse.fromXContent(parser); - } - - @Override - protected void assertInstances(org.elasticsearch.xpack.core.action.ReloadAnalyzersResponse serverTestInstance, - ReloadAnalyzersResponse clientInstance) { - assertThat(clientInstance.shards().total(), equalTo(serverTestInstance.getTotalShards())); - assertThat(clientInstance.shards().successful(), equalTo(serverTestInstance.getSuccessfulShards())); - assertThat(clientInstance.shards().skipped(), equalTo(0)); - assertThat(clientInstance.shards().failed(), equalTo(serverTestInstance.getFailedShards())); - assertThat(clientInstance.shards().failures(), hasSize(clientInstance.shards().failed() == 0 ? 0 : 1)); // failures are grouped - if (clientInstance.shards().failed() > 0) { - final DefaultShardOperationFailedException groupedFailure = clientInstance.shards().failures().iterator().next(); - assertThat(groupedFailure.index(), equalTo(index)); - assertThat(groupedFailure.shardId(), in(shardIds)); - assertThat(groupedFailure.reason(), containsString("reason=retention lease with ID [" + id + "] not found")); - } - Map serverDetails = serverTestInstance.getReloadDetails(); - assertThat(clientInstance.getReloadedDetails().size(), equalTo(serverDetails.size())); - for (Entry entry : clientInstance - .getReloadedDetails().entrySet()) { - String indexName = entry.getKey(); - assertTrue(serverDetails.keySet().contains(indexName)); - assertEquals(serverDetails.get(indexName).getIndexName(), entry.getValue().getIndexName()); - assertEquals(serverDetails.get(indexName).getReloadedAnalyzers(), entry.getValue().getReloadedAnalyzers()); - assertEquals(serverDetails.get(indexName).getReloadedIndicesNodes(), entry.getValue().getReloadedIndicesNodes()); - } - } - -}