Remove any references to V_7 (#118103)

This PR removes any references to org.elasticsearch.core.RestApiVersion#V_7.
This commit is contained in:
John Verwolf 2024-12-11 17:43:17 -08:00 committed by GitHub
parent c6b42bb502
commit a560782995
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 33 additions and 171 deletions

View file

@ -0,0 +1,11 @@
pr: 118103
summary: "Remove any references to org.elasticsearch.core.RestApiVersion#V_7"
area: Infra/Core
type: breaking
issues: []
breaking:
title: "Remove any references to org.elasticsearch.core.RestApiVersion#V_7"
area: REST API
details: "This PR removes all references to V_7 in the Rest API. V7 features marked for deprecation have been removed."
impact: "This change is breaking for any external plugins/clients that rely on the V_7 enum or deprecated version 7 functionality"
notable: false

View file

@ -20,10 +20,7 @@ public enum RestApiVersion {
V_9(9), V_9(9),
V_8(8), V_8(8);
@UpdateForV9(owner = UpdateForV9.Owner.CORE_INFRA) // remove all references to V_7 then delete this annotation
V_7(7);
public final byte major; public final byte major;
@ -54,7 +51,6 @@ public enum RestApiVersion {
return switch (restApiVersion) { return switch (restApiVersion) {
case V_9 -> r -> r.major == V_9.major; case V_9 -> r -> r.major == V_9.major;
case V_8 -> r -> r.major == V_8.major; case V_8 -> r -> r.major == V_8.major;
case V_7 -> r -> r.major == V_7.major;
}; };
} }
@ -62,15 +58,11 @@ public enum RestApiVersion {
return switch (restApiVersion) { return switch (restApiVersion) {
case V_9 -> r -> r.major >= V_9.major; case V_9 -> r -> r.major >= V_9.major;
case V_8 -> r -> r.major >= V_8.major; case V_8 -> r -> r.major >= V_8.major;
case V_7 -> r -> r.major >= V_7.major;
}; };
} }
public static RestApiVersion forMajor(int major) { public static RestApiVersion forMajor(int major) {
switch (major) { switch (major) {
case 7 -> {
return V_7;
}
case 8 -> { case 8 -> {
return V_8; return V_8;
} }

View file

@ -177,7 +177,7 @@ public class SimulatePipelineRequest extends ActionRequest implements ToXContent
String index = ConfigurationUtils.readStringOrIntProperty(null, null, dataMap, Metadata.INDEX.getFieldName(), "_index"); String index = ConfigurationUtils.readStringOrIntProperty(null, null, dataMap, Metadata.INDEX.getFieldName(), "_index");
String id = ConfigurationUtils.readStringOrIntProperty(null, null, dataMap, Metadata.ID.getFieldName(), "_id"); String id = ConfigurationUtils.readStringOrIntProperty(null, null, dataMap, Metadata.ID.getFieldName(), "_id");
String routing = ConfigurationUtils.readOptionalStringOrIntProperty(null, null, dataMap, Metadata.ROUTING.getFieldName()); String routing = ConfigurationUtils.readOptionalStringOrIntProperty(null, null, dataMap, Metadata.ROUTING.getFieldName());
if (restApiVersion != RestApiVersion.V_8 && dataMap.containsKey(Metadata.TYPE.getFieldName())) { if (dataMap.containsKey(Metadata.TYPE.getFieldName())) {
deprecationLogger.compatibleCritical( deprecationLogger.compatibleCritical(
"simulate_pipeline_with_types", "simulate_pipeline_with_types",
"[types removal] specifying _type in pipeline simulation requests is deprecated" "[types removal] specifying _type in pipeline simulation requests is deprecated"

View file

@ -49,7 +49,6 @@ public interface ChunkedToXContent {
*/ */
default Iterator<? extends ToXContent> toXContentChunked(RestApiVersion restApiVersion, ToXContent.Params params) { default Iterator<? extends ToXContent> toXContentChunked(RestApiVersion restApiVersion, ToXContent.Params params) {
return switch (restApiVersion) { return switch (restApiVersion) {
case V_7 -> throw new AssertionError("v7 API not supported");
case V_8 -> toXContentChunkedV8(params); case V_8 -> toXContentChunkedV8(params);
case V_9 -> toXContentChunked(params); case V_9 -> toXContentChunked(params);
}; };

View file

@ -13,6 +13,7 @@ import org.elasticsearch.common.Strings;
import org.elasticsearch.common.util.CollectionUtils; import org.elasticsearch.common.util.CollectionUtils;
import org.elasticsearch.common.util.Maps; import org.elasticsearch.common.util.Maps;
import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.core.UpdateForV10;
import org.elasticsearch.index.VersionType; import org.elasticsearch.index.VersionType;
import org.elasticsearch.index.mapper.IdFieldMapper; import org.elasticsearch.index.mapper.IdFieldMapper;
import org.elasticsearch.index.mapper.IndexFieldMapper; import org.elasticsearch.index.mapper.IndexFieldMapper;
@ -957,6 +958,8 @@ public final class IngestDocument {
terminate = false; terminate = false;
} }
// Unconditionally deprecate the _type field once V7 BWC support is removed
@UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT)
public enum Metadata { public enum Metadata {
INDEX(IndexFieldMapper.NAME), INDEX(IndexFieldMapper.NAME),
TYPE("_type"), TYPE("_type"),

View file

@ -30,7 +30,7 @@ public class BulkRequestParserTests extends ESTestCase {
@UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT) // Replace with just RestApiVersion.values() when V8 no longer exists @UpdateForV10(owner = UpdateForV10.Owner.DATA_MANAGEMENT) // Replace with just RestApiVersion.values() when V8 no longer exists
public static final List<RestApiVersion> REST_API_VERSIONS_POST_V8 = Stream.of(RestApiVersion.values()) public static final List<RestApiVersion> REST_API_VERSIONS_POST_V8 = Stream.of(RestApiVersion.values())
.filter(v -> v.compareTo(RestApiVersion.V_8) > 0) .filter(v -> v.matches(RestApiVersion.onOrAfter(RestApiVersion.V_9)))
.toList(); .toList();
public void testParserCannotBeReusedAfterFailure() { public void testParserCannotBeReusedAfterFailure() {

View file

@ -342,7 +342,7 @@ public class SimulatePipelineRequestParsingTests extends ESTestCase {
requestContent, requestContent,
false, false,
ingestService, ingestService,
RestApiVersion.V_7 RestApiVersion.V_8
); );
assertThat(actualRequest.verbose(), equalTo(false)); assertThat(actualRequest.verbose(), equalTo(false));
assertThat(actualRequest.documents().size(), equalTo(numDocs)); assertThat(actualRequest.documents().size(), equalTo(numDocs));

View file

@ -15,7 +15,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler;
import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentHelper;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9; import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.features.NodeFeature; import org.elasticsearch.features.NodeFeature;
import org.elasticsearch.xcontent.ToXContentObject; import org.elasticsearch.xcontent.ToXContentObject;
@ -142,7 +141,7 @@ public class License implements ToXContentObject {
*/ */
public static final String LICENSE_VERSION_MODE = "license_version"; public static final String LICENSE_VERSION_MODE = "license_version";
/** /**
* Set for {@link RestApiVersion#V_7} requests only * Set for RestApiVersion#V_7 requests only
* XContent param name to map the "enterprise" license type to "platinum" * XContent param name to map the "enterprise" license type to "platinum"
* for backwards compatibility with older clients * for backwards compatibility with older clients
*/ */

View file

@ -22,9 +22,6 @@ import java.util.stream.Collectors;
public final class MachineLearningField { public final class MachineLearningField {
public static final String DEPRECATED_ALLOW_NO_JOBS_PARAM = "allow_no_jobs";
public static final String DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM = "allow_no_datafeeds";
public static final Setting<Boolean> AUTODETECT_PROCESS = Setting.boolSetting( public static final Setting<Boolean> AUTODETECT_PROCESS = Setting.boolSetting(
"xpack.ml.autodetect_process", "xpack.ml.autodetect_process",
true, true,

View file

@ -12,9 +12,7 @@ import org.elasticsearch.action.support.tasks.BaseTasksResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
import org.elasticsearch.xcontent.ObjectParser; import org.elasticsearch.xcontent.ObjectParser;
import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xcontent.ParseField;
@ -27,10 +25,6 @@ import org.elasticsearch.xpack.core.ml.job.config.Job;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import static org.elasticsearch.core.RestApiVersion.equalTo;
import static org.elasticsearch.core.RestApiVersion.onOrAfter;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
public class CloseJobAction extends ActionType<CloseJobAction.Response> { public class CloseJobAction extends ActionType<CloseJobAction.Response> {
public static final CloseJobAction INSTANCE = new CloseJobAction(); public static final CloseJobAction INSTANCE = new CloseJobAction();
@ -45,11 +39,7 @@ public class CloseJobAction extends ActionType<CloseJobAction.Response> {
public static final ParseField TIMEOUT = new ParseField("timeout"); public static final ParseField TIMEOUT = new ParseField("timeout");
public static final ParseField FORCE = new ParseField("force"); public static final ParseField FORCE = new ParseField("force");
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate forRestApiVersion public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match").forRestApiVersion(onOrAfter(RestApiVersion.V_8));
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
public static final ParseField ALLOW_NO_MATCH_V7 = new ParseField("allow_no_match", DEPRECATED_ALLOW_NO_JOBS_PARAM)
.forRestApiVersion(equalTo(RestApiVersion.V_7));
public static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new); public static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
static { static {
@ -60,7 +50,6 @@ public class CloseJobAction extends ActionType<CloseJobAction.Response> {
); );
PARSER.declareBoolean(Request::setForce, FORCE); PARSER.declareBoolean(Request::setForce, FORCE);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH); PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH_V7);
} }
public static Request parseRequest(String jobId, XContentParser parser) { public static Request parseRequest(String jobId, XContentParser parser) {

View file

@ -15,6 +15,7 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.core.Nullable; import org.elasticsearch.core.Nullable;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.persistent.PersistentTasksCustomMetadata; import org.elasticsearch.persistent.PersistentTasksCustomMetadata;
import org.elasticsearch.tasks.CancellableTask; import org.elasticsearch.tasks.CancellableTask;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
@ -62,6 +63,7 @@ public class GetDatafeedsStatsAction extends ActionType<GetDatafeedsStatsAction.
// serialized to older nodes where the transport action was a MasterNodeReadAction. // serialized to older nodes where the transport action was a MasterNodeReadAction.
// TODO: Make this a simple request in a future version where there is no possibility // TODO: Make this a simple request in a future version where there is no possibility
// of this request being serialized to another node. // of this request being serialized to another node.
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING)
public static class Request extends MasterNodeReadRequest<Request> { public static class Request extends MasterNodeReadRequest<Request> {
public static final String ALLOW_NO_MATCH = "allow_no_match"; public static final String ALLOW_NO_MATCH = "allow_no_match";

View file

@ -13,9 +13,7 @@ import org.elasticsearch.action.ActionType;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.time.DateMathParser; import org.elasticsearch.common.time.DateMathParser;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.index.mapper.DateFieldMapper;
import org.elasticsearch.xcontent.ObjectParser; import org.elasticsearch.xcontent.ObjectParser;
import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xcontent.ParseField;
@ -33,10 +31,6 @@ import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import java.util.function.LongSupplier; import java.util.function.LongSupplier;
import static org.elasticsearch.core.RestApiVersion.equalTo;
import static org.elasticsearch.core.RestApiVersion.onOrAfter;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
/** /**
* <p> * <p>
* This action returns summarized bucket results over multiple jobs. * This action returns summarized bucket results over multiple jobs.
@ -68,11 +62,7 @@ public class GetOverallBucketsAction extends ActionType<GetOverallBucketsAction.
public static final ParseField EXCLUDE_INTERIM = new ParseField("exclude_interim"); public static final ParseField EXCLUDE_INTERIM = new ParseField("exclude_interim");
public static final ParseField START = new ParseField("start"); public static final ParseField START = new ParseField("start");
public static final ParseField END = new ParseField("end"); public static final ParseField END = new ParseField("end");
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate forRestApiVersion public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match").forRestApiVersion(onOrAfter(RestApiVersion.V_8));
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
public static final ParseField ALLOW_NO_MATCH_V7 = new ParseField("allow_no_match", DEPRECATED_ALLOW_NO_JOBS_PARAM)
.forRestApiVersion(equalTo(RestApiVersion.V_7));
private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new); private static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
@ -88,7 +78,6 @@ public class GetOverallBucketsAction extends ActionType<GetOverallBucketsAction.
); );
PARSER.declareString((request, endTime) -> request.setEnd(parseDateOrThrow(endTime, END, System::currentTimeMillis)), END); PARSER.declareString((request, endTime) -> request.setEnd(parseDateOrThrow(endTime, END, System::currentTimeMillis)), END);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH); PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH_V7);
} }
static long parseDateOrThrow(String date, ParseField paramName, LongSupplier now) { static long parseDateOrThrow(String date, ParseField paramName, LongSupplier now) {

View file

@ -13,9 +13,7 @@ import org.elasticsearch.action.support.tasks.BaseTasksResponse;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.Task;
import org.elasticsearch.xcontent.ObjectParser; import org.elasticsearch.xcontent.ObjectParser;
import org.elasticsearch.xcontent.ParseField; import org.elasticsearch.xcontent.ParseField;
@ -29,10 +27,6 @@ import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import static org.elasticsearch.core.RestApiVersion.equalTo;
import static org.elasticsearch.core.RestApiVersion.onOrAfter;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM;
public class StopDatafeedAction extends ActionType<StopDatafeedAction.Response> { public class StopDatafeedAction extends ActionType<StopDatafeedAction.Response> {
public static final StopDatafeedAction INSTANCE = new StopDatafeedAction(); public static final StopDatafeedAction INSTANCE = new StopDatafeedAction();
@ -47,11 +41,7 @@ public class StopDatafeedAction extends ActionType<StopDatafeedAction.Response>
public static final ParseField TIMEOUT = new ParseField("timeout"); public static final ParseField TIMEOUT = new ParseField("timeout");
public static final ParseField FORCE = new ParseField("force"); public static final ParseField FORCE = new ParseField("force");
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate forRestApiVersion public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match");
public static final ParseField ALLOW_NO_MATCH = new ParseField("allow_no_match").forRestApiVersion(onOrAfter(RestApiVersion.V_8));
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
public static final ParseField ALLOW_NO_MATCH_V7 = new ParseField("allow_no_match", DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM)
.forRestApiVersion(equalTo(RestApiVersion.V_7));
public static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new); public static final ObjectParser<Request, Void> PARSER = new ObjectParser<>(NAME, Request::new);
static { static {
@ -62,7 +52,6 @@ public class StopDatafeedAction extends ActionType<StopDatafeedAction.Response>
); );
PARSER.declareBoolean(Request::setForce, FORCE); PARSER.declareBoolean(Request::setForce, FORCE);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH); PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH);
PARSER.declareBoolean(Request::setAllowNoMatch, ALLOW_NO_MATCH_V7);
} }
public static Request parseRequest(String datafeedId, XContentParser parser) { public static Request parseRequest(String datafeedId, XContentParser parser) {

View file

@ -10,9 +10,7 @@ import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table; import org.elasticsearch.common.Table;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -30,8 +28,6 @@ import org.elasticsearch.xpack.core.ml.datafeed.DatafeedTimingStats;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestCatDatafeedsAction extends AbstractCatAction { public class RestCatDatafeedsAction extends AbstractCatAction {
@ -52,16 +48,8 @@ public class RestCatDatafeedsAction extends AbstractCatAction {
if (Strings.isNullOrEmpty(datafeedId)) { if (Strings.isNullOrEmpty(datafeedId)) {
datafeedId = GetDatafeedsStatsAction.ALL; datafeedId = GetDatafeedsStatsAction.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(datafeedId); Request request = new Request(datafeedId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM,
Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> client.execute(GetDatafeedsStatsAction.INSTANCE, request, new RestResponseListener<>(channel) { return channel -> client.execute(GetDatafeedsStatsAction.INSTANCE, request, new RestResponseListener<>(channel) {
@Override @Override
public RestResponse buildResponse(Response getDatafeedsStatsRespons) throws Exception { public RestResponse buildResponse(Response getDatafeedsStatsRespons) throws Exception {

View file

@ -12,9 +12,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.common.Table; import org.elasticsearch.common.Table;
import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.ByteSizeValue;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -35,8 +33,6 @@ import org.elasticsearch.xpack.core.ml.stats.ForecastStats;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestCatJobsAction extends AbstractCatAction { public class RestCatJobsAction extends AbstractCatAction {
@ -57,16 +53,8 @@ public class RestCatJobsAction extends AbstractCatAction {
if (Strings.isNullOrEmpty(jobId)) { if (Strings.isNullOrEmpty(jobId)) {
jobId = Metadata.ALL; jobId = Metadata.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(jobId); Request request = new Request(jobId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_JOBS_PARAM,
Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> client.execute(GetJobsStatsAction.INSTANCE, request, new RestResponseListener<>(channel) { return channel -> client.execute(GetJobsStatsAction.INSTANCE, request, new RestResponseListener<>(channel) {
@Override @Override
public RestResponse buildResponse(Response getJobStatsResponse) throws Exception { public RestResponse buildResponse(Response getJobStatsResponse) throws Exception {

View file

@ -8,8 +8,6 @@ package org.elasticsearch.xpack.ml.rest.datafeeds;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -24,10 +22,8 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM;
import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID; import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestGetDatafeedStatsAction extends BaseRestHandler { public class RestGetDatafeedStatsAction extends BaseRestHandler {
@ -48,16 +44,8 @@ public class RestGetDatafeedStatsAction extends BaseRestHandler {
if (Strings.isNullOrEmpty(datafeedId)) { if (Strings.isNullOrEmpty(datafeedId)) {
datafeedId = GetDatafeedsStatsAction.ALL; datafeedId = GetDatafeedsStatsAction.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(datafeedId); Request request = new Request(datafeedId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM,
Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute( return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute(
GetDatafeedsStatsAction.INSTANCE, GetDatafeedsStatsAction.INSTANCE,
request, request,

View file

@ -7,8 +7,6 @@
package org.elasticsearch.xpack.ml.rest.datafeeds; package org.elasticsearch.xpack.ml.rest.datafeeds;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -26,11 +24,9 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM;
import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID; import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID;
import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED; import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestGetDatafeedsAction extends BaseRestHandler { public class RestGetDatafeedsAction extends BaseRestHandler {
@ -51,16 +47,8 @@ public class RestGetDatafeedsAction extends BaseRestHandler {
if (datafeedId == null) { if (datafeedId == null) {
datafeedId = GetDatafeedsAction.ALL; datafeedId = GetDatafeedsAction.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(datafeedId); Request request = new Request(datafeedId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(GetDatafeedsStatsAction.Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM,
GetDatafeedsStatsAction.Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute( return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute(
GetDatafeedsAction.INSTANCE, GetDatafeedsAction.INSTANCE,
request, request,

View file

@ -7,9 +7,7 @@
package org.elasticsearch.xpack.ml.rest.datafeeds; package org.elasticsearch.xpack.ml.rest.datafeeds;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestResponse;
@ -28,10 +26,8 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM;
import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID; import static org.elasticsearch.xpack.core.ml.datafeed.DatafeedConfig.ID;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestStopDatafeedAction extends BaseRestHandler { public class RestStopDatafeedAction extends BaseRestHandler {
@ -49,7 +45,6 @@ public class RestStopDatafeedAction extends BaseRestHandler {
@Override @Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
String datafeedId = restRequest.param(DatafeedConfig.ID.getPreferredName()); String datafeedId = restRequest.param(DatafeedConfig.ID.getPreferredName());
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request; Request request;
if (restRequest.hasContentOrSourceParam()) { if (restRequest.hasContentOrSourceParam()) {
XContentParser parser = restRequest.contentOrSourceParamParser(); XContentParser parser = restRequest.contentOrSourceParamParser();
@ -63,14 +58,7 @@ public class RestStopDatafeedAction extends BaseRestHandler {
if (restRequest.hasParam(Request.FORCE.getPreferredName())) { if (restRequest.hasParam(Request.FORCE.getPreferredName())) {
request.setForce(restRequest.paramAsBoolean(Request.FORCE.getPreferredName(), request.isForce())); request.setForce(restRequest.paramAsBoolean(Request.FORCE.getPreferredName(), request.isForce()));
} }
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH.getPreferredName(), request.allowNoMatch()));
DEPRECATED_ALLOW_NO_DATAFEEDS_PARAM,
Request.ALLOW_NO_MATCH.getPreferredName(),
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
} }
return channel -> client.execute(StopDatafeedAction.INSTANCE, request, new RestBuilderListener<Response>(channel) { return channel -> client.execute(StopDatafeedAction.INSTANCE, request, new RestBuilderListener<Response>(channel) {

View file

@ -7,9 +7,7 @@
package org.elasticsearch.xpack.ml.rest.job; package org.elasticsearch.xpack.ml.rest.job;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.TimeValue; import org.elasticsearch.core.TimeValue;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -23,10 +21,8 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
import static org.elasticsearch.xpack.core.ml.job.config.Job.ID; import static org.elasticsearch.xpack.core.ml.job.config.Job.ID;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestCloseJobAction extends BaseRestHandler { public class RestCloseJobAction extends BaseRestHandler {
@ -43,7 +39,6 @@ public class RestCloseJobAction extends BaseRestHandler {
@Override @Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request; Request request;
if (restRequest.hasContentOrSourceParam()) { if (restRequest.hasContentOrSourceParam()) {
request = Request.parseRequest(restRequest.param(Job.ID.getPreferredName()), restRequest.contentParser()); request = Request.parseRequest(restRequest.param(Job.ID.getPreferredName()), restRequest.contentParser());
@ -57,14 +52,7 @@ public class RestCloseJobAction extends BaseRestHandler {
if (restRequest.hasParam(Request.FORCE.getPreferredName())) { if (restRequest.hasParam(Request.FORCE.getPreferredName())) {
request.setForce(restRequest.paramAsBoolean(Request.FORCE.getPreferredName(), request.isForce())); request.setForce(restRequest.paramAsBoolean(Request.FORCE.getPreferredName(), request.isForce()));
} }
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH.getPreferredName(), request.allowNoMatch()));
DEPRECATED_ALLOW_NO_JOBS_PARAM,
Request.ALLOW_NO_MATCH.getPreferredName(),
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
} }
return channel -> client.execute(CloseJobAction.INSTANCE, request, new RestToXContentListener<>(channel)); return channel -> client.execute(CloseJobAction.INSTANCE, request, new RestToXContentListener<>(channel));
} }

View file

@ -9,8 +9,6 @@ package org.elasticsearch.xpack.ml.rest.job;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -25,10 +23,8 @@ import java.io.IOException;
import java.util.List; import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
import static org.elasticsearch.xpack.core.ml.job.config.Job.ID; import static org.elasticsearch.xpack.core.ml.job.config.Job.ID;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestGetJobStatsAction extends BaseRestHandler { public class RestGetJobStatsAction extends BaseRestHandler {
@ -52,16 +48,8 @@ public class RestGetJobStatsAction extends BaseRestHandler {
if (Strings.isNullOrEmpty(jobId)) { if (Strings.isNullOrEmpty(jobId)) {
jobId = Metadata.ALL; jobId = Metadata.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(jobId); Request request = new Request(jobId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_JOBS_PARAM,
Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute( return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute(
GetJobsStatsAction.INSTANCE, GetJobsStatsAction.INSTANCE,
request, request,

View file

@ -9,8 +9,6 @@ package org.elasticsearch.xpack.ml.rest.job;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.common.Strings; import org.elasticsearch.common.Strings;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -27,11 +25,9 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
import static org.elasticsearch.xpack.core.ml.job.config.Job.ID; import static org.elasticsearch.xpack.core.ml.job.config.Job.ID;
import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED; import static org.elasticsearch.xpack.core.ml.utils.ToXContentParams.EXCLUDE_GENERATED;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestGetJobsAction extends BaseRestHandler { public class RestGetJobsAction extends BaseRestHandler {
@ -52,16 +48,8 @@ public class RestGetJobsAction extends BaseRestHandler {
if (Strings.isNullOrEmpty(jobId)) { if (Strings.isNullOrEmpty(jobId)) {
jobId = Metadata.ALL; jobId = Metadata.ALL;
} }
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
Request request = new Request(jobId); Request request = new Request(jobId);
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH, request.allowNoMatch()));
DEPRECATED_ALLOW_NO_JOBS_PARAM,
Request.ALLOW_NO_MATCH,
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute( return channel -> new RestCancellableNodeClient(client, restRequest.getHttpChannel()).execute(
GetJobsAction.INSTANCE, GetJobsAction.INSTANCE,
request, request,

View file

@ -7,8 +7,6 @@
package org.elasticsearch.xpack.ml.rest.results; package org.elasticsearch.xpack.ml.rest.results;
import org.elasticsearch.client.internal.node.NodeClient; import org.elasticsearch.client.internal.node.NodeClient;
import org.elasticsearch.core.RestApiVersion;
import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.Scope; import org.elasticsearch.rest.Scope;
@ -24,10 +22,8 @@ import java.util.List;
import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.GET;
import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.POST;
import static org.elasticsearch.xpack.core.ml.MachineLearningField.DEPRECATED_ALLOW_NO_JOBS_PARAM;
import static org.elasticsearch.xpack.core.ml.job.config.Job.ID; import static org.elasticsearch.xpack.core.ml.job.config.Job.ID;
import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH;
import static org.elasticsearch.xpack.ml.rest.RestCompatibilityChecker.checkAndSetDeprecatedParam;
@ServerlessScope(Scope.PUBLIC) @ServerlessScope(Scope.PUBLIC)
public class RestGetOverallBucketsAction extends BaseRestHandler { public class RestGetOverallBucketsAction extends BaseRestHandler {
@ -48,7 +44,6 @@ public class RestGetOverallBucketsAction extends BaseRestHandler {
@Override @Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
String jobId = restRequest.param(Job.ID.getPreferredName()); String jobId = restRequest.param(Job.ID.getPreferredName());
@UpdateForV9(owner = UpdateForV9.Owner.MACHINE_LEARNING) // v7 REST API no longer exists: eliminate ref to RestApiVersion.V_7
final Request request; final Request request;
if (restRequest.hasContentOrSourceParam()) { if (restRequest.hasContentOrSourceParam()) {
XContentParser parser = restRequest.contentOrSourceParamParser(); XContentParser parser = restRequest.contentOrSourceParamParser();
@ -67,14 +62,7 @@ public class RestGetOverallBucketsAction extends BaseRestHandler {
if (restRequest.hasParam(Request.END.getPreferredName())) { if (restRequest.hasParam(Request.END.getPreferredName())) {
request.setEnd(restRequest.param(Request.END.getPreferredName())); request.setEnd(restRequest.param(Request.END.getPreferredName()));
} }
checkAndSetDeprecatedParam( request.setAllowNoMatch(restRequest.paramAsBoolean(Request.ALLOW_NO_MATCH.getPreferredName(), request.allowNoMatch()));
DEPRECATED_ALLOW_NO_JOBS_PARAM,
Request.ALLOW_NO_MATCH.getPreferredName(),
RestApiVersion.V_7,
restRequest,
(r, s) -> r.paramAsBoolean(s, request.allowNoMatch()),
request::setAllowNoMatch
);
} }
return channel -> client.execute(GetOverallBucketsAction.INSTANCE, request, new RestToXContentListener<>(channel)); return channel -> client.execute(GetOverallBucketsAction.INSTANCE, request, new RestToXContentListener<>(channel));