diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java index 0f277d8111bb..be784db74700 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/ClusterClientIT.java @@ -338,11 +338,6 @@ public class ClusterClientIT extends ESRestHighLevelClientTestCase { assertThat(response.status(), equalTo(RestStatus.REQUEST_TIMEOUT)); assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED)); assertNoIndices(response); - assertWarnings( - "The HTTP status code for a cluster health timeout will be changed from 408 to 200 in a " - + "future version. Set the [return_200_for_cluster_health_timeout] query parameter to [true] to suppress this message and " - + "opt in to the future behaviour now." - ); } public void testRemoteInfo() throws Exception { diff --git a/docs/reference/cluster/health.asciidoc b/docs/reference/cluster/health.asciidoc index 92273b15e2e5..e958a29d75bb 100644 --- a/docs/reference/cluster/health.asciidoc +++ b/docs/reference/cluster/health.asciidoc @@ -97,11 +97,6 @@ include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=timeoutparms] provided or better, i.e. `green` > `yellow` > `red`. By default, will not wait for any status. -`return_200_for_cluster_health_timeout`:: - (Optional, Boolean) A boolean value which controls whether to return HTTP 200 - status code instead of HTTP 408 in case of a cluster health timeout from - the server side. Defaults to false. - [[cluster-health-api-response-body]] ==== {api-response-body-title} diff --git a/docs/reference/migration/migrate_7_16.asciidoc b/docs/reference/migration/migrate_7_16.asciidoc index a80c38e7a3bf..5d22315bf549 100644 --- a/docs/reference/migration/migrate_7_16.asciidoc +++ b/docs/reference/migration/migrate_7_16.asciidoc @@ -91,7 +91,7 @@ logging>>. ==== *Details* + In SAML, Identity Providers (IdPs) can either be explicitly configured to -release a `NameID` with a specific format, or configured to attempt to conform +release a `NameID` with a specific format, or configured to attempt to conform with the requirements of a Service Provider (SP). The SP declares its requirements in the `NameIDPolicy` element of a SAML Authentication Request. In {es}, the `nameid_format` SAML realm setting controls the `NameIDPolicy` @@ -106,9 +106,9 @@ IdP. If you want to retain the previous behavior, set `nameid_format` to *Impact* + If you currently don't configure `nameid_format` explicitly, it's possible -that your IdP will reject authentication requests from {es} because the requests +that your IdP will reject authentication requests from {es} because the requests do not specify a `NameID` format (and your IdP is configured to expect one). -This mismatch can result in a broken SAML configuration. If you're unsure whether +This mismatch can result in a broken SAML configuration. If you're unsure whether your IdP is explicitly configured to use a certain `NameID` format and you want to retain current behavior , try setting `nameid_format` to `urn:oasis:names:tc:SAML:2.0:nameid-format:transient` explicitly. ==== @@ -290,7 +290,7 @@ The `estimated_heap_memory_usage_bytes` property in the {ref}/put-trained-models.html[create trained models API] is deprecated in 7.16. *Impact* + -Use `model_size_bytes` instead. +Use `model_size_bytes` instead. ==== [discrete] @@ -324,14 +324,14 @@ guide]. *Details* + Directly accessing system indices is deprecated. In {es} 8.0, you must add the `allow_restricted_indices` permission set to `true` on a user role to access -system indices. Refer to +system indices. Refer to {ref}/defining-roles.html#roles-indices-priv[indices privileges] for information on adding this permission to an index privilege. *Impact* + -Accessing system indices directly results in warnings in the header of API +Accessing system indices directly results in warnings in the header of API responses and in the deprecation logs. Use {kib} or the associated feature's -{es} APIs to manage the data that you want to access. While it's still possible +{es} APIs to manage the data that you want to access. While it's still possible to access system indices in {es} 7.16, they are reserved only for internal use by Elastic products and should not be accessed directly. ==== @@ -340,27 +340,6 @@ by Elastic products and should not be accessed directly. [[breaking_716_cluster_deprecations]] ==== Cluster deprecations -[[deprecate-cluster-health-408]] -.Distinguishing cluster health timeout status by HTTP response code is now deprecated. -[%collapsible] -==== -*Details* + -The {ref}/cluster-health.html[cluster health API] includes options for waiting -for certain health conditions to be satisfied. If the requested conditions are -not satisfied within a timeout then {es} will send back a normal response -including the field `"timed_out": true`. In earlier versions it would also use -the HTTP response code `408 Request timeout` if the request timed out, and `200 -OK` otherwise. The `408 Request timeout` response code is not appropriate for -this situation and its use is deprecated. Future versions will use the response -code `200 OK` for both cases. - -*Impact* + -Update your application to read the `"timed_out"` field of the response instead -of the HTTP response code to determine whether the request timed out or not. To -avoid deprecation warnings and opt into the future behaviour, include the query -parameter `?return_200_for_cluster_health_timeout` in your request. -==== - [[script-context-cache-deprecated]] .The script context cache is deprecated. [%collapsible] diff --git a/rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json b/rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json index 7d33fdd52ab8..91712bbbded2 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json +++ b/rest-api-spec/src/main/resources/rest-api-spec/api/cluster.health.json @@ -102,10 +102,6 @@ "red" ], "description":"Wait until cluster is in a specific state" - }, - "return_200_for_cluster_health_timeout":{ - "type":"boolean", - "description":"Whether to return HTTP 200 instead of 408 in case of a cluster health timeout from the server side" } } } diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml index 16d943332dc2..66a7cb2b48db 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/cluster.health/20_request_timeout.yml @@ -35,28 +35,3 @@ - match: { initializing_shards: 0 } - match: { unassigned_shards: 0 } - gte: { number_of_pending_tasks: 0 } - ---- -"cluster health request timeout with 200 response code": - - skip: - version: " - 7.15.99" - reason: "return_200_for_cluster_health_timeout was added in 7.16" - features: [ "allowed_warnings" ] - - do: - allowed_warnings: - - 'the [return_200_for_cluster_health_timeout] parameter is deprecated and will be removed in a future release.' - cluster.health: - timeout: 1ms - wait_for_active_shards: 5 - return_200_for_cluster_health_timeout: true - - - is_true: cluster_name - - is_true: timed_out - - gte: { number_of_nodes: 1 } - - gte: { number_of_data_nodes: 1 } - - match: { active_primary_shards: 0 } - - match: { active_shards: 0 } - - match: { relocating_shards: 0 } - - match: { initializing_shards: 0 } - - match: { unassigned_shards: 0 } - - gte: { number_of_pending_tasks: 0 } diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java index 633933d3c1a6..cfa331d829bb 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequest.java @@ -35,8 +35,6 @@ public class ClusterHealthRequest extends MasterNodeReadRequest PARSER = new ConstructingObjectParser<>( "cluster_health_response", @@ -124,12 +119,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo XContentParser parser, Void context, String index) -> ClusterIndexHealth.innerFromXContent(parser, index); - static final String ES_CLUSTER_HEALTH_REQUEST_TIMEOUT_200_KEY = "return_200_for_cluster_health_timeout"; - static final String CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG = "The HTTP status code for a cluster health timeout " - + "will be changed from 408 to 200 in a future version. Set the [" - + ES_CLUSTER_HEALTH_REQUEST_TIMEOUT_200_KEY - + "] " - + "query parameter to [true] to suppress this message and opt in to the future behaviour now."; static { // ClusterStateHealth fields @@ -162,7 +151,8 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo private boolean timedOut = false; private ClusterStateHealth clusterStateHealth; private ClusterHealthStatus clusterHealthStatus; - private boolean return200ForClusterHealthTimeout; + + public ClusterHealthResponse() {} public ClusterHealthResponse(StreamInput in) throws IOException { super(in); @@ -174,19 +164,11 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo numberOfInFlightFetch = in.readInt(); delayedUnassignedShards = in.readInt(); taskMaxWaitingTime = in.readTimeValue(); - if (in.getVersion().onOrAfter(Version.V_7_16_0)) { - return200ForClusterHealthTimeout = in.readBoolean(); - } } /** needed for plugins BWC */ - public ClusterHealthResponse( - String clusterName, - String[] concreteIndices, - ClusterState clusterState, - boolean return200ForServerTimeout - ) { - this(clusterName, concreteIndices, clusterState, -1, -1, -1, TimeValue.timeValueHours(0), return200ForServerTimeout); + public ClusterHealthResponse(String clusterName, String[] concreteIndices, ClusterState clusterState) { + this(clusterName, concreteIndices, clusterState, -1, -1, -1, TimeValue.timeValueHours(0)); } public ClusterHealthResponse( @@ -196,8 +178,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo int numberOfPendingTasks, int numberOfInFlightFetch, int delayedUnassignedShards, - TimeValue taskMaxWaitingTime, - boolean return200ForServerTimeout + TimeValue taskMaxWaitingTime ) { this.clusterName = clusterName; this.numberOfPendingTasks = numberOfPendingTasks; @@ -206,7 +187,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo this.taskMaxWaitingTime = taskMaxWaitingTime; this.clusterStateHealth = new ClusterStateHealth(clusterState, concreteIndices); this.clusterHealthStatus = clusterStateHealth.getStatus(); - this.return200ForClusterHealthTimeout = return200ForServerTimeout; } /** @@ -345,11 +325,6 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo out.writeInt(numberOfInFlightFetch); out.writeInt(delayedUnassignedShards); out.writeTimeValue(taskMaxWaitingTime); - if (out.getVersion().onOrAfter(Version.V_7_16_0)) { - out.writeBoolean(return200ForClusterHealthTimeout); - } else if (return200ForClusterHealthTimeout) { - throw new IllegalArgumentException("Can't fix response code in a cluster involving nodes with version " + out.getVersion()); - } } @Override @@ -359,19 +334,7 @@ public class ClusterHealthResponse extends ActionResponse implements StatusToXCo @Override public RestStatus status() { - if (isTimedOut() == false) { - return RestStatus.OK; - } - if (return200ForClusterHealthTimeout) { - return RestStatus.OK; - } else { - deprecationLogger.critical( - DeprecationCategory.API, - "cluster_health_request_timeout", - CLUSTER_HEALTH_REQUEST_TIMEOUT_DEPRECATION_MSG - ); - return RestStatus.REQUEST_TIMEOUT; - } + return isTimedOut() ? RestStatus.REQUEST_TIMEOUT : RestStatus.OK; } @Override diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java index 88b14e8bef2a..417c5a11c46a 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/health/TransportClusterHealthAction.java @@ -418,8 +418,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction< numberOfPendingTasks, numberOfInFlightFetch, UnassignedInfo.getNumberOfDelayedUnassigned(clusterState), - pendingTaskTimeInQueue, - request.doesReturn200ForClusterHealthTimeout() + pendingTaskTimeInQueue ); response.setStatus(ClusterHealthStatus.RED); return response; @@ -432,8 +431,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction< numberOfPendingTasks, numberOfInFlightFetch, UnassignedInfo.getNumberOfDelayedUnassigned(clusterState), - pendingTaskTimeInQueue, - request.doesReturn200ForClusterHealthTimeout() + pendingTaskTimeInQueue ); } } diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index d543c162a4dd..f8496fa40ce9 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -83,9 +83,6 @@ public class RestClusterHealthAction extends BaseRestHandler { if (request.param("wait_for_events") != null) { clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT))); } - clusterHealthRequest.return200ForClusterHealthTimeout( - request.paramAsBoolean("return_200_for_cluster_health_timeout", clusterHealthRequest.doesReturn200ForClusterHealthTimeout()) - ); return clusterHealthRequest; } diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java index 8fc687d65841..c4e67a339bc6 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthRequestTests.java @@ -42,7 +42,6 @@ public class ClusterHealthRequestTests extends ESTestCase { assertThat(cloneRequest.waitForEvents(), equalTo(originalRequest.waitForEvents())); assertIndicesEquals(cloneRequest.indices(), originalRequest.indices()); assertThat(cloneRequest.indicesOptions(), equalTo(originalRequest.indicesOptions())); - assertThat(cloneRequest.doesReturn200ForClusterHealthTimeout(), equalTo(originalRequest.doesReturn200ForClusterHealthTimeout())); } public void testRequestReturnsHiddenIndicesByDefault() { diff --git a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java index 8bade4a21e87..a94e67e784eb 100644 --- a/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java +++ b/server/src/test/java/org/elasticsearch/action/admin/cluster/health/ClusterHealthResponsesTests.java @@ -15,7 +15,6 @@ import org.elasticsearch.cluster.health.ClusterIndexHealth; import org.elasticsearch.cluster.health.ClusterIndexHealthTests; import org.elasticsearch.cluster.health.ClusterStateHealth; import org.elasticsearch.cluster.metadata.Metadata; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.Writeable; @@ -44,26 +43,17 @@ public class ClusterHealthResponsesTests extends AbstractSerializingTestCase params) { diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java index a98a7a07dd23..dcf7409a025b 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/utils/MlIndexAndAliasTests.java @@ -35,7 +35,6 @@ import org.elasticsearch.cluster.metadata.IndexTemplateMetadata; import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.transport.TransportAddress; @@ -111,7 +110,7 @@ public class MlIndexAndAliasTests extends ESTestCase { clusterAdminClient = mock(ClusterAdminClient.class); doAnswer(invocationOnMock -> { ActionListener listener = (ActionListener) invocationOnMock.getArguments()[1]; - listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false)); + listener.onResponse(new ClusterHealthResponse()); return null; }).when(clusterAdminClient).health(any(ClusterHealthRequest.class), any(ActionListener.class)); diff --git a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java index fb18f2fc08a2..c0adb17a8aad 100644 --- a/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java +++ b/x-pack/plugin/ml/src/test/java/org/elasticsearch/xpack/ml/job/process/autodetect/AutodetectProcessManagerTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.util.concurrent.EsExecutors; import org.elasticsearch.common.util.concurrent.EsRejectedExecutionException; import org.elasticsearch.common.util.concurrent.ThreadContext; import org.elasticsearch.core.CheckedConsumer; -import org.elasticsearch.core.TimeValue; import org.elasticsearch.env.Environment; import org.elasticsearch.env.TestEnvironment; import org.elasticsearch.index.analysis.AnalysisRegistry; @@ -172,9 +171,7 @@ public class AutodetectProcessManagerTests extends ESTestCase { } if (t.getTypeName().contains("ClusterHealthResponse")) { ActionListener listener = (ActionListener) l; - listener.onResponse( - new ClusterHealthResponse("test", new String[0], ClusterState.EMPTY_STATE, 0, 0, 0, TimeValue.ZERO, false) - ); + listener.onResponse(new ClusterHealthResponse()); return null; } fail("Mock not configured to handle generic type " + t.getTypeName()); diff --git a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java index 9d731a0be584..33e66adc2853 100644 --- a/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java +++ b/x-pack/plugin/transform/src/test/java/org/elasticsearch/xpack/transform/persistence/TransformInternalIndexTests.java @@ -192,7 +192,7 @@ public class TransformInternalIndexTests extends ESTestCase { doAnswer(invocationOnMock -> { @SuppressWarnings("unchecked") ActionListener listener = (ActionListener) invocationOnMock.getArguments()[1]; - listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false)); + listener.onResponse(new ClusterHealthResponse()); return null; }).when(clusterClient).health(any(), any()); @@ -276,7 +276,7 @@ public class TransformInternalIndexTests extends ESTestCase { doAnswer(invocationOnMock -> { @SuppressWarnings("unchecked") ActionListener listener = (ActionListener) invocationOnMock.getArguments()[1]; - listener.onResponse(new ClusterHealthResponse("", Strings.EMPTY_ARRAY, ClusterState.EMPTY_STATE, false)); + listener.onResponse(new ClusterHealthResponse()); return null; }).when(clusterClient).health(any(), any());