From 9d9d897b69d441238f23618c5f8cd661f9d05b49 Mon Sep 17 00:00:00 2001 From: David Roberts Date: Tue, 14 Sep 2021 15:45:45 +0100 Subject: [PATCH] [ML] Resurrect _xpack/ml routes (#77367) Related to #51816 / #68905. Adds back the _xpack/ml routes when using rest compatibility for a request. --- x-pack/plugin/build.gradle | 47 +++++++++ .../xpack/ml/MachineLearning.java | 2 + .../ml/rest/RestDeleteExpiredDataAction.java | 8 +- .../xpack/ml/rest/RestMlInfoAction.java | 5 +- .../ml/rest/RestSetUpgradeModeAction.java | 5 +- .../calendar/RestDeleteCalendarAction.java | 7 +- .../RestDeleteCalendarEventAction.java | 6 +- .../calendar/RestDeleteCalendarJobAction.java | 5 +- .../calendar/RestGetCalendarEventsAction.java | 5 +- .../rest/calendar/RestGetCalendarsAction.java | 14 ++- .../calendar/RestPostCalendarEventAction.java | 7 +- .../rest/calendar/RestPutCalendarAction.java | 7 +- .../calendar/RestPutCalendarJobAction.java | 5 +- .../datafeeds/RestDeleteDatafeedAction.java | 5 +- .../datafeeds/RestGetDatafeedStatsAction.java | 8 +- .../datafeeds/RestGetDatafeedsAction.java | 8 +- .../datafeeds/RestPreviewDatafeedAction.java | 14 ++- .../rest/datafeeds/RestPutDatafeedAction.java | 5 +- .../datafeeds/RestStartDatafeedAction.java | 5 +- .../datafeeds/RestStopDatafeedAction.java | 5 +- .../datafeeds/RestUpdateDatafeedAction.java | 5 +- .../rest/filter/RestDeleteFilterAction.java | 5 +- .../ml/rest/filter/RestGetFiltersAction.java | 8 +- .../ml/rest/filter/RestPutFilterAction.java | 5 +- .../rest/filter/RestUpdateFilterAction.java | 5 +- .../xpack/ml/rest/job/RestCloseJobAction.java | 5 +- .../ml/rest/job/RestDeleteForecastAction.java | 9 +- .../ml/rest/job/RestDeleteJobAction.java | 5 +- .../xpack/ml/rest/job/RestFlushJobAction.java | 5 +- .../ml/rest/job/RestForecastJobAction.java | 5 +- .../ml/rest/job/RestGetJobStatsAction.java | 8 +- .../xpack/ml/rest/job/RestGetJobsAction.java | 8 +- .../xpack/ml/rest/job/RestOpenJobAction.java | 5 +- .../xpack/ml/rest/job/RestPostDataAction.java | 9 +- .../ml/rest/job/RestPostJobUpdateAction.java | 5 +- .../xpack/ml/rest/job/RestPutJobAction.java | 5 +- .../RestDeleteModelSnapshotAction.java | 6 +- .../RestGetModelSnapshotsAction.java | 16 ++- .../RestRevertModelSnapshotAction.java | 6 +- .../RestUpdateModelSnapshotAction.java | 6 +- .../ml/rest/results/RestGetBucketsAction.java | 18 +++- .../rest/results/RestGetCategoriesAction.java | 18 +++- .../results/RestGetInfluencersAction.java | 8 +- .../results/RestGetOverallBucketsAction.java | 8 +- .../ml/rest/results/RestGetRecordsAction.java | 8 +- .../validate/RestValidateDetectorAction.java | 5 +- .../validate/RestValidateJobConfigAction.java | 5 +- .../rest-api-spec/api/xpack-ml.close_job.json | 60 ++++++++++++ .../api/xpack-ml.delete_calendar.json | 33 +++++++ .../api/xpack-ml.delete_calendar_event.json | 37 +++++++ .../api/xpack-ml.delete_calendar_job.json | 37 +++++++ .../api/xpack-ml.delete_datafeed.json | 40 ++++++++ .../api/xpack-ml.delete_expired_data.json | 58 +++++++++++ .../api/xpack-ml.delete_filter.json | 33 +++++++ .../api/xpack-ml.delete_forecast.json | 65 +++++++++++++ .../api/xpack-ml.delete_job.json | 45 +++++++++ .../api/xpack-ml.delete_model_snapshot.json | 37 +++++++ .../rest-api-spec/api/xpack-ml.flush_job.json | 59 +++++++++++ .../rest-api-spec/api/xpack-ml.forecast.json | 50 ++++++++++ .../api/xpack-ml.get_buckets.json | 97 +++++++++++++++++++ .../api/xpack-ml.get_calendar_events.json | 55 +++++++++++ .../api/xpack-ml.get_calendars.json | 55 +++++++++++ .../api/xpack-ml.get_categories.json | 73 ++++++++++++++ .../api/xpack-ml.get_datafeed_stats.json | 56 +++++++++++ .../api/xpack-ml.get_datafeeds.json | 62 ++++++++++++ .../api/xpack-ml.get_filters.json | 49 ++++++++++ .../api/xpack-ml.get_influencers.json | 72 ++++++++++++++ .../api/xpack-ml.get_job_stats.json | 52 ++++++++++ .../rest-api-spec/api/xpack-ml.get_jobs.json | 62 ++++++++++++ .../api/xpack-ml.get_model_snapshots.json | 85 ++++++++++++++++ .../api/xpack-ml.get_overall_buckets.json | 73 ++++++++++++++ .../api/xpack-ml.get_records.json | 72 ++++++++++++++ .../rest-api-spec/api/xpack-ml.info.json | 27 ++++++ .../rest-api-spec/api/xpack-ml.open_job.json | 33 +++++++ .../api/xpack-ml.post_calendar_events.json | 38 ++++++++ .../rest-api-spec/api/xpack-ml.post_data.json | 49 ++++++++++ .../api/xpack-ml.preview_datafeed.json | 49 ++++++++++ .../api/xpack-ml.put_calendar.json | 38 ++++++++ .../api/xpack-ml.put_calendar_job.json | 37 +++++++ .../api/xpack-ml.put_datafeed.json | 63 ++++++++++++ .../api/xpack-ml.put_filter.json | 38 ++++++++ .../rest-api-spec/api/xpack-ml.put_job.json | 63 ++++++++++++ .../api/xpack-ml.revert_model_snapshot.json | 47 +++++++++ .../api/xpack-ml.set_upgrade_mode.json | 37 +++++++ .../api/xpack-ml.start_datafeed.json | 54 +++++++++++ .../api/xpack-ml.stop_datafeed.json | 60 ++++++++++++ .../api/xpack-ml.update_datafeed.json | 63 ++++++++++++ .../api/xpack-ml.update_filter.json | 38 ++++++++ .../api/xpack-ml.update_job.json | 38 ++++++++ .../api/xpack-ml.update_model_snapshot.json | 43 ++++++++ .../rest-api-spec/api/xpack-ml.validate.json | 33 +++++++ .../api/xpack-ml.validate_detector.json | 33 +++++++ 92 files changed, 2599 insertions(+), 73 deletions(-) create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.close_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_event.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_expired_data.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_filter.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_forecast.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_model_snapshot.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.flush_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.forecast.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_buckets.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendar_events.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendars.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_categories.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeed_stats.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeeds.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_filters.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_influencers.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_job_stats.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_jobs.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_model_snapshots.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_overall_buckets.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_records.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.info.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.open_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_calendar_events.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_data.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.preview_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_filter.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.revert_model_snapshot.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.set_upgrade_mode.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.start_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.stop_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_datafeed.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_filter.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_job.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_model_snapshot.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate.json create mode 100644 x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate_detector.json diff --git a/x-pack/plugin/build.gradle b/x-pack/plugin/build.gradle index 9e7dbe30f7c2e..db9a9f1f6f223 100644 --- a/x-pack/plugin/build.gradle +++ b/x-pack/plugin/build.gradle @@ -111,6 +111,53 @@ tasks.named("yamlRestTestV7CompatTransform").configure({ task -> task.replaceKeyInDo("rollup.stop_job", "xpack-rollup.stop_job") task.addAllowedWarningRegex(".*_xpack/rollup.* is deprecated.*") + task.replaceKeyInDo("ml.close_job", "xpack-ml.close_job") + task.replaceKeyInDo("ml.delete_calendar", "xpack-ml.delete_calendar") + task.replaceKeyInDo("ml.delete_calendar_event", "xpack-ml.delete_calendar_event") + task.replaceKeyInDo("ml.delete_calendar_job", "xpack-ml.delete_calendar_job") + task.replaceKeyInDo("ml.delete_datafeed", "xpack-ml.delete_datafeed") + task.replaceKeyInDo("ml.delete_expired_data", "xpack-ml.delete_expired_data") + task.replaceKeyInDo("ml.delete_filter", "xpack-ml.delete_filter") + task.replaceKeyInDo("ml.delete_forecast", "xpack-ml.delete_forecast") + task.replaceKeyInDo("ml.delete_job", "xpack-ml.delete_job") + task.replaceKeyInDo("ml.delete_model_snapshot", "xpack-ml.delete_model_snapshot") + task.replaceKeyInDo("ml.flush_job", "xpack-ml.flush_job") + task.replaceKeyInDo("ml.forecast", "xpack-ml.forecast") + task.replaceKeyInDo("ml.get_buckets", "xpack-ml.get_buckets") + task.replaceKeyInDo("ml.get_calendar_events", "xpack-ml.get_calendar_events") + task.replaceKeyInDo("ml.get_calendars", "xpack-ml.get_calendars") + task.replaceKeyInDo("ml.get_categories", "xpack-ml.get_categories") + task.replaceKeyInDo("ml.get_datafeed_stats", "xpack-ml.get_datafeed_stats") + task.replaceKeyInDo("ml.get_datafeeds", "xpack-ml.get_datafeeds") + task.replaceKeyInDo("ml.get_filters", "xpack-ml.get_filters") + task.replaceKeyInDo("ml.get_influencers", "xpack-ml.get_influencers") + task.replaceKeyInDo("ml.get_job_stats", "xpack-ml.get_job_stats") + task.replaceKeyInDo("ml.get_jobs", "xpack-ml.get_jobs") + task.replaceKeyInDo("ml.get_model_snapshots", "xpack-ml.get_model_snapshots") + task.replaceKeyInDo("ml.get_overall_buckets", "xpack-ml.get_overall_buckets") + task.replaceKeyInDo("ml.get_records", "xpack-ml.get_records") + task.replaceKeyInDo("ml.info", "xpack-ml.info") + task.replaceKeyInDo("ml.open_job", "xpack-ml.open_job") + task.replaceKeyInDo("ml.post_calendar_events", "xpack-ml.post_calendar_events") + task.replaceKeyInDo("ml.post_data", "xpack-ml.post_data") + task.replaceKeyInDo("ml.preview_datafeed", "xpack-ml.preview_datafeed") + task.replaceKeyInDo("ml.put_calendar", "xpack-ml.put_calendar") + task.replaceKeyInDo("ml.put_calendar_job", "xpack-ml.put_calendar_job") + task.replaceKeyInDo("ml.put_datafeed", "xpack-ml.put_datafeed") + task.replaceKeyInDo("ml.put_filter", "xpack-ml.put_filter") + task.replaceKeyInDo("ml.put_job", "xpack-ml.put_job") + task.replaceKeyInDo("ml.revert_model_snapshot", "xpack-ml.revert_model_snapshot") + task.replaceKeyInDo("ml.set_upgrade_mode", "xpack-ml.set_upgrade_mode") + task.replaceKeyInDo("ml.start_datafeed", "xpack-ml.start_datafeed") + task.replaceKeyInDo("ml.stop_datafeed", "xpack-ml.stop_datafeed") + task.replaceKeyInDo("ml.update_datafeed", "xpack-ml.update_datafeed") + task.replaceKeyInDo("ml.update_filter", "xpack-ml.update_filter") + task.replaceKeyInDo("ml.update_job", "xpack-ml.update_job") + task.replaceKeyInDo("ml.update_model_snapshot", "xpack-ml.update_model_snapshot") + task.replaceKeyInDo("ml.validate", "xpack-ml.validate") + task.replaceKeyInDo("ml.validate_detector", "xpack-ml.validate_detector") + task.addAllowedWarningRegex(".*_xpack/ml.* is deprecated.*") + task.replaceKeyInDo("ssl.certificates", "xpack-ssl.certificates", "Test get SSL certificates") task.addAllowedWarningRegexForTest(".*_xpack/ssl.* is deprecated.*", "Test get SSL certificates") task.replaceValueInMatch("_type", "_doc") diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java index c1a25a6544bfa..65fb6c6d60041 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/MachineLearning.java @@ -443,6 +443,8 @@ public class MachineLearning extends Plugin implements SystemIndexPlugin, ShutdownAwarePlugin { public static final String NAME = "ml"; public static final String BASE_PATH = "/_ml/"; + // Endpoints that were deprecated in 7.x can still be called in 8.x using the REST compatibility layer + public static final String PRE_V7_BASE_PATH = "/_xpack/ml/"; public static final String DATAFEED_THREAD_POOL_NAME = NAME + "_datafeed"; public static final String JOB_COMMS_THREAD_POOL_NAME = NAME + "_job_comms"; public static final String UTILITY_THREAD_POOL_NAME = NAME + "_utility"; diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java index 1cba7b0e2a250..784ccd4d2ed85 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestDeleteExpiredDataAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -18,14 +19,17 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteExpiredDataAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "_delete_expired_data/{" + Job.ID + "}"), - new Route(DELETE, BASE_PATH + "_delete_expired_data") + Route.builder(DELETE, BASE_PATH + "_delete_expired_data/{" + Job.ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "_delete_expired_data/{" + Job.ID + "}", RestApiVersion.V_7).build(), + Route.builder(DELETE, BASE_PATH + "_delete_expired_data") + .replaces(DELETE, PRE_V7_BASE_PATH + "_delete_expired_data", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java index bfc3179f6361e..c144bbeab40b1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestMlInfoAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -17,13 +18,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestMlInfoAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "info") + Route.builder(GET, BASE_PATH + "info") + .replaces(GET, PRE_V7_BASE_PATH + "info", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java index 44d11d1784b84..d78dbfde26a80 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestSetUpgradeModeAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -17,13 +18,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestSetUpgradeModeAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "set_upgrade_mode") + Route.builder(POST, BASE_PATH + "set_upgrade_mode") + .replaces(POST, PRE_V7_BASE_PATH + "set_upgrade_mode", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java index 7304f4f12fc87..adc283f21a1d1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.calendar; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -18,12 +19,16 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteCalendarAction extends BaseRestHandler { @Override public List routes() { - return List.of(new Route(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}")); + return List.of( + Route.builder(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}", RestApiVersion.V_7).build() + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java index 8ff5f7fcbac27..e169f1d7c5804 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarEventAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.calendar; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,6 +20,7 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteCalendarEventAction extends BaseRestHandler { @@ -26,7 +28,9 @@ public class RestDeleteCalendarEventAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}/events/{" + ScheduledEvent.EVENT_ID + "}") + Route.builder(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}/events/{" + ScheduledEvent.EVENT_ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}/events/{" + ScheduledEvent.EVENT_ID + "}", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java index c6ebda0063bba..6f072a8939ffb 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestDeleteCalendarJobAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.calendar; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteCalendarJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}") + Route.builder(DELETE, BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java index 5fb8c8111a795..4f60b1d03fbd1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarEventsAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,13 +22,15 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetCalendarEventsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "calendars/{" + Calendar.ID + "}/events") + Route.builder(GET, BASE_PATH + "calendars/{" + Calendar.ID + "}/events") + .replaces(GET, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}/events", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java index 581ef9a4c392b..26d750a7daa32 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestGetCalendarsAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -22,16 +23,21 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetCalendarsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "calendars/{" + Calendar.ID + "}"), - new Route(GET, BASE_PATH + "calendars/"), - new Route(POST, BASE_PATH + "calendars/{" + Calendar.ID + "}"), - new Route(POST, BASE_PATH + "calendars/") + Route.builder(GET, BASE_PATH + "calendars/{" + Calendar.ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "calendars/") + .replaces(GET, PRE_V7_BASE_PATH + "calendars/", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "calendars/{" + Calendar.ID + "}") + .replaces(POST, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "calendars/") + .replaces(POST, PRE_V7_BASE_PATH + "calendars/", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java index 57f8f5588ac5a..29ace7f40c517 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPostCalendarEventAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,12 +20,16 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPostCalendarEventAction extends BaseRestHandler { @Override public List routes() { - return List.of(new Route(POST, BASE_PATH + "calendars/{" + Calendar.ID + "}/events")); + return List.of( + Route.builder(POST, BASE_PATH + "calendars/{" + Calendar.ID + "}/events") + .replaces(POST, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}/events", RestApiVersion.V_7).build() + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java index fda7ed33b14ee..3121566d3fcee 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -20,12 +21,16 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPutCalendarAction extends BaseRestHandler { @Override public List routes() { - return List.of(new Route(PUT, BASE_PATH + "calendars/{" + Calendar.ID + "}")); + return List.of( + Route.builder(PUT, BASE_PATH + "calendars/{" + Calendar.ID + "}") + .replaces(PUT, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}", RestApiVersion.V_7).build() + ); } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java index 7399c8aa30e98..3c19e451c0158 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/calendar/RestPutCalendarJobAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.calendar; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPutCalendarJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(PUT, BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}") + Route.builder(PUT, BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}") + .replaces(PUT, PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID + "}/jobs/{" + Job.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java index 4c59dc8021380..c719311b61d90 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestDeleteDatafeedAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.datafeeds; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}") + Route.builder(DELETE, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java index aac5b24153182..c0745c20e7a75 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedStatsAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,14 +22,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetDatafeedStatsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stats"), - new Route(GET, BASE_PATH + "datafeeds/_stats") + Route.builder(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stats") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stats", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "datafeeds/_stats") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds/_stats", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java index ce186ff425d93..fe0b0b8bbcfe2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestGetDatafeedsAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -23,14 +24,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; 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.PRE_V7_BASE_PATH; public class RestGetDatafeedsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}"), - new Route(GET, BASE_PATH + "datafeeds") + Route.builder(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "datafeeds") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java index 537775850e044..84aafe9cd3c75 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPreviewDatafeedAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.datafeeds; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,16 +20,21 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPreviewDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview"), - new Route(GET, BASE_PATH + "datafeeds/_preview"), - new Route(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview"), - new Route(POST, BASE_PATH + "datafeeds/_preview") + Route.builder(GET, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "datafeeds/_preview") + .replaces(GET, PRE_V7_BASE_PATH + "datafeeds/_preview", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview") + .replaces(POST, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_preview", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "datafeeds/_preview") + .replaces(POST, PRE_V7_BASE_PATH + "datafeeds/_preview", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java index 771b7ee7c9a2c..5596d8e832507 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestPutDatafeedAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,13 +22,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPutDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(PUT, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}") + Route.builder(PUT, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}") + .replaces(PUT, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java index 58281f35d7254..74aea26622e2a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStartDatafeedAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.datafeeds; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; @@ -25,6 +26,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestStartDatafeedAction extends BaseRestHandler { @@ -33,7 +35,8 @@ public class RestStartDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_start") + Route.builder(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_start") + .replaces(POST, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_start", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java index 2c90b147d5546..80c28656551c1 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestStopDatafeedAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.datafeeds; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -27,13 +28,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestStopDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stop") + Route.builder(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stop") + .replaces(POST, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_stop", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java index 2ca48b2d38c9a..84b1282b04281 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/datafeeds/RestUpdateDatafeedAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,13 +22,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestUpdateDatafeedAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_update") + Route.builder(POST, BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_update") + .replaces(POST, PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID + "}/_update", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java index 10baeb1c40dc0..5a6a2a9825261 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestDeleteFilterAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.filter; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -18,13 +19,15 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteFilterAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "filters/{" + Request.FILTER_ID + "}") + Route.builder(DELETE, BASE_PATH + "filters/{" + Request.FILTER_ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "filters/{" + Request.FILTER_ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java index 0316885322174..f762f86a5bc70 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestGetFiltersAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -20,14 +21,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetFiltersAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "filters/{" + MlFilter.ID + "}"), - new Route(GET, BASE_PATH + "filters/") + Route.builder(GET, BASE_PATH + "filters/{" + MlFilter.ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID + "}", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "filters/") + .replaces(GET, PRE_V7_BASE_PATH + "filters/", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java index 56d010114ed2d..d7ee5508f458a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestPutFilterAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPutFilterAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(PUT, BASE_PATH + "filters/{" + MlFilter.ID + "}") + Route.builder(PUT, BASE_PATH + "filters/{" + MlFilter.ID + "}") + .replaces(PUT, PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java index 3e1a2e9bb6460..de9a635e09231 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/filter/RestUpdateFilterAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestUpdateFilterAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "filters/{" + MlFilter.ID + "}/_update") + Route.builder(POST, BASE_PATH + "filters/{" + MlFilter.ID + "}/_update") + .replaces(POST, PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID + "}/_update", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java index c22669a5664bf..6af821f3cd82a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestCloseJobAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.job; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.rest.BaseRestHandler; @@ -21,13 +22,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestCloseJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_close") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_close") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_close", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java index 8cd0eee3e891d..752fd656e8abe 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteForecastAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.Metadata; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -20,14 +21,18 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteForecastAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/"), - new Route(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/{" + Forecast.FORECAST_ID + "}") + Route.builder(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/") + .replaces(DELETE, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/", RestApiVersion.V_7).build(), + Route.builder(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/{" + Forecast.FORECAST_ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast/{" + Forecast.FORECAST_ID + "}", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java index 16c0f5bbcb684..6fc36e3978747 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestDeleteJobAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentBuilder; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; @@ -24,13 +25,15 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}") + Route.builder(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java index aa3819cb2df9e..1793dedcb7658 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestFlushJobAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,6 +20,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestFlushJobAction extends BaseRestHandler { @@ -31,7 +33,8 @@ public class RestFlushJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_flush") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_flush") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_flush", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java index 4538735c80c66..6311e8ffd9b6d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestForecastJobAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -20,13 +21,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestForecastJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_forecast", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java index 903f8d6cdff89..282cfb6151880 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobStatsAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -22,14 +23,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetJobStatsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_stats"), - new Route(GET, BASE_PATH + "anomaly_detectors/_stats") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_stats") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_stats", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "anomaly_detectors/_stats") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/_stats", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java index ab8b6240abcc8..9cc0bde4ef2d2 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestGetJobsAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.cluster.metadata.Metadata; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -25,14 +26,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; 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.PRE_V7_BASE_PATH; public class RestGetJobsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}"), - new Route(GET, BASE_PATH + "anomaly_detectors") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}", RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "anomaly_detectors") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java index 22aa64447545f..e0f3391bd44fa 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestOpenJobAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.job; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.core.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; @@ -24,13 +25,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestOpenJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_open") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_open") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_open", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java index b2a7c2a5e5050..eda9032b548d5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostDataAction.java @@ -19,6 +19,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPostDataAction extends BaseRestHandler { @@ -27,11 +28,11 @@ public class RestPostDataAction extends BaseRestHandler { @Override public List routes() { + final String msg = "Posting data directly to anomaly detection jobs is deprecated, " + + "in a future major version it will be compulsory to use a datafeed"; return List.of( - Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_data") - .deprecated("Posting data directly to anomaly detection jobs is deprecated, " + - "in a future major version it will be compulsory to use a datafeed", RestApiVersion.V_8 - ).build() + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_data").deprecated(msg, RestApiVersion.V_8).build(), + Route.builder(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_data").deprecated(msg, RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java index 9dbe5c09c0b9a..063352d4fa2e8 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPostJobUpdateAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPostJobUpdateAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_update") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_update") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/_update", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java index 83a3c3048fc98..56196ee2c7c59 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/job/RestPutJobAction.java @@ -10,6 +10,7 @@ import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,13 +22,15 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestPutJobAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(PUT, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}") + Route.builder(PUT, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}") + .replaces(PUT, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java index 33b8b51c92e1f..960715ad8504a 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestDeleteModelSnapshotAction.java @@ -7,6 +7,7 @@ package org.elasticsearch.xpack.ml.rest.modelsnapshots; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -19,13 +20,16 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; import static org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotField.SNAPSHOT_ID; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestDeleteModelSnapshotAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}") + Route.builder(DELETE, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}") + .replaces(DELETE, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java index 699d219fe751f..30a7f3921a690 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestGetModelSnapshotsAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -23,6 +24,7 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetModelSnapshotsAction extends BaseRestHandler { @@ -38,10 +40,16 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}"), - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}", + RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + Request.SNAPSHOT_ID + "}", + RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java index 6f874814adf9d..45a885d719645 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestRevertModelSnapshotAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -20,6 +21,7 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ml.action.RevertModelSnapshotAction.Request.SNAPSHOT_ID; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestRevertModelSnapshotAction extends BaseRestHandler { @@ -28,7 +30,9 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}/_revert") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}/_revert") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID + "}/_revert", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java index 43f0233976d5e..0a75450ab081d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/modelsnapshots/RestUpdateModelSnapshotAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestStatusToXContentListener; @@ -20,13 +21,16 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ml.job.process.autodetect.state.ModelSnapshotField.SNAPSHOT_ID; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestUpdateModelSnapshotAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID +"}/_update") + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID +"}/_update") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/model_snapshots/{" + SNAPSHOT_ID +"}/_update", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java index ade0fbddead44..8498231c10783 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetBucketsAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -23,16 +24,25 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetBucketsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}"), - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}", + RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets/{" + Result.TIMESTAMP + "}", + RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets", + RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/buckets", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java index 63531bc48fd88..4585b12441034 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetCategoriesAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -23,16 +24,25 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.core.ml.action.GetCategoriesAction.Request.CATEGORY_ID; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetCategoriesAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}"), - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}", + RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories/{" + CATEGORY_ID + "}", + RestApiVersion.V_7).build(), + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories", + RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/categories", + RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java index b9b78b3c03d2a..55223dd5de265 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetInfluencersAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,14 +22,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetInfluencersAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/influencers", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java index fe2d1c5239097..3cf3e91c4943d 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetOverallBucketsAction.java @@ -9,6 +9,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -22,14 +23,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetOverallBucketsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/overall_buckets", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java index 1393b51f686f3..349e3f85f3c37 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/results/RestGetRecordsAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -21,14 +22,17 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestGetRecordsAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records"), - new Route(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records") + Route.builder(GET, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records") + .replaces(GET, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records", RestApiVersion.V_7).build(), + Route.builder(POST, BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID + "}/results/records", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java index 5e25d5e25c0d9..24f65e5b522c5 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateDetectorAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -18,13 +19,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestValidateDetectorAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/_validate/detector") + Route.builder(POST, BASE_PATH + "anomaly_detectors/_validate/detector") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/_validate/detector", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java index 775ce2bcaa33f..46b5fe2305227 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/validate/RestValidateJobConfigAction.java @@ -8,6 +8,7 @@ import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.xcontent.XContentParser; +import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.RestToXContentListener; @@ -18,13 +19,15 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.xpack.ml.MachineLearning.BASE_PATH; +import static org.elasticsearch.xpack.ml.MachineLearning.PRE_V7_BASE_PATH; public class RestValidateJobConfigAction extends BaseRestHandler { @Override public List routes() { return List.of( - new Route(POST, BASE_PATH + "anomaly_detectors/_validate") + Route.builder(POST, BASE_PATH + "anomaly_detectors/_validate") + .replaces(POST, PRE_V7_BASE_PATH + "anomaly_detectors/_validate", RestApiVersion.V_7).build() ); } diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.close_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.close_job.json new file mode 100644 index 0000000000000..afbf2591e10f9 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.close_job.json @@ -0,0 +1,60 @@ +{ + "xpack-ml.close_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html", + "description":"Closes one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_close", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The name of the job to close" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)" + }, + "allow_no_jobs":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)", + "deprecated":true + }, + "force":{ + "type":"boolean", + "required":false, + "description":"True if the job should be forcefully closed" + }, + "timeout":{ + "type":"time", + "description":"Controls the time to wait until a job has closed. Default to 30 minutes" + } + }, + "body":{ + "description":"The URL params optionally sent in the body", + "required":false + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar.json new file mode 100644 index 0000000000000..7965921a5ea21 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar.json @@ -0,0 +1,33 @@ +{ + "xpack-ml.delete_calendar":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar.html", + "description":"Deletes a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to delete" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_event.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_event.json new file mode 100644 index 0000000000000..7584b2512a8b3 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_event.json @@ -0,0 +1,37 @@ +{ + "xpack-ml.delete_calendar_event":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-event.html", + "description":"Deletes scheduled events from a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}/events/{event_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to modify" + }, + "event_id":{ + "type":"string", + "description":"The ID of the event to remove from the calendar" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_job.json new file mode 100644 index 0000000000000..bdada60699df0 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_calendar_job.json @@ -0,0 +1,37 @@ +{ + "xpack-ml.delete_calendar_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html", + "description":"Deletes anomaly detection jobs from a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to modify" + }, + "job_id":{ + "type":"string", + "description":"The ID of the job to remove from the calendar" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_datafeed.json new file mode 100644 index 0000000000000..6743b3eadff91 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_datafeed.json @@ -0,0 +1,40 @@ +{ + "xpack-ml.delete_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html", + "description":"Deletes an existing datafeed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to delete" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "force":{ + "type":"boolean", + "required":false, + "description":"True if the datafeed should be forcefully deleted" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_expired_data.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_expired_data.json new file mode 100644 index 0000000000000..0520055d968d1 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_expired_data.json @@ -0,0 +1,58 @@ +{ + "xpack-ml.delete_expired_data":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-expired-data.html", + "description":"Deletes expired and unused machine learning data." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/_delete_expired_data/{job_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job(s) to perform expired data hygiene for" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/_delete_expired_data", + "methods":[ + "DELETE" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "requests_per_second":{ + "type":"number", + "required":false, + "description":"The desired requests per second for the deletion processes." + }, + "timeout":{ + "type":"time", + "required":false, + "description":"How long can the underlying delete processes run until they are canceled" + } + }, + "body":{ + "description":"deleting expired data parameters" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_filter.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_filter.json new file mode 100644 index 0000000000000..c9c4f76e15f53 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_filter.json @@ -0,0 +1,33 @@ +{ + "xpack-ml.delete_filter":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html", + "description":"Deletes a filter." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/filters/{filter_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "filter_id":{ + "type":"string", + "description":"The ID of the filter to delete" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_forecast.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_forecast.json new file mode 100644 index 0000000000000..4c647046c3704 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_forecast.json @@ -0,0 +1,65 @@ +{ + "xpack-ml.delete_forecast":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html", + "description":"Deletes forecasts from a machine learning job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_forecast", + "methods":[ + "DELETE" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job from which to delete forecasts" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job from which to delete forecasts" + }, + "forecast_id":{ + "type":"string", + "description":"The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all`" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_forecasts":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if `_all` matches no forecasts" + }, + "timeout":{ + "type":"time", + "required":false, + "description":"Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_job.json new file mode 100644 index 0000000000000..9043baacb781e --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_job.json @@ -0,0 +1,45 @@ +{ + "xpack-ml.delete_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html", + "description":"Deletes an existing anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to delete" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "force":{ + "type":"boolean", + "description":"True if the job should be forcefully deleted", + "default":false + }, + "wait_for_completion":{ + "type":"boolean", + "description":"Should this request wait until the operation has completed before returning", + "default":true + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_model_snapshot.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_model_snapshot.json new file mode 100644 index 0000000000000..e3f1dd2036602 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.delete_model_snapshot.json @@ -0,0 +1,37 @@ +{ + "xpack-ml.delete_model_snapshot":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html", + "description":"Deletes an existing model snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", + "methods":[ + "DELETE" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to fetch" + }, + "snapshot_id":{ + "type":"string", + "description":"The ID of the snapshot to delete" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.flush_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.flush_job.json new file mode 100644 index 0000000000000..801258194d28b --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.flush_job.json @@ -0,0 +1,59 @@ +{ + "xpack-ml.flush_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html", + "description":"Forces any buffered data to be processed by the job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_flush", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The name of the job to flush" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "calc_interim":{ + "type":"boolean", + "description":"Calculates interim results for the most recent bucket or all buckets within the latency period" + }, + "start":{ + "type":"string", + "description":"When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results" + }, + "end":{ + "type":"string", + "description":"When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results" + }, + "advance_time":{ + "type":"string", + "description":"Advances time to the given value generating results and updating the model for the advanced interval" + }, + "skip_time":{ + "type":"string", + "description":"Skips time to the given value without generating results or updating the model for the skipped interval" + } + }, + "body":{ + "description":"Flush parameters" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.forecast.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.forecast.json new file mode 100644 index 0000000000000..f86d1d6f6d943 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.forecast.json @@ -0,0 +1,50 @@ +{ + "xpack-ml.forecast":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html", + "description":"Predicts the future behavior of a time series by using its historical behavior." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_forecast", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to forecast for" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "duration":{ + "type":"time", + "required":false, + "description":"The duration of the forecast" + }, + "expires_in":{ + "type":"time", + "required":false, + "description":"The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity." + }, + "max_model_memory":{ + "type":"string", + "required":false, + "description":"The max memory able to be used by the forecast. Default is 20mb." + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_buckets.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_buckets.json new file mode 100644 index 0000000000000..0ccc693b5b682 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_buckets.json @@ -0,0 +1,97 @@ +{ + "xpack-ml.get_buckets":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html", + "description":"Retrieves anomaly detection job results for one or more buckets." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/buckets/{timestamp}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"ID of the job to get bucket results from" + }, + "timestamp":{ + "type":"string", + "description":"The timestamp of the desired single bucket result" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/buckets", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"ID of the job to get bucket results from" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "expand":{ + "type":"boolean", + "description":"Include anomaly records" + }, + "exclude_interim":{ + "type":"boolean", + "description":"Exclude interim results" + }, + "from":{ + "type":"int", + "description":"skips a number of buckets" + }, + "size":{ + "type":"int", + "description":"specifies a max number of buckets to get" + }, + "start":{ + "type":"string", + "description":"Start time filter for buckets" + }, + "end":{ + "type":"string", + "description":"End time filter for buckets" + }, + "anomaly_score":{ + "type":"double", + "description":"Filter for the most anomalous buckets" + }, + "sort":{ + "type":"string", + "description":"Sort buckets by a particular field" + }, + "desc":{ + "type":"boolean", + "description":"Set the sort direction" + } + }, + "body":{ + "description":"Bucket selection details if not provided in URI" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendar_events.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendar_events.json new file mode 100644 index 0000000000000..731c510767488 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendar_events.json @@ -0,0 +1,55 @@ +{ + "xpack-ml.get_calendar_events":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar-event.html", + "description":"Retrieves information about the scheduled events in calendars." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}/events", + "methods":[ + "GET" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar containing the events" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "job_id":{ + "type":"string", + "description":"Get events for the job. When this option is used calendar_id must be '_all'" + }, + "start":{ + "type":"string", + "description":"Get events after this time" + }, + "end":{ + "type":"date", + "description":"Get events before this time" + }, + "from":{ + "type":"int", + "description":"Skips a number of events" + }, + "size":{ + "type":"int", + "description":"Specifies a max number of events to get" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendars.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendars.json new file mode 100644 index 0000000000000..c80005451ff0b --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_calendars.json @@ -0,0 +1,55 @@ +{ + "xpack-ml.get_calendars":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar.html", + "description":"Retrieves configuration information for calendars." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/_xpack/ml/calendars/{calendar_id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "from":{ + "type":"int", + "description":"skips a number of calendars" + }, + "size":{ + "type":"int", + "description":"specifies a max number of calendars to get" + } + }, + "body":{ + "description":"The from and size parameters optionally sent in the body" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_categories.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_categories.json new file mode 100644 index 0000000000000..daf4d9bfc7889 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_categories.json @@ -0,0 +1,73 @@ +{ + "xpack-ml.get_categories":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html", + "description":"Retrieves anomaly detection job results for one or more categories." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The name of the job" + }, + "category_id":{ + "type":"long", + "description":"The identifier of the category definition of interest" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/categories/", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The name of the job" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "from":{ + "type":"int", + "description":"skips a number of categories" + }, + "size":{ + "type":"int", + "description":"specifies a max number of categories to get" + }, + "partition_field_value":{ + "type":"string", + "description":"Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled." + } + }, + "body":{ + "description":"Category selection details if not provided in URI" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeed_stats.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeed_stats.json new file mode 100644 index 0000000000000..1c63df2a33fef --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeed_stats.json @@ -0,0 +1,56 @@ +{ + "xpack-ml.get_datafeed_stats":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html", + "description":"Retrieves usage information for datafeeds." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}/_stats", + "methods":[ + "GET" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeeds stats to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/datafeeds/_stats", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)" + }, + "allow_no_datafeeds":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)", + "deprecated":true + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeeds.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeeds.json new file mode 100644 index 0000000000000..14f8a3f65397d --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_datafeeds.json @@ -0,0 +1,62 @@ +{ + "xpack-ml.get_datafeeds":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html", + "description":"Retrieves configuration information for datafeeds." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}", + "methods":[ + "GET" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeeds to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/datafeeds", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)" + }, + "allow_no_datafeeds":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)", + "deprecated":true + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on datafeed PUT" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_filters.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_filters.json new file mode 100644 index 0000000000000..886f289a75096 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_filters.json @@ -0,0 +1,49 @@ +{ + "xpack-ml.get_filters":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-filter.html", + "description":"Retrieves filters." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/filters", + "methods":[ + "GET" + ] + }, + { + "path":"/_xpack/ml/filters/{filter_id}", + "methods":[ + "GET" + ], + "parts":{ + "filter_id":{ + "type":"string", + "description":"The ID of the filter to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "from":{ + "type":"int", + "description":"skips a number of filters" + }, + "size":{ + "type":"int", + "description":"specifies a max number of filters to get" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_influencers.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_influencers.json new file mode 100644 index 0000000000000..d039f14175f09 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_influencers.json @@ -0,0 +1,72 @@ +{ + "xpack-ml.get_influencers":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html", + "description":"Retrieves anomaly detection job results for one or more influencers." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/influencers", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"Identifier for the anomaly detection job" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "exclude_interim":{ + "type":"boolean", + "description":"Exclude interim results" + }, + "from":{ + "type":"int", + "description":"skips a number of influencers" + }, + "size":{ + "type":"int", + "description":"specifies a max number of influencers to get" + }, + "start":{ + "type":"string", + "description":"start timestamp for the requested influencers" + }, + "end":{ + "type":"string", + "description":"end timestamp for the requested influencers" + }, + "influencer_score":{ + "type":"double", + "description":"influencer score threshold for the requested influencers" + }, + "sort":{ + "type":"string", + "description":"sort field for the requested influencers" + }, + "desc":{ + "type":"boolean", + "description":"whether the results should be sorted in decending order" + } + }, + "body":{ + "description":"Influencer selection criteria" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_job_stats.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_job_stats.json new file mode 100644 index 0000000000000..ea6154916c155 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_job_stats.json @@ -0,0 +1,52 @@ +{ + "xpack-ml.get_job_stats":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html", + "description":"Retrieves usage information for anomaly detection jobs." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/_stats", + "methods":[ + "GET" + ] + }, + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_stats", + "methods":[ + "GET" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the jobs stats to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)" + }, + "allow_no_jobs":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)", + "deprecated":true + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_jobs.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_jobs.json new file mode 100644 index 0000000000000..70fb374b846fe --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_jobs.json @@ -0,0 +1,62 @@ +{ + "xpack-ml.get_jobs":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html", + "description":"Retrieves configuration information for anomaly detection jobs." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}", + "methods":[ + "GET" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the jobs to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/anomaly_detectors", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)" + }, + "allow_no_jobs":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)", + "deprecated":true + }, + "exclude_generated": { + "required": false, + "type": "boolean", + "default": false, + "description": "Omits fields that are illegal to set on job PUT" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_model_snapshots.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_model_snapshots.json new file mode 100644 index 0000000000000..44120f655960e --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_model_snapshots.json @@ -0,0 +1,85 @@ +{ + "xpack-ml.get_model_snapshots":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html", + "description":"Retrieves information about model snapshots." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to fetch" + }, + "snapshot_id":{ + "type":"string", + "description":"The ID of the snapshot to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to fetch" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "from":{ + "type":"int", + "description":"Skips a number of documents" + }, + "size":{ + "type":"int", + "description":"The default number of documents returned in queries as a string." + }, + "start":{ + "type":"date", + "description":"The filter 'start' query parameter" + }, + "end":{ + "type":"date", + "description":"The filter 'end' query parameter" + }, + "sort":{ + "type":"string", + "description":"Name of the field to sort on" + }, + "desc":{ + "type":"boolean", + "description":"True if the results should be sorted in descending order" + } + }, + "body":{ + "description":"Model snapshot selection criteria" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_overall_buckets.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_overall_buckets.json new file mode 100644 index 0000000000000..d18e0c1be3dfa --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_overall_buckets.json @@ -0,0 +1,73 @@ +{ + "xpack-ml.get_overall_buckets":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html", + "description":"Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/overall_buckets", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The job IDs for which to calculate overall bucket results" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "top_n":{ + "type":"int", + "description":"The number of top job bucket scores to be used in the overall_score calculation" + }, + "bucket_span":{ + "type":"string", + "description":"The span of the overall buckets. Defaults to the longest job bucket_span" + }, + "overall_score":{ + "type":"double", + "description":"Returns overall buckets with overall scores higher than this value" + }, + "exclude_interim":{ + "type":"boolean", + "description":"If true overall buckets that include interim buckets will be excluded" + }, + "start":{ + "type":"string", + "description":"Returns overall buckets with timestamps after this time" + }, + "end":{ + "type":"string", + "description":"Returns overall buckets with timestamps earlier than this time" + }, + "allow_no_match":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)" + }, + "allow_no_jobs":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)", + "deprecated":true + } + }, + "body":{ + "description":"Overall bucket selection details if not provided in URI" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_records.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_records.json new file mode 100644 index 0000000000000..a930001a0e319 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.get_records.json @@ -0,0 +1,72 @@ +{ + "xpack-ml.get_records":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html", + "description":"Retrieves anomaly records for an anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/results/records", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "exclude_interim":{ + "type":"boolean", + "description":"Exclude interim results" + }, + "from":{ + "type":"int", + "description":"skips a number of records" + }, + "size":{ + "type":"int", + "description":"specifies a max number of records to get" + }, + "start":{ + "type":"string", + "description":"Start time filter for records" + }, + "end":{ + "type":"string", + "description":"End time filter for records" + }, + "record_score":{ + "type":"double", + "description":"Returns records with anomaly scores greater or equal than this value" + }, + "sort":{ + "type":"string", + "description":"Sort records by a particular field" + }, + "desc":{ + "type":"boolean", + "description":"Set the sort direction" + } + }, + "body":{ + "description":"Record selection criteria" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.info.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.info.json new file mode 100644 index 0000000000000..a21bf7986ac20 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.info.json @@ -0,0 +1,27 @@ +{ + "xpack-ml.info":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-info.html", + "description":"Returns defaults and limits used by machine learning." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/info", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.open_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.open_job.json new file mode 100644 index 0000000000000..e464c3743695e --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.open_job.json @@ -0,0 +1,33 @@ +{ + "xpack-ml.open_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html", + "description":"Opens one or more anomaly detection jobs." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_open", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to open" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_calendar_events.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_calendar_events.json new file mode 100644 index 0000000000000..ca754b25a0d06 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_calendar_events.json @@ -0,0 +1,38 @@ +{ + "xpack-ml.post_calendar_events":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html", + "description":"Posts scheduled events in a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}/events", + "methods":[ + "POST" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to modify" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"A list of events", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_data.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_data.json new file mode 100644 index 0000000000000..21d4687e54119 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.post_data.json @@ -0,0 +1,49 @@ +{ + "xpack-ml.post_data":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html", + "description":"Sends data to an anomaly detection job for analysis." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/x-ndjson", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_data", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The name of the job receiving the data" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "reset_start":{ + "type":"string", + "description":"Optional parameter to specify the start of the bucket resetting range" + }, + "reset_end":{ + "type":"string", + "description":"Optional parameter to specify the end of the bucket resetting range" + } + }, + "body":{ + "description":"The data to process", + "required":true, + "serialize":"bulk" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.preview_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.preview_datafeed.json new file mode 100644 index 0000000000000..c14869ff12426 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.preview_datafeed.json @@ -0,0 +1,49 @@ +{ + "xpack-ml.preview_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html", + "description":"Previews a datafeed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}/_preview", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to preview" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + }, + { + "path":"/_xpack/ml/datafeeds/_preview", + "methods":[ + "GET", + "POST" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The datafeed config and job config with which to execute the preview", + "required":false + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar.json new file mode 100644 index 0000000000000..d44674646e71d --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar.json @@ -0,0 +1,38 @@ +{ + "xpack-ml.put_calendar":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html", + "description":"Instantiates a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}", + "methods":[ + "PUT" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to create" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The calendar details", + "required":false + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar_job.json new file mode 100644 index 0000000000000..3351ba74cf961 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_calendar_job.json @@ -0,0 +1,37 @@ +{ + "xpack-ml.put_calendar_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar-job.html", + "description":"Adds an anomaly detection job to a calendar." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}", + "methods":[ + "PUT" + ], + "parts":{ + "calendar_id":{ + "type":"string", + "description":"The ID of the calendar to modify" + }, + "job_id":{ + "type":"string", + "description":"The ID of the job to add to the calendar" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_datafeed.json new file mode 100644 index 0000000000000..3e2700899214b --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_datafeed.json @@ -0,0 +1,63 @@ +{ + "xpack-ml.put_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html", + "description":"Instantiates a datafeed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}", + "methods":[ + "PUT" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to create" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The datafeed config", + "required":true + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if the source indices expressions resolves to no concrete indices (default: true)" + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Ignore indices that are marked as throttled (default: true)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "description":"Whether source index expressions should get expanded to open or closed indices (default: open)" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_filter.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_filter.json new file mode 100644 index 0000000000000..a36f748bb6bb5 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_filter.json @@ -0,0 +1,38 @@ +{ + "xpack-ml.put_filter":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-filter.html", + "description":"Instantiates a filter." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/filters/{filter_id}", + "methods":[ + "PUT" + ], + "parts":{ + "filter_id":{ + "type":"string", + "description":"The ID of the filter to create" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The filter details", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_job.json new file mode 100644 index 0000000000000..3c1798170969c --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.put_job.json @@ -0,0 +1,63 @@ +{ + "xpack-ml.put_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html", + "description":"Instantiates an anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}", + "methods":[ + "PUT" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to create" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false). Only set if datafeed_config is provided." + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if the source indices expressions resolves to no concrete indices (default: true). Only set if datafeed_config is provided." + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Ignore indices that are marked as throttled (default: true). Only set if datafeed_config is provided." + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "description":"Whether source index expressions should get expanded to open or closed indices (default: open). Only set if datafeed_config is provided." + } + }, + "body":{ + "description":"The job", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.revert_model_snapshot.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.revert_model_snapshot.json new file mode 100644 index 0000000000000..803595f9ec0b2 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.revert_model_snapshot.json @@ -0,0 +1,47 @@ +{ + "xpack-ml.revert_model_snapshot":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html", + "description":"Reverts to a specific snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to fetch" + }, + "snapshot_id":{ + "type":"string", + "description":"The ID of the snapshot to revert to" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "delete_intervening_results":{ + "type":"boolean", + "description":"Should we reset the results back to the time of the snapshot?" + } + }, + "body":{ + "description":"Reversion options" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.set_upgrade_mode.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.set_upgrade_mode.json new file mode 100644 index 0000000000000..1967d8a6262fd --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.set_upgrade_mode.json @@ -0,0 +1,37 @@ +{ + "xpack-ml.set_upgrade_mode":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html", + "description":"Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/set_upgrade_mode", + "methods":[ + "POST" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "enabled":{ + "type":"boolean", + "description":"Whether to enable upgrade_mode ML setting or not. Defaults to false." + }, + "timeout":{ + "type":"time", + "description":"Controls the time to wait before action times out. Defaults to 30 seconds" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.start_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.start_datafeed.json new file mode 100644 index 0000000000000..cef069eaa153d --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.start_datafeed.json @@ -0,0 +1,54 @@ +{ + "xpack-ml.start_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html", + "description":"Starts one or more datafeeds." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}/_start", + "methods":[ + "POST" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to start" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "start":{ + "type":"string", + "required":false, + "description":"The start time from where the datafeed should begin" + }, + "end":{ + "type":"string", + "required":false, + "description":"The end time when the datafeed should stop. When not set, the datafeed continues in real time" + }, + "timeout":{ + "type":"time", + "required":false, + "description":"Controls the time to wait until a datafeed has started. Default to 20 seconds" + } + }, + "body":{ + "description":"The start datafeed parameters" + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.stop_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.stop_datafeed.json new file mode 100644 index 0000000000000..b09d536f05b36 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.stop_datafeed.json @@ -0,0 +1,60 @@ +{ + "xpack-ml.stop_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html", + "description":"Stops one or more datafeeds." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}/_stop", + "methods":[ + "POST" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to stop" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{ + "allow_no_match":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)" + }, + "allow_no_datafeeds":{ + "type":"boolean", + "required":false, + "description":"Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)", + "deprecated":true + }, + "force":{ + "type":"boolean", + "required":false, + "description":"True if the datafeed should be forcefully stopped." + }, + "timeout":{ + "type":"time", + "required":false, + "description":"Controls the time to wait until a datafeed has stopped. Default to 20 seconds" + } + }, + "body":{ + "description":"The URL params optionally sent in the body", + "required":false + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_datafeed.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_datafeed.json new file mode 100644 index 0000000000000..ccddff3dd011b --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_datafeed.json @@ -0,0 +1,63 @@ +{ + "xpack-ml.update_datafeed":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html", + "description":"Updates certain properties of a datafeed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/datafeeds/{datafeed_id}/_update", + "methods":[ + "POST" + ], + "parts":{ + "datafeed_id":{ + "type":"string", + "description":"The ID of the datafeed to update" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The datafeed update settings", + "required":true + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if the source indices expressions resolves to no concrete indices (default: true)" + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Ignore indices that are marked as throttled (default: true)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "description":"Whether source index expressions should get expanded to open or closed indices (default: open)" + } + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_filter.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_filter.json new file mode 100644 index 0000000000000..00e58675e0dbe --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_filter.json @@ -0,0 +1,38 @@ +{ + "xpack-ml.update_filter":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-filter.html", + "description":"Updates the description of a filter, adds items, or removes items." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/filters/{filter_id}/_update", + "methods":[ + "POST" + ], + "parts":{ + "filter_id":{ + "type":"string", + "description":"The ID of the filter to update" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The filter update", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_job.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_job.json new file mode 100644 index 0000000000000..62e79020ac764 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_job.json @@ -0,0 +1,38 @@ +{ + "xpack-ml.update_job":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html", + "description":"Updates certain properties of an anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/_update", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to create" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "body":{ + "description":"The job update settings", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_model_snapshot.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_model_snapshot.json new file mode 100644 index 0000000000000..cd72375d6ae4a --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.update_model_snapshot.json @@ -0,0 +1,43 @@ +{ + "xpack-ml.update_model_snapshot":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html", + "description":"Updates certain properties of a snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update", + "methods":[ + "POST" + ], + "parts":{ + "job_id":{ + "type":"string", + "description":"The ID of the job to fetch" + }, + "snapshot_id":{ + "type":"string", + "description":"The ID of the snapshot to update" + } + }, + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{}, + "body":{ + "description":"The model snapshot properties to update", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate.json new file mode 100644 index 0000000000000..7c9bbf70f4469 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate.json @@ -0,0 +1,33 @@ +{ + "xpack-ml.validate":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", + "description":"Validates an anomaly detection job." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/_validate", + "methods":[ + "POST" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{}, + "body":{ + "description":"The job config", + "required":true + } + } +} diff --git a/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate_detector.json b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate_detector.json new file mode 100644 index 0000000000000..fe5fdd7a7b7a1 --- /dev/null +++ b/x-pack/plugin/src/yamlRestCompatTest/resources/rest-api-spec/api/xpack-ml.validate_detector.json @@ -0,0 +1,33 @@ +{ + "xpack-ml.validate_detector":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html", + "description":"Validates an anomaly detection detector." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/vnd.elasticsearch+json;compatible-with=7"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_xpack/ml/anomaly_detectors/_validate/detector", + "methods":[ + "POST" + ], + "deprecated":{ + "version":"7.0.0", + "description":"all _xpack prefix have been deprecated" + } + } + ] + }, + "params":{}, + "body":{ + "description":"The detector", + "required":true + } + } +}