From 4c62643c301ca2f25fcbc5f2d8e2017e9e78aa5b Mon Sep 17 00:00:00 2001 From: gmarouli Date: Mon, 7 Feb 2022 15:49:12 +0100 Subject: [PATCH 1/9] Remove Cluster & XPack clients from HLRC (#83423) --- .../client/RestHighLevelClient.java | 24 ---- .../upgrades/SearchStatesIT.java | 15 +-- .../AbstractMultiClusterRemoteTestCase.java | 12 +- .../cluster/remote/test/RemoteClustersIT.java | 111 ++++++++---------- .../test/rest/ESRestTestCase.java | 32 ++++- .../oldrepos/OldRepositoryAccessIT.java | 22 +--- .../SmokeTestMonitoringWithSecurityIT.java | 34 ++---- 7 files changed, 107 insertions(+), 143 deletions(-) diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java index 46af918b7fbcd..4e950b163bac9 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java @@ -276,11 +276,9 @@ public class RestHighLevelClient implements Closeable { private volatile ListenableFuture> versionValidationFuture; private final IndicesClient indicesClient = new IndicesClient(this); - private final ClusterClient clusterClient = new ClusterClient(this); private final IngestClient ingestClient = new IngestClient(this); private final SnapshotClient snapshotClient = new SnapshotClient(this); private final TasksClient tasksClient = new TasksClient(this); - private final XPackClient xPackClient = new XPackClient(this); private final MigrationClient migrationClient = new MigrationClient(this); private final MachineLearningClient machineLearningClient = new MachineLearningClient(this); private final SecurityClient securityClient = new SecurityClient(this); @@ -368,15 +366,6 @@ public final IndicesClient indices() { return indicesClient; } - /** - * Provides a {@link ClusterClient} which can be used to access the Cluster API. - * - * See Cluster API on elastic.co - */ - public final ClusterClient cluster() { - return clusterClient; - } - /** * Provides a {@link IngestClient} which can be used to access the Ingest API. * @@ -404,19 +393,6 @@ public final TasksClient tasks() { return tasksClient; } - /** - * Provides methods for accessing the Elastic Licensed X-Pack Info - * and Usage APIs that are shipped with the default distribution of - * Elasticsearch. All of these APIs will 404 if run against the OSS - * distribution of Elasticsearch. - *

- * See the - * Info APIs on elastic.co for more information. - */ - public final XPackClient xpack() { - return xPackClient; - } - /** * A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Searchable Snapshots APIs. *

diff --git a/qa/ccs-rolling-upgrade-remote-cluster/src/test/java/org/elasticsearch/upgrades/SearchStatesIT.java b/qa/ccs-rolling-upgrade-remote-cluster/src/test/java/org/elasticsearch/upgrades/SearchStatesIT.java index c1db9d77f61dd..6dec927308c32 100644 --- a/qa/ccs-rolling-upgrade-remote-cluster/src/test/java/org/elasticsearch/upgrades/SearchStatesIT.java +++ b/qa/ccs-rolling-upgrade-remote-cluster/src/test/java/org/elasticsearch/upgrades/SearchStatesIT.java @@ -31,7 +31,6 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.elasticsearch.Version; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.index.IndexRequest; @@ -114,7 +113,7 @@ static List parseHosts(String props) { public static void configureRemoteClusters(List remoteNodes) throws Exception { assertThat(remoteNodes, hasSize(3)); final String remoteClusterSettingPrefix = "cluster.remote." + CLUSTER_ALIAS + "."; - try (RestHighLevelClient localClient = newLocalClient()) { + try (RestClient localClient = newLocalClient().getLowLevelClient()) { final Settings remoteConnectionSettings; if (randomBoolean()) { final List seeds = remoteNodes.stream() @@ -137,13 +136,9 @@ public static void configureRemoteClusters(List remoteNodes) throws Except .put(remoteClusterSettingPrefix + "proxy_address", proxyNode.transportAddress) .build(); } - assertTrue( - localClient.cluster() - .putSettings(new ClusterUpdateSettingsRequest().persistentSettings(remoteConnectionSettings), RequestOptions.DEFAULT) - .isAcknowledged() - ); + updateClusterSettings(localClient, remoteConnectionSettings); assertBusy(() -> { - final Response resp = localClient.getLowLevelClient().performRequest(new Request("GET", "/_remote/info")); + final Response resp = localClient.performRequest(new Request("GET", "/_remote/info")); assertOK(resp); final ObjectPath objectPath = ObjectPath.createFromResponse(resp); assertNotNull(objectPath.evaluate(CLUSTER_ALIAS)); @@ -172,7 +167,7 @@ static int indexDocs(RestHighLevelClient client, String index, int numDocs) thro } void verifySearch(String localIndex, int localNumDocs, String remoteIndex, int remoteNumDocs, Integer preFilterShardSize) { - try (RestHighLevelClient localClient = newLocalClient()) { + try (RestClient localClient = newLocalClient().getLowLevelClient()) { Request request = new Request("POST", "/_search"); final int expectedDocs; if (randomBoolean()) { @@ -193,7 +188,7 @@ void verifySearch(String localIndex, int localNumDocs, String remoteIndex, int r } int size = between(1, 100); request.setJsonEntity("{\"sort\": \"f\", \"size\": " + size + "}"); - Response response = localClient.getLowLevelClient().performRequest(request); + Response response = localClient.performRequest(request); try ( XContentParser parser = JsonXContent.jsonXContent.createParser( NamedXContentRegistry.EMPTY, diff --git a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java index c5bee9694a275..c778d6fe4c512 100644 --- a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java +++ b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/AbstractMultiClusterRemoteTestCase.java @@ -9,8 +9,7 @@ import org.apache.http.HttpHost; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; -import org.elasticsearch.client.RequestOptions; +import org.elasticsearch.client.Request; import org.elasticsearch.client.RestClient; import org.elasticsearch.client.RestHighLevelClient; import org.elasticsearch.common.settings.SecureString; @@ -28,6 +27,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; +import java.util.function.Consumer; @SuppressWarnings("removal") public abstract class AbstractMultiClusterRemoteTestCase extends ESRestTestCase { @@ -58,8 +58,12 @@ public void initClientsAndConfigureClusters() throws Exception { cluster1Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-" + getDistribution() + "-1.tcp.9200")); cluster2Client = buildClient("localhost:" + getProperty("test.fixtures.elasticsearch-" + getDistribution() + "-2.tcp.9200")); - cluster1Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT); - cluster2Client().cluster().health(new ClusterHealthRequest().waitForNodes("1").waitForYellowStatus(), RequestOptions.DEFAULT); + Consumer waitForYellowRequest = request -> { + request.addParameter("wait_for_status", "yellow"); + request.addParameter("wait_for_nodes", "1"); + }; + ensureHealth(cluster1Client().getLowLevelClient(), waitForYellowRequest); + ensureHealth(cluster2Client().getLowLevelClient(), waitForYellowRequest); initialized = true; } diff --git a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java index 6e4d83873f9df..78aa2b7e1c5de 100644 --- a/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java +++ b/qa/remote-clusters/src/test/java/org/elasticsearch/cluster/remote/test/RemoteClustersIT.java @@ -7,14 +7,12 @@ */ package org.elasticsearch.cluster.remote.test; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.client.RequestOptions; -import org.elasticsearch.client.cluster.RemoteConnectionInfo; -import org.elasticsearch.client.cluster.RemoteInfoRequest; +import org.elasticsearch.client.RestClient; import org.elasticsearch.client.indices.CreateIndexRequest; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.xcontent.XContentFactory; @@ -22,6 +20,8 @@ import org.junit.Before; import java.io.IOException; +import java.util.Map; +import java.util.Optional; import static org.hamcrest.Matchers.equalTo; import static org.junit.Assume.assumeThat; @@ -74,27 +74,22 @@ public void clearIndices() throws IOException { @After public void clearRemoteClusterSettings() throws IOException { - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder().putNull("cluster.remote.*").build() - ); - assertTrue(cluster1Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); - assertTrue(cluster2Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings setting = Settings.builder().putNull("cluster.remote.*").build(); + updateClusterSettings(cluster1Client().getLowLevelClient(), setting); + updateClusterSettings(cluster2Client().getLowLevelClient(), setting); } public void testProxyModeConnectionWorks() throws IOException { String cluster2RemoteClusterSeed = "elasticsearch-" + getDistribution() + "-2:9300"; logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed); - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder() - .put("cluster.remote.cluster2.mode", "proxy") - .put("cluster.remote.cluster2.proxy_address", cluster2RemoteClusterSeed) - .build() - ); - assertTrue(cluster1Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings settings = Settings.builder() + .put("cluster.remote.cluster2.mode", "proxy") + .put("cluster.remote.cluster2.proxy_address", cluster2RemoteClusterSeed) + .build(); + + updateClusterSettings(cluster1Client().getLowLevelClient(), settings); - RemoteConnectionInfo rci = cluster1Client().cluster().remoteInfo(new RemoteInfoRequest(), RequestOptions.DEFAULT).getInfos().get(0); - logger.info("Connection info: {}", rci); - assertTrue(rci.isConnected()); + assertTrue(isConnected(cluster1Client().getLowLevelClient())); assertEquals( 2L, @@ -105,33 +100,25 @@ public void testProxyModeConnectionWorks() throws IOException { public void testSniffModeConnectionFails() throws IOException { String cluster2RemoteClusterSeed = "elasticsearch-" + getDistribution() + "-2:9300"; logger.info("Configuring remote cluster [{}]", cluster2RemoteClusterSeed); - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder() - .put("cluster.remote.cluster2alt.mode", "sniff") - .put("cluster.remote.cluster2alt.seeds", cluster2RemoteClusterSeed) - .build() - ); - assertTrue(cluster1Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings settings = Settings.builder() + .put("cluster.remote.cluster2alt.mode", "sniff") + .put("cluster.remote.cluster2alt.seeds", cluster2RemoteClusterSeed) + .build(); + updateClusterSettings(cluster1Client().getLowLevelClient(), settings); - RemoteConnectionInfo rci = cluster1Client().cluster().remoteInfo(new RemoteInfoRequest(), RequestOptions.DEFAULT).getInfos().get(0); - logger.info("Connection info: {}", rci); - assertFalse(rci.isConnected()); + assertFalse(isConnected(cluster1Client().getLowLevelClient())); } public void testHAProxyModeConnectionWorks() throws IOException { String proxyAddress = "haproxy:9600"; logger.info("Configuring remote cluster [{}]", proxyAddress); - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder() - .put("cluster.remote.haproxynosn.mode", "proxy") - .put("cluster.remote.haproxynosn.proxy_address", proxyAddress) - .build() - ); - assertTrue(cluster1Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings settings = Settings.builder() + .put("cluster.remote.haproxynosn.mode", "proxy") + .put("cluster.remote.haproxynosn.proxy_address", proxyAddress) + .build(); + updateClusterSettings(cluster1Client().getLowLevelClient(), settings); - RemoteConnectionInfo rci = cluster1Client().cluster().remoteInfo(new RemoteInfoRequest(), RequestOptions.DEFAULT).getInfos().get(0); - logger.info("Connection info: {}", rci); - assertTrue(rci.isConnected()); + assertTrue(isConnected(cluster1Client().getLowLevelClient())); assertEquals( 2L, @@ -142,18 +129,14 @@ public void testHAProxyModeConnectionWorks() throws IOException { public void testHAProxyModeConnectionWithSNIToCluster1Works() throws IOException { assumeThat("test is only supported if the distribution contains xpack", getDistribution(), equalTo("default")); - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder() - .put("cluster.remote.haproxysni1.mode", "proxy") - .put("cluster.remote.haproxysni1.proxy_address", "haproxy:9600") - .put("cluster.remote.haproxysni1.server_name", "application1.example.com") - .build() - ); - assertTrue(cluster2Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings settings = Settings.builder() + .put("cluster.remote.haproxysni1.mode", "proxy") + .put("cluster.remote.haproxysni1.proxy_address", "haproxy:9600") + .put("cluster.remote.haproxysni1.server_name", "application1.example.com") + .build(); + updateClusterSettings(cluster2Client().getLowLevelClient(), settings); - RemoteConnectionInfo rci = cluster2Client().cluster().remoteInfo(new RemoteInfoRequest(), RequestOptions.DEFAULT).getInfos().get(0); - logger.info("Connection info: {}", rci); - assertTrue(rci.isConnected()); + assertTrue(isConnected(cluster2Client().getLowLevelClient())); assertEquals( 1L, @@ -164,22 +147,30 @@ public void testHAProxyModeConnectionWithSNIToCluster1Works() throws IOException public void testHAProxyModeConnectionWithSNIToCluster2Works() throws IOException { assumeThat("test is only supported if the distribution contains xpack", getDistribution(), equalTo("default")); - ClusterUpdateSettingsRequest request = new ClusterUpdateSettingsRequest().persistentSettings( - Settings.builder() - .put("cluster.remote.haproxysni2.mode", "proxy") - .put("cluster.remote.haproxysni2.proxy_address", "haproxy:9600") - .put("cluster.remote.haproxysni2.server_name", "application2.example.com") - .build() - ); - assertTrue(cluster1Client().cluster().putSettings(request, RequestOptions.DEFAULT).isAcknowledged()); + Settings settings = Settings.builder() + .put("cluster.remote.haproxysni2.mode", "proxy") + .put("cluster.remote.haproxysni2.proxy_address", "haproxy:9600") + .put("cluster.remote.haproxysni2.server_name", "application2.example.com") + .build(); + updateClusterSettings(cluster1Client().getLowLevelClient(), settings); - RemoteConnectionInfo rci = cluster1Client().cluster().remoteInfo(new RemoteInfoRequest(), RequestOptions.DEFAULT).getInfos().get(0); - logger.info("Connection info: {}", rci); - assertTrue(rci.isConnected()); + assertTrue(isConnected(cluster1Client().getLowLevelClient())); assertEquals( 2L, cluster1Client().search(new SearchRequest("haproxysni2:test2"), RequestOptions.DEFAULT).getHits().getTotalHits().value ); } + + @SuppressWarnings("unchecked") + private boolean isConnected(RestClient restClient) throws IOException { + Optional remoteConnectionInfo = getAsMap(restClient, "/_remote/info").values().stream().findFirst(); + if (remoteConnectionInfo.isPresent()) { + logger.info("Connection info: {}", remoteConnectionInfo); + if (((Map) remoteConnectionInfo.get()).get("connected")instanceof Boolean connected) { + return connected; + } + } + return false; + } } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index a4e338626191d..9ee0681b19fca 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -1407,6 +1407,28 @@ public static void assertAcknowledged(Response response) throws IOException { assertThat(jsonBody, containsString("\"acknowledged\":true")); } + /** + * Updates the cluster with the provided settings (as persistent settings) + **/ + public static void updateClusterSettings(Settings settings) throws IOException { + updateClusterSettings(client(), settings); + } + + /** + * Updates the cluster with the provided settings (as persistent settings) + **/ + public static void updateClusterSettings(RestClient client, Settings settings) throws IOException { + Request request = new Request("PUT", "/_cluster/settings"); + String entity = String.format(""" + { + "persistent":%s + } + """, Strings.toString(settings)); + request.setJsonEntity(entity); + Response response = client.performRequest(request); + assertOK(response); + } + /** * Permits subclasses to increase the default timeout when waiting for green health */ @@ -1440,6 +1462,10 @@ public static void ensureHealth(String index, Consumer requestConsumer) ensureHealth(client(), index, requestConsumer); } + public static void ensureHealth(RestClient restClient, Consumer requestConsumer) throws IOException { + ensureHealth(restClient, "", requestConsumer); + } + protected static void ensureHealth(RestClient restClient, String index, Consumer requestConsumer) throws IOException { Request request = new Request("GET", "/_cluster/health" + (index.isBlank() ? "" : "/" + index)); requestConsumer.accept(request); @@ -1604,7 +1630,11 @@ protected static Map getAlias(final String index, final String a } protected static Map getAsMap(final String endpoint) throws IOException { - Response response = client().performRequest(new Request("GET", endpoint)); + return getAsMap(client(), endpoint); + } + + protected static Map getAsMap(RestClient client, final String endpoint) throws IOException { + Response response = client.performRequest(new Request("GET", endpoint)); return responseAsMap(response); } diff --git a/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java b/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java index 5a43bc5824204..c76d317fe145a 100644 --- a/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java +++ b/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java @@ -10,7 +10,6 @@ import org.apache.http.HttpHost; import org.elasticsearch.Build; import org.elasticsearch.Version; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryRequest; import org.elasticsearch.action.admin.cluster.snapshots.get.GetSnapshotsRequest; import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotRequest; @@ -29,7 +28,6 @@ import org.elasticsearch.client.indices.PutMappingRequest; import org.elasticsearch.client.searchable_snapshots.MountSnapshotRequest; import org.elasticsearch.cluster.SnapshotsInProgress; -import org.elasticsearch.cluster.health.ClusterHealthStatus; import org.elasticsearch.cluster.metadata.IndexMetadata; import org.elasticsearch.cluster.metadata.MappingMetadata; import org.elasticsearch.cluster.routing.Murmur3HashFunction; @@ -298,15 +296,7 @@ private void restoreMountAndVerify( assertEquals(numberOfShards, restoreSnapshotResponse.getRestoreInfo().totalShards()); assertEquals(numberOfShards, restoreSnapshotResponse.getRestoreInfo().successfulShards()); - assertEquals( - ClusterHealthStatus.GREEN, - client.cluster() - .health( - new ClusterHealthRequest("restored_test").waitForGreenStatus().waitForNoRelocatingShards(true), - RequestOptions.DEFAULT - ) - .getStatus() - ); + ensureGreen("restored_test"); MappingMetadata mapping = client.indices() .getMapping(new GetMappingsRequest().indices("restored_test"), RequestOptions.DEFAULT) @@ -357,15 +347,7 @@ private void restoreMountAndVerify( assertEquals(numberOfShards, mountSnapshotResponse.getRestoreInfo().totalShards()); assertEquals(numberOfShards, mountSnapshotResponse.getRestoreInfo().successfulShards()); - assertEquals( - ClusterHealthStatus.GREEN, - client.cluster() - .health( - new ClusterHealthRequest("mounted_full_copy_test").waitForGreenStatus().waitForNoRelocatingShards(true), - RequestOptions.DEFAULT - ) - .getStatus() - ); + ensureGreen("mounted_full_copy_test"); // run a search against the index assertDocs("mounted_full_copy_test", numDocs, expectedIds, client, sourceOnlyRepository, oldVersion); diff --git a/x-pack/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java b/x-pack/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java index df6189b5ca681..e0a72946be332 100644 --- a/x-pack/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java +++ b/x-pack/qa/smoke-test-plugins-ssl/src/test/java/org/elasticsearch/smoketest/SmokeTestMonitoringWithSecurityIT.java @@ -10,10 +10,6 @@ import io.netty.util.concurrent.GlobalEventExecutor; import org.elasticsearch.ElasticsearchException; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.client.Request; import org.elasticsearch.client.RequestOptions; @@ -23,10 +19,6 @@ import org.elasticsearch.client.indices.GetIndexRequest; import org.elasticsearch.client.indices.GetIndexTemplatesRequest; import org.elasticsearch.client.indices.GetIndexTemplatesResponse; -import org.elasticsearch.client.xpack.XPackUsageRequest; -import org.elasticsearch.client.xpack.XPackUsageResponse; -import org.elasticsearch.cluster.health.ClusterHealthStatus; -import org.elasticsearch.common.Priority; import org.elasticsearch.common.settings.MockSecureSettings; import org.elasticsearch.common.settings.SecureString; import org.elasticsearch.common.settings.Settings; @@ -165,9 +157,7 @@ public void enableExporter() throws Exception { .put("xpack.monitoring.exporters._http.ssl.certificate_authorities", "testnode.crt") .setSecureSettings(secureSettings) .build(); - ClusterUpdateSettingsResponse response = newHighLevelClient().cluster() - .putSettings(new ClusterUpdateSettingsRequest().transientSettings(exporterSettings), RequestOptions.DEFAULT); - assertTrue(response.isAcknowledged()); + updateClusterSettings(exporterSettings); } @After @@ -181,15 +171,12 @@ public void disableExporter() throws IOException { .putNull("xpack.monitoring.exporters._http.ssl.verification_mode") .putNull("xpack.monitoring.exporters._http.ssl.certificate_authorities") .build(); - ClusterUpdateSettingsResponse response = newHighLevelClient().cluster() - .putSettings(new ClusterUpdateSettingsRequest().transientSettings(exporterSettings), RequestOptions.DEFAULT); - assertTrue(response.isAcknowledged()); + updateClusterSettings(exporterSettings); } + @SuppressWarnings("unchecked") private boolean getMonitoringUsageExportersDefined() throws Exception { - RestHighLevelClient client = newHighLevelClient(); - final XPackUsageResponse usageResponse = client.xpack().usage(new XPackUsageRequest(), RequestOptions.DEFAULT); - Map monitoringUsage = usageResponse.getUsages().get("monitoring"); + Map monitoringUsage = (Map) getAsMap("/_xpack/usage").get("monitoring"); assertThat("Monitoring feature set does not exist", monitoringUsage, notNullValue()); @SuppressWarnings("unchecked") @@ -225,13 +212,12 @@ public void testHTTPExporterWithSSL() throws Exception { }); // Waits for indices to be ready - ClusterHealthRequest healthRequest = new ClusterHealthRequest(MONITORING_PATTERN); - healthRequest.waitForStatus(ClusterHealthStatus.YELLOW); - healthRequest.waitForEvents(Priority.LANGUID); - healthRequest.waitForNoRelocatingShards(true); - healthRequest.waitForNoInitializingShards(true); - ClusterHealthResponse response = client.cluster().health(healthRequest, RequestOptions.DEFAULT); - assertThat(response.isTimedOut(), is(false)); + ensureHealth(MONITORING_PATTERN, (request) -> { + request.addParameter("wait_for_status", "yellow"); + request.addParameter("wait_for_events", "languid"); + request.addParameter("wait_for_no_relocating_shards", "true"); + request.addParameter("wait_for_no_initializing_shards", "true"); + }); // Checks that the HTTP exporter has successfully exported some data SearchRequest searchRequest = new SearchRequest(new String[] { MONITORING_PATTERN }, new SearchSourceBuilder().size(0)); From 25fdb130a0d09e0e3cea4a5854f3dd25cf3f6c4e Mon Sep 17 00:00:00 2001 From: gmarouli Date: Mon, 7 Feb 2022 15:50:57 +0100 Subject: [PATCH 2/9] Remove Cluster & XPack clients --- .../elasticsearch/client/ClusterClient.java | 389 ------------------ .../org/elasticsearch/client/XPackClient.java | 115 ------ 2 files changed, 504 deletions(-) delete mode 100644 client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java delete mode 100644 client/rest-high-level/src/main/java/org/elasticsearch/client/XPackClient.java diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java deleted file mode 100644 index a9a119da79bab..0000000000000 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/ClusterClient.java +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -package org.elasticsearch.client; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; -import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; -import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsRequest; -import org.elasticsearch.action.admin.cluster.settings.ClusterGetSettingsResponse; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest; -import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse; -import org.elasticsearch.action.support.master.AcknowledgedResponse; -import org.elasticsearch.client.cluster.RemoteInfoRequest; -import org.elasticsearch.client.cluster.RemoteInfoResponse; -import org.elasticsearch.client.indices.ComponentTemplatesExistRequest; -import org.elasticsearch.client.indices.DeleteComponentTemplateRequest; -import org.elasticsearch.client.indices.GetComponentTemplatesRequest; -import org.elasticsearch.client.indices.GetComponentTemplatesResponse; -import org.elasticsearch.client.indices.PutComponentTemplateRequest; -import org.elasticsearch.rest.RestStatus; - -import java.io.IOException; - -import static java.util.Collections.emptySet; -import static java.util.Collections.singleton; - -/** - * A wrapper for the {@link RestHighLevelClient} that provides methods for accessing the Cluster API. - *

- * See Cluster API on elastic.co - * - * @deprecated The High Level Rest Client is deprecated in favor of the - * - * Elasticsearch Java API Client - */ -@Deprecated(since = "7.16.0", forRemoval = true) -@SuppressWarnings("removal") -public final class ClusterClient { - private final RestHighLevelClient restHighLevelClient; - - ClusterClient(RestHighLevelClient restHighLevelClient) { - this.restHighLevelClient = restHighLevelClient; - } - - /** - * Updates cluster wide specific settings using the Cluster Update Settings API. - * See Cluster Update Settings - * API on elastic.co - * @param clusterUpdateSettingsRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public ClusterUpdateSettingsResponse putSettings(ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, RequestOptions options) - throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - clusterUpdateSettingsRequest, - ClusterRequestConverters::clusterPutSettings, - options, - ClusterUpdateSettingsResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously updates cluster wide specific settings using the Cluster Update Settings API. - * See Cluster Update Settings - * API on elastic.co - * @param clusterUpdateSettingsRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable putSettingsAsync( - ClusterUpdateSettingsRequest clusterUpdateSettingsRequest, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - clusterUpdateSettingsRequest, - ClusterRequestConverters::clusterPutSettings, - options, - ClusterUpdateSettingsResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Get the cluster wide settings using the Cluster Get Settings API. - * See Cluster Get Settings - * API on elastic.co - * @param clusterGetSettingsRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public ClusterGetSettingsResponse getSettings(ClusterGetSettingsRequest clusterGetSettingsRequest, RequestOptions options) - throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - clusterGetSettingsRequest, - ClusterRequestConverters::clusterGetSettings, - options, - ClusterGetSettingsResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously get the cluster wide settings using the Cluster Get Settings API. - * See Cluster Get Settings - * API on elastic.co - * @param clusterGetSettingsRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable getSettingsAsync( - ClusterGetSettingsRequest clusterGetSettingsRequest, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - clusterGetSettingsRequest, - ClusterRequestConverters::clusterGetSettings, - options, - ClusterGetSettingsResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Get cluster health using the Cluster Health API. - * See - * Cluster Health API on elastic.co - *

- * If timeout occurred, {@link ClusterHealthResponse} will have isTimedOut() == true and status() == RestStatus.REQUEST_TIMEOUT - * @param healthRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public ClusterHealthResponse health(ClusterHealthRequest healthRequest, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - healthRequest, - ClusterRequestConverters::clusterHealth, - options, - ClusterHealthResponse::fromXContent, - singleton(RestStatus.REQUEST_TIMEOUT.getStatus()) - ); - } - - /** - * Asynchronously get cluster health using the Cluster Health API. - * See - * Cluster Health API on elastic.co - * If timeout occurred, {@link ClusterHealthResponse} will have isTimedOut() == true and status() == RestStatus.REQUEST_TIMEOUT - * @param healthRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable healthAsync( - ClusterHealthRequest healthRequest, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - healthRequest, - ClusterRequestConverters::clusterHealth, - options, - ClusterHealthResponse::fromXContent, - listener, - singleton(RestStatus.REQUEST_TIMEOUT.getStatus()) - ); - } - - /** - * Get the remote cluster information using the Remote cluster info API. - * See Remote cluster info - * API on elastic.co - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public RemoteInfoResponse remoteInfo(RemoteInfoRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - request, - ClusterRequestConverters::remoteInfo, - options, - RemoteInfoResponse::fromXContent, - singleton(RestStatus.REQUEST_TIMEOUT.getStatus()) - ); - } - - /** - * Asynchronously get remote cluster information using the Remote cluster info API. - * See Remote cluster info - * API on elastic.co - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable remoteInfoAsync(RemoteInfoRequest request, RequestOptions options, ActionListener listener) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - request, - ClusterRequestConverters::remoteInfo, - options, - RemoteInfoResponse::fromXContent, - listener, - singleton(RestStatus.REQUEST_TIMEOUT.getStatus()) - ); - } - - /** - * Delete a component template using the Component Templates API - * - * @param req the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public AcknowledgedResponse deleteComponentTemplate(DeleteComponentTemplateRequest req, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - req, - ClusterRequestConverters::deleteComponentTemplate, - options, - AcknowledgedResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously delete a component template using the Component Templates API - * - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable deleteComponentTemplateAsync( - DeleteComponentTemplateRequest request, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - request, - ClusterRequestConverters::deleteComponentTemplate, - options, - AcknowledgedResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Puts a component template using the Component Templates API. - * - * @param putComponentTemplateRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public AcknowledgedResponse putComponentTemplate(PutComponentTemplateRequest putComponentTemplateRequest, RequestOptions options) - throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - putComponentTemplateRequest, - ClusterRequestConverters::putComponentTemplate, - options, - AcknowledgedResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously puts a component template using the Component Templates API. - * - * @param putComponentTemplateRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable putComponentTemplateAsync( - PutComponentTemplateRequest putComponentTemplateRequest, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - putComponentTemplateRequest, - ClusterRequestConverters::putComponentTemplate, - options, - AcknowledgedResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Gets component templates using the Components Templates API - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param getComponentTemplatesRequest the request - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public GetComponentTemplatesResponse getComponentTemplate( - GetComponentTemplatesRequest getComponentTemplatesRequest, - RequestOptions options - ) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - getComponentTemplatesRequest, - ClusterRequestConverters::getComponentTemplates, - options, - GetComponentTemplatesResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously gets component templates using the Components Templates API - * @param getComponentTemplatesRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable getComponentTemplateAsync( - GetComponentTemplatesRequest getComponentTemplatesRequest, - RequestOptions options, - ActionListener listener - ) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - getComponentTemplatesRequest, - ClusterRequestConverters::getComponentTemplates, - options, - GetComponentTemplatesResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Uses the Component Templates API to determine if component templates exist - * - * @param componentTemplatesRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return true if any index templates in the request exist, false otherwise - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public boolean existsComponentTemplate(ComponentTemplatesExistRequest componentTemplatesRequest, RequestOptions options) - throws IOException { - return restHighLevelClient.performRequest( - componentTemplatesRequest, - ClusterRequestConverters::componentTemplatesExist, - options, - RestHighLevelClient::convertExistsResponse, - emptySet() - ); - } - - /** - * Uses the Index Templates API to determine if index templates exist - * @param componentTemplatesRequest the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true} - * @return cancellable that may be used to cancel the request - */ - public Cancellable existsComponentTemplateAsync( - ComponentTemplatesExistRequest componentTemplatesRequest, - RequestOptions options, - ActionListener listener - ) { - - return restHighLevelClient.performRequestAsync( - componentTemplatesRequest, - ClusterRequestConverters::componentTemplatesExist, - options, - RestHighLevelClient::convertExistsResponse, - listener, - emptySet() - ); - } -} diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/XPackClient.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/XPackClient.java deleted file mode 100644 index f019a262b607a..0000000000000 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/XPackClient.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -package org.elasticsearch.client; - -import org.elasticsearch.action.ActionListener; -import org.elasticsearch.client.xpack.XPackInfoRequest; -import org.elasticsearch.client.xpack.XPackInfoResponse; -import org.elasticsearch.client.xpack.XPackUsageRequest; -import org.elasticsearch.client.xpack.XPackUsageResponse; - -import java.io.IOException; - -import static java.util.Collections.emptySet; - -/** - * A wrapper for the {@link RestHighLevelClient} that provides methods for - * accessing the Elastic Licensed X-Pack APIs that are shipped with the - * default distribution of Elasticsearch. All of these APIs will 404 if run - * against the OSS distribution of Elasticsearch. - *

- * See the - * REST APIs on elastic.co for more information. - * - * @deprecated The High Level Rest Client is deprecated in favor of the - * - * Elasticsearch Java API Client - */ -@Deprecated(since = "7.16.0", forRemoval = true) -@SuppressWarnings("removal") -public final class XPackClient { - - private final RestHighLevelClient restHighLevelClient; - - XPackClient(RestHighLevelClient restHighLevelClient) { - this.restHighLevelClient = restHighLevelClient; - } - - /** - * Fetch information about X-Pack from the cluster. - * See - * the docs for more. - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public XPackInfoResponse info(XPackInfoRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - request, - XPackRequestConverters::info, - options, - XPackInfoResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously fetch information about X-Pack from the cluster. - * See - * the docs for more. - * @param request the request - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable infoAsync(XPackInfoRequest request, RequestOptions options, ActionListener listener) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - request, - XPackRequestConverters::info, - options, - XPackInfoResponse::fromXContent, - listener, - emptySet() - ); - } - - /** - * Fetch usage information about X-Pack features from the cluster. - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @return the response - * @throws IOException in case there is a problem sending the request or parsing back the response - */ - public XPackUsageResponse usage(XPackUsageRequest request, RequestOptions options) throws IOException { - return restHighLevelClient.performRequestAndParseEntity( - request, - XPackRequestConverters::usage, - options, - XPackUsageResponse::fromXContent, - emptySet() - ); - } - - /** - * Asynchronously fetch usage information about X-Pack features from the cluster. - * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized - * @param listener the listener to be notified upon request completion - * @return cancellable that may be used to cancel the request - */ - public Cancellable usageAsync(XPackUsageRequest request, RequestOptions options, ActionListener listener) { - return restHighLevelClient.performRequestAsyncAndParseEntity( - request, - XPackRequestConverters::usage, - options, - XPackUsageResponse::fromXContent, - listener, - emptySet() - ); - } -} From 9db5d2018eee6ce502fbbd3e32cdd7e42278ae84 Mon Sep 17 00:00:00 2001 From: Mary Gouseti Date: Mon, 7 Feb 2022 15:53:12 +0100 Subject: [PATCH 3/9] Update docs/changelog/83593.yaml --- docs/changelog/83593.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/changelog/83593.yaml diff --git a/docs/changelog/83593.yaml b/docs/changelog/83593.yaml new file mode 100644 index 0000000000000..6a88e3c005538 --- /dev/null +++ b/docs/changelog/83593.yaml @@ -0,0 +1,5 @@ +pr: 83593 +summary: Remove Cluster & XPack clients from HLRC +area: Java High Level REST Client +type: tech debt +issues: [] From 97d53d8e912c524b77c18695305a7f0df6741e37 Mon Sep 17 00:00:00 2001 From: gmarouli Date: Mon, 7 Feb 2022 16:12:09 +0100 Subject: [PATCH 4/9] Do not mention it in the changelog --- docs/changelog/83593.yaml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 docs/changelog/83593.yaml diff --git a/docs/changelog/83593.yaml b/docs/changelog/83593.yaml deleted file mode 100644 index 6a88e3c005538..0000000000000 --- a/docs/changelog/83593.yaml +++ /dev/null @@ -1,5 +0,0 @@ -pr: 83593 -summary: Remove Cluster & XPack clients from HLRC -area: Java High Level REST Client -type: tech debt -issues: [] From a3f6167748167b50502fda1641d3f110b5428378 Mon Sep 17 00:00:00 2001 From: gmarouli Date: Wed, 9 Feb 2022 14:35:42 +0100 Subject: [PATCH 5/9] fix failed tests --- .../java/org/elasticsearch/test/rest/ESRestTestCase.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java index 9ee0681b19fca..245593cc5e76d 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/ESRestTestCase.java @@ -1419,11 +1419,7 @@ public static void updateClusterSettings(Settings settings) throws IOException { **/ public static void updateClusterSettings(RestClient client, Settings settings) throws IOException { Request request = new Request("PUT", "/_cluster/settings"); - String entity = String.format(""" - { - "persistent":%s - } - """, Strings.toString(settings)); + String entity = "{ \"persistent\":" + Strings.toString(settings) + "}"; request.setJsonEntity(entity); Response response = client.performRequest(request); assertOK(response); From 87845c49d76a8734fef6c7e6a484aea2c22c2c27 Mon Sep 17 00:00:00 2001 From: gmarouli Date: Wed, 9 Feb 2022 15:17:12 +0100 Subject: [PATCH 6/9] Revert accidentally committing checkstyle-idea.xml --- .idea/checkstyle-idea.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml index be3fadf7ecac1..3fc97f331bd46 100644 --- a/.idea/checkstyle-idea.xml +++ b/.idea/checkstyle-idea.xml @@ -3,12 +3,12 @@ - \ No newline at end of file + From 773cb354878603ece0b89e44248a7862a9206ecc Mon Sep 17 00:00:00 2001 From: gmarouli Date: Wed, 9 Feb 2022 15:28:30 +0100 Subject: [PATCH 7/9] Revert intellij's formatting initiatives --- .../main/resources/rest-api-spec/api/_internal.health.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json index b0e10275265b6..99f035d88e9ed 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json @@ -23,8 +23,8 @@ }, "params": { "timeout": { - "type":"time", - "description":"Explicit operation timeout" + "type": "time", + "description": "Explicit operation timeout" } } } From eb91555e64282dc2ec3158a1483031681de8551e Mon Sep 17 00:00:00 2001 From: gmarouli Date: Wed, 9 Feb 2022 15:36:45 +0100 Subject: [PATCH 8/9] Revert intllij's formatting part 2 --- .../checkstyle/MissingJavadocTypeCheck.java | 3 +- build-tools-internal/version.properties | 2 +- docs/changelog/80981.yaml | 2 +- docs/changelog/83145.yaml | 2 +- docs/changelog/83478.yaml | 2 +- docs/changelog/83514.yaml | 2 +- docs/changelog/83566.yaml | 2 +- docs/changelog/83577.yaml | 2 +- docs/changelog/83587.yaml | 2 +- docs/changelog/83603.yaml | 2 +- docs/changelog/83644.yaml | 2 +- docs/changelog/83645.yaml | 2 +- .../api/_internal.delete_desired_nodes.json | 24 ++++---- .../api/_internal.get_desired_nodes.json | 24 ++++---- .../rest-api-spec/api/_internal.health.json | 32 +++++------ .../api/_internal.update_desired_nodes.json | 34 +++++------ rest-api-spec/src/main/resources/schema.json | 6 +- .../test/cluster.desired_nodes/10_basic.yml | 56 +++++++++---------- .../rest-api-spec/test/health/10_basic.yml | 2 +- .../25_max_shard_doc_condition.yml | 10 ++-- .../rest-api-spec/test/tsdb/10_settings.yml | 8 +-- .../test/license/20_put_license.yml | 4 +- 22 files changed, 108 insertions(+), 117 deletions(-) diff --git a/build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java b/build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java index 6a7aa643091fa..60e63e90fcaab 100644 --- a/build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java +++ b/build-conventions/src/main/java/org/elasticsearch/gradle/internal/checkstyle/MissingJavadocTypeCheck.java @@ -151,7 +151,8 @@ private boolean shouldCheck(final DetailAST ast) { && (surroundingScope == null || surroundingScope.isIn(scope)) && (excludeScope == null || !customScope.isIn(excludeScope) - || surroundingScope != null && !surroundingScope.isIn(excludeScope)) + || surroundingScope != null + && !surroundingScope.isIn(excludeScope)) && !AnnotationUtil.containsAnnotation(ast, skipAnnotations) && ignorePattern.matcher(outerTypeName).find() == false; } diff --git a/build-tools-internal/version.properties b/build-tools-internal/version.properties index 00144f2f485ed..f3fb581f6c88d 100644 --- a/build-tools-internal/version.properties +++ b/build-tools-internal/version.properties @@ -4,7 +4,7 @@ lucene = 9.0.0 bundled_jdk_vendor = adoptium bundled_jdk = 17.0.2+8 -checkstyle=9.3 +checkstyle = 9.3 # optional dependencies spatial4j = 0.7 diff --git a/docs/changelog/80981.yaml b/docs/changelog/80981.yaml index 03c0acd8185ef..759a4b9462231 100644 --- a/docs/changelog/80981.yaml +++ b/docs/changelog/80981.yaml @@ -2,4 +2,4 @@ pr: 80981 summary: Rollover add max_primary_shard_docs condition area: ILM+SLM type: enhancement -issues: [ ] +issues: [] diff --git a/docs/changelog/83145.yaml b/docs/changelog/83145.yaml index 84873ddd6737c..e6e1dce0e706e 100644 --- a/docs/changelog/83145.yaml +++ b/docs/changelog/83145.yaml @@ -2,4 +2,4 @@ pr: 83145 summary: Bind host all instead of just _site_ when needed area: Security type: enhancement -issues: [ ] +issues: [] diff --git a/docs/changelog/83478.yaml b/docs/changelog/83478.yaml index bbb763140a826..84039e3f1fe82 100644 --- a/docs/changelog/83478.yaml +++ b/docs/changelog/83478.yaml @@ -3,4 +3,4 @@ summary: Add range checks to interval multiplication operation area: SQL type: bug issues: - - 83336 + - 83336 diff --git a/docs/changelog/83514.yaml b/docs/changelog/83514.yaml index 844f15e0f059d..287d9d9a7ab5e 100644 --- a/docs/changelog/83514.yaml +++ b/docs/changelog/83514.yaml @@ -3,4 +3,4 @@ summary: Simplify and Speed up `ExecutorSelector` area: Indices APIs type: bug issues: - - 82450 + - 82450 diff --git a/docs/changelog/83566.yaml b/docs/changelog/83566.yaml index a002f0d8f3835..5158f914294a9 100644 --- a/docs/changelog/83566.yaml +++ b/docs/changelog/83566.yaml @@ -2,4 +2,4 @@ pr: 83566 summary: Upgrade jANSI dependency to 2.4.0 area: Security type: bug -issues: [ ] +issues: [] diff --git a/docs/changelog/83577.yaml b/docs/changelog/83577.yaml index bdfdb1e904074..62009c8a8cfac 100644 --- a/docs/changelog/83577.yaml +++ b/docs/changelog/83577.yaml @@ -2,4 +2,4 @@ pr: 83577 summary: Runtime fields core-with-mapped tests support tsdb area: Mapping type: bug -issues: [ ] +issues: [] diff --git a/docs/changelog/83587.yaml b/docs/changelog/83587.yaml index 5aafce5f341da..138bf0b88bdd9 100644 --- a/docs/changelog/83587.yaml +++ b/docs/changelog/83587.yaml @@ -2,4 +2,4 @@ pr: 83587 summary: Fix naming in health indicators area: Health type: enhancement -issues: [ ] +issues: [] diff --git a/docs/changelog/83603.yaml b/docs/changelog/83603.yaml index 238d0c5a1420c..3c8626e621d93 100644 --- a/docs/changelog/83603.yaml +++ b/docs/changelog/83603.yaml @@ -3,4 +3,4 @@ summary: Cache ILM policy name on `IndexMetadata` area: ILM+SLM type: enhancement issues: - - 83582 + - 83582 diff --git a/docs/changelog/83644.yaml b/docs/changelog/83644.yaml index 70d8d6f391d30..56c5c4b6bf5e7 100644 --- a/docs/changelog/83644.yaml +++ b/docs/changelog/83644.yaml @@ -2,4 +2,4 @@ pr: 83644 summary: Wait for model process to be stop in stop deployment area: Machine Learning type: bug -issues: [ ] +issues: [] diff --git a/docs/changelog/83645.yaml b/docs/changelog/83645.yaml index 5bc2dbd23c859..8c1dd88c285e6 100644 --- a/docs/changelog/83645.yaml +++ b/docs/changelog/83645.yaml @@ -3,4 +3,4 @@ summary: Fix submit after shutdown in process worker service area: Machine Learning type: bug issues: - - 83633 + - 83633 diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.delete_desired_nodes.json b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.delete_desired_nodes.json index 8317636ee61ed..ff53ad1d9f4cd 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.delete_desired_nodes.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.delete_desired_nodes.json @@ -1,21 +1,19 @@ { - "_internal.delete_desired_nodes": { - "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-desired-nodes.html", + "_internal.delete_desired_nodes":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-desired-nodes.html", "description": "Deletes the desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." }, - "stability": "experimental", - "visibility": "private", - "headers": { - "accept": [ - "application/json" - ] + "stability":"experimental", + "visibility":"private", + "headers":{ + "accept": [ "application/json"] }, - "url": { - "paths": [ + "url":{ + "paths":[ { - "path": "/_internal/desired_nodes", - "methods": [ + "path":"/_internal/desired_nodes", + "methods":[ "DELETE" ] } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.get_desired_nodes.json b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.get_desired_nodes.json index 9fa2a2ca110fb..8fa21ec042c35 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.get_desired_nodes.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.get_desired_nodes.json @@ -1,21 +1,19 @@ { - "_internal.get_desired_nodes": { - "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/get-desired-nodes.html", + "_internal.get_desired_nodes":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-desired-nodes.html", "description": "Gets the latest desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." }, - "stability": "experimental", - "visibility": "private", - "headers": { - "accept": [ - "application/json" - ] + "stability":"experimental", + "visibility":"private", + "headers":{ + "accept": [ "application/json"] }, - "url": { - "paths": [ + "url":{ + "paths":[ { - "path": "/_internal/desired_nodes/_latest", - "methods": [ + "path":"/_internal/desired_nodes/_latest", + "methods":[ "GET" ] } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json index 99f035d88e9ed..bf06e63dc966a 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.health.json @@ -1,30 +1,28 @@ { - "_internal.health": { - "documentation": { + "_internal.health":{ + "documentation":{ "url": null, - "description": "Returns the health of the cluster." + "description":"Returns the health of the cluster." }, - "stability": "experimental", - "visibility": "private", - "headers": { - "accept": [ - "application/json" - ] + "stability":"experimental", + "visibility":"private", + "headers":{ + "accept": [ "application/json"] }, - "url": { - "paths": [ + "url":{ + "paths":[ { - "path": "/_internal/_health", - "methods": [ + "path":"/_internal/_health", + "methods":[ "GET" ] } ] }, - "params": { - "timeout": { - "type": "time", - "description": "Explicit operation timeout" + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" } } } diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.update_desired_nodes.json b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.update_desired_nodes.json index bac7b1879a0dd..4d67eaef1bd2e 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.update_desired_nodes.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/_internal.update_desired_nodes.json @@ -1,30 +1,26 @@ { - "_internal.update_desired_nodes": { - "documentation": { - "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/update-desired-nodes.html", + "_internal.update_desired_nodes":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/update-desired-nodes.html", "description": "Updates the desired nodes. Designed for indirect use by ECE/ESS and ECK. Direct use is not supported." }, - "stability": "experimental", - "visibility": "private", - "headers": { - "accept": [ - "application/json" - ], - "content_type": [ - "application/json" - ] + "stability":"experimental", + "visibility":"private", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] }, - "url": { - "paths": [ + "url":{ + "paths":[ { - "path": "/_internal/desired_nodes/{history_id}/{version}", - "methods": [ + "path":"/_internal/desired_nodes/{history_id}/{version}", + "methods":[ "PUT" ], - "parts": { + "parts":{ "history_id": { - "type": "string", - "description": "the history id" + "type":"string", + "description":"the history id" }, "version": { "type": "integer", diff --git a/rest-api-spec/src/main/resources/schema.json b/rest-api-spec/src/main/resources/schema.json index ab3a55952dfc8..31f688c9e7ed5 100644 --- a/rest-api-spec/src/main/resources/schema.json +++ b/rest-api-spec/src/main/resources/schema.json @@ -11,9 +11,9 @@ "minProperties": 1, "maxProperties": 1, "patternProperties": { - "^(?:[a-z]+?(_[a-z]+)*(\\.[a-z]+?(_[a-z]+)*)?|_internal\\.[a-z]+?(_[a-z]+)*)$": { - "$ref": "#/definitions/Components" - } + "^(?:[a-z]+?(_[a-z]+)*(\\.[a-z]+?(_[a-z]+)*)?|_internal\\.[a-z]+?(_[a-z]+)*)$": { + "$ref": "#/definitions/Components" + } }, "additionalProperties": false, "title": "API name", diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/10_basic.yml index 4d657e32f7d1c..804a25bf67e63 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.desired_nodes/10_basic.yml @@ -6,7 +6,7 @@ setup: --- teardown: - do: - _internal.delete_desired_nodes: { } + _internal.delete_desired_nodes: {} --- "Test update desired nodes": - do: @@ -24,12 +24,12 @@ teardown: history_id: "test" version: 1 body: - nodes: - - { settings: { "node.name": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } + nodes: + - { settings: { "node.name": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -48,7 +48,7 @@ teardown: - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -77,7 +77,7 @@ teardown: - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -96,7 +96,7 @@ teardown: - match: { replaced_existing_history_id: true } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "new_history" @@ -125,7 +125,7 @@ teardown: - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -134,11 +134,11 @@ teardown: - { settings: { node: { external_id: "instance-000187" } }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } - do: - _internal.delete_desired_nodes: { } + _internal.delete_desired_nodes: {} - do: catch: missing - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: { status: 404 } --- "Test update desired nodes is idempotent": @@ -161,7 +161,7 @@ teardown: - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -179,7 +179,7 @@ teardown: - match: { replaced_existing_history_id: false } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -219,7 +219,7 @@ teardown: - match: { error.reason: "version [1] has been superseded by version [2] for history [test]" } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -259,7 +259,7 @@ teardown: - match: { error.reason: "Desired nodes with history [test] and version [1] already exists with a different definition" } - do: - _internal.get_desired_nodes: { } + _internal.get_desired_nodes: {} - match: $body: history_id: "test" @@ -405,8 +405,8 @@ teardown: version: 1 body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } - - { settings: { "node.external_id": "instance-000187" }, processors: 16, memory: "64gb", storage: "128gb", node_version: $es_version } + - { settings: { "node.external_id": "instance-000187"}, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } + - { settings: { "node.external_id": "instance-000187"}, processors: 16, memory: "64gb", storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: illegal_argument_exception } - match: { error.reason: "Some nodes contain the same setting value [instance-000187] for [node.external_id]" } @@ -428,7 +428,7 @@ teardown: version: "asa" body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } + - { settings: { "node.external_id": "instance-000187"}, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: illegal_argument_exception } - match: { error.reason: "Failed to parse long parameter [version] with value [asa]" } @@ -450,7 +450,7 @@ teardown: version: -1 body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } + - { settings: { "node.external_id": "instance-000187"}, processors: 8, memory: "64gb", storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: action_request_validation_exception } - match: { error.reason: "Validation Failed: 1: version must be positive;" } @@ -463,7 +463,7 @@ teardown: version: 1 body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 8, memory: "64gb", storage: "128gb", node_version: "7.16.0" } + - { settings: { "node.external_id": "instance-000187"}, processors: 8, memory: "64gb", storage: "128gb", node_version: "7.16.0" } - match: { status: 400 } - match: { error.type: illegal_argument_exception } - match: { error.reason: "Nodes with ids [instance-000187] in positions [0] contain invalid settings" } @@ -499,7 +499,7 @@ teardown: history_id: "test" version: 1 body: - nodes: [ ] + nodes: [] - match: { status: 400 } - match: { error.type: action_request_validation_exception } - match: { error.reason: "Validation Failed: 1: nodes must contain at least one master node;" } @@ -585,7 +585,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, memory: "64gb", storage: "128gb", node_version: $es_version } + - { settings: {}, memory: "64gb", storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -606,7 +606,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, processors: 8, storage: "128gb", node_version: $es_version } + - { settings: {}, processors: 8, storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -627,7 +627,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, processors: 8, memory: null, storage: "128gb", node_version: $es_version } + - { settings: {}, processors: 8, memory: null, storage: "128gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -648,7 +648,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, processors: 8, memory: "64gb", node_version: $es_version } + - { settings: {}, processors: 8, memory: "64gb", node_version: $es_version } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -669,7 +669,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, processors: 8, memory: "64gb", storage: null, node_version: $es_version } + - { settings: {}, processors: 8, memory: "64gb", storage: null, node_version: $es_version } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -681,7 +681,7 @@ teardown: version: 1 body: nodes: - - { settings: { }, processors: 8, memory: "64gb", storage: "128gb" } + - { settings: {}, processors: 8, memory: "64gb", storage: "128gb" } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -693,7 +693,7 @@ teardown: version: 1 body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 64, memory: "1b", storage: "1b", node_version: " " } + - { settings: { "node.external_id": "instance-000187"}, processors: 64, memory: "1b", storage: "1b", node_version: " " } - match: { status: 400 } - match: { error.type: x_content_parse_exception } --- @@ -705,6 +705,6 @@ teardown: version: 1 body: nodes: - - { settings: { "node.external_id": "instance-000187" }, processors: 64, memory: "1b", storage: "1b", node_version: null } + - { settings: { "node.external_id": "instance-000187"}, processors: 64, memory: "1b", storage: "1b", node_version: null } - match: { status: 400 } - match: { error.type: x_content_parse_exception } diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/10_basic.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/10_basic.yml index 9b37685f6f591..bb1b6db2f2d4c 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/10_basic.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/health/10_basic.yml @@ -5,7 +5,7 @@ reason: "health was only added in 8.2.0" - do: - _internal.health: { } + _internal.health: {} - is_true: cluster_name - match: { status: "GREEN" } diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.rollover/25_max_shard_doc_condition.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.rollover/25_max_shard_doc_condition.yml index b57e6341a204b..36d33175881fa 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.rollover/25_max_shard_doc_condition.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/indices.rollover/25_max_shard_doc_condition.yml @@ -15,14 +15,14 @@ number_of_shards: 1 number_of_replicas: 0 aliases: - logs_search: { } + logs_search: {} # index first document and wait for refresh - do: index: index: logs-1 - id: "1" - body: { "foo": "hello world" } + id: "1" + body: { "foo": "hello world" } refresh: true # perform alias rollover with no result @@ -41,8 +41,8 @@ - do: index: index: logs-1 - id: "2" - body: { "foo": "hello world" } + id: "2" + body: { "foo": "hello world" } refresh: true # perform alias rollover diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml index f97cb83937597..3d36467a48f6a 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml @@ -212,7 +212,7 @@ empty routing_path: settings: index: mode: time_series - routing_path: [ ] + routing_path: [] time_series: start_time: 2021-04-28T00:00:00Z end_time: 2021-04-29T00:00:00Z @@ -232,7 +232,7 @@ empty start end times: settings: index: mode: time_series - routing_path: [ ] + routing_path: [] time_series: start_time: "" end_time: "" @@ -537,7 +537,7 @@ check time_series default time bound value: settings: index: mode: time_series - routing_path: [ metricset ] + routing_path: [metricset] time_series: start_time: -9999-01-01T00:00:00Z end_time: 9999-12-31T23:59:59.999Z @@ -569,7 +569,7 @@ check time_series empty time bound value: settings: index: mode: time_series - routing_path: [ metricset ] + routing_path: [metricset] mappings: properties: "@timestamp": diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/license/20_put_license.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/license/20_put_license.yml index bf8262f02c257..5540897128aee 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/license/20_put_license.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/license/20_put_license.yml @@ -129,12 +129,12 @@ teardown: # Check the current state of the license. If this is not a trail, then the rest of the test will fail (but the failure is hard to diagnose without this assertion) - do: - license.get: { } + license.get: {} - match: { license.type: "trial" } - do: - license.get_trial_status: { } + license.get_trial_status: {} - match: { eligible_to_start_trial: false } From 486262b55bd90897d2336228ffa8699bbb36444c Mon Sep 17 00:00:00 2001 From: gmarouli Date: Wed, 9 Feb 2022 17:30:49 +0100 Subject: [PATCH 9/9] Fix test --- .../java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java b/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java index fe32a6606e61b..6174c029c47cb 100644 --- a/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java +++ b/x-pack/qa/repository-old-versions/src/test/java/org/elasticsearch/oldrepos/OldRepositoryAccessIT.java @@ -340,7 +340,7 @@ private void restoreMountAndVerify( assertEquals(numberOfShards, restoreSnapshotResponse.getRestoreInfo().totalShards()); assertEquals(numberOfShards, restoreSnapshotResponse.getRestoreInfo().successfulShards()); - ensureGreen("restored_"); + ensureGreen("restored_" + indexName); MappingMetadata mapping = client.indices() .getMapping(new GetMappingsRequest().indices("restored_" + indexName), RequestOptions.DEFAULT)