diff --git a/rest-api-spec/build.gradle b/rest-api-spec/build.gradle index 0506b81f176ed..33745fa705bd0 100644 --- a/rest-api-spec/build.gradle +++ b/rest-api-spec/build.gradle @@ -91,8 +91,6 @@ tasks.named("yamlRestCompatTest").configure { 'indices.open/10_basic/?wait_for_active_shards=index-setting', // not fixing this in #70966 'indices.put_template/11_basic_with_types/Put template with empty mappings', - 'indices.shrink/30_copy_settings/Copy settings during shrink index', - 'indices.split/30_copy_settings/Copy settings during split index', 'mlt/20_docs/Basic mlt query with docs', 'mlt/30_unlike/Basic mlt query with unlike', 'search.aggregation/200_top_hits_metric/top_hits aggregation with sequence numbers', diff --git a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java index bc785a5b1f4d4..48b5855d6d6c7 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestResizeHandler.java @@ -12,6 +12,9 @@ import org.elasticsearch.action.admin.indices.shrink.ResizeType; import org.elasticsearch.action.support.ActiveShardCount; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; +import org.elasticsearch.core.Booleans; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -23,6 +26,7 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public abstract class RestResizeHandler extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestResizeHandler.class); RestResizeHandler() { } @@ -34,6 +38,15 @@ public abstract class RestResizeHandler extends BaseRestHandler { @Override public final RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { + if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("copy_settings")) { + deprecationLogger.compatibleApiWarning("copy_settings", "parameter [copy_settings] is deprecated and will be removed in 8.0.0"); + + final String rawCopySettings = request.param("copy_settings"); + final boolean copySettings = Booleans.parseBoolean(rawCopySettings); + if (copySettings == false) { + throw new IllegalArgumentException("parameter [copy_settings] can not be explicitly set to [false]"); + } + } final ResizeRequest resizeRequest = new ResizeRequest(request.param("target"), request.param("index")); resizeRequest.setResizeType(getResizeType()); request.applyContentParser(resizeRequest::fromXContent);