diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy index e0a512e1becef..d56cb1926f3e2 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/RestTestsFromSnippetsTask.groovy @@ -104,7 +104,7 @@ public class RestTestsFromSnippetsTask extends SnippetsTask { * format of the response is incompatible i.e. it is not a JSON object. */ static shouldAddShardFailureCheck(String path) { - return path.startsWith('_cat') == false && path.startsWith('_xpack/ml/datafeeds/') == false + return path.startsWith('_cat') == false && path.startsWith('_ml/datafeeds/') == false } /** diff --git a/buildSrc/src/test/groovy/org/elasticsearch/gradle/doc/RestTestFromSnippetsTaskTests.groovy b/buildSrc/src/test/groovy/org/elasticsearch/gradle/doc/RestTestFromSnippetsTaskTests.groovy index df20f542f9c39..c2df771a3e807 100644 --- a/buildSrc/src/test/groovy/org/elasticsearch/gradle/doc/RestTestFromSnippetsTaskTests.groovy +++ b/buildSrc/src/test/groovy/org/elasticsearch/gradle/doc/RestTestFromSnippetsTaskTests.groovy @@ -59,6 +59,6 @@ class RestTestFromSnippetsTaskTests extends GradleUnitTestCase { void testIsDocWriteRequest() { assertTrue(shouldAddShardFailureCheck("doc-index/_search")); assertFalse(shouldAddShardFailureCheck("_cat")) - assertFalse(shouldAddShardFailureCheck("_xpack/ml/datafeeds/datafeed-id/_preview")); + assertFalse(shouldAddShardFailureCheck("_ml/datafeeds/datafeed-id/_preview")); } } diff --git a/client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java b/client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java index 8e11151667bc5..f24f12dd6b7a0 100644 --- a/client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java +++ b/client/rest-high-level/src/main/java/org/elasticsearch/client/MLRequestConverters.java @@ -87,8 +87,7 @@ private MLRequestConverters() {} static Request putJob(PutJobRequest putJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(putJobRequest.getJob().getId()) .build(); @@ -99,8 +98,7 @@ static Request putJob(PutJobRequest putJobRequest) throws IOException { static Request getJob(GetJobRequest getJobRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(getJobRequest.getJobIds())) .build(); @@ -116,8 +114,7 @@ static Request getJob(GetJobRequest getJobRequest) { static Request getJobStats(GetJobStatsRequest getJobStatsRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(getJobStatsRequest.getJobIds())) .addPathPartAsIs("_stats") @@ -133,8 +130,7 @@ static Request getJobStats(GetJobStatsRequest getJobStatsRequest) { static Request openJob(OpenJobRequest openJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(openJobRequest.getJobId()) .addPathPartAsIs("_open") @@ -146,8 +142,7 @@ static Request openJob(OpenJobRequest openJobRequest) throws IOException { static Request closeJob(CloseJobRequest closeJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(closeJobRequest.getJobIds())) .addPathPartAsIs("_close") @@ -159,8 +154,7 @@ static Request closeJob(CloseJobRequest closeJobRequest) throws IOException { static Request deleteExpiredData(DeleteExpiredDataRequest deleteExpiredDataRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("_delete_expired_data") .build(); Request request = new Request(HttpDelete.METHOD_NAME, endpoint); @@ -170,8 +164,7 @@ static Request deleteExpiredData(DeleteExpiredDataRequest deleteExpiredDataReque static Request deleteJob(DeleteJobRequest deleteJobRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(deleteJobRequest.getJobId()) .build(); @@ -190,8 +183,7 @@ static Request deleteJob(DeleteJobRequest deleteJobRequest) { static Request flushJob(FlushJobRequest flushJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(flushJobRequest.getJobId()) .addPathPartAsIs("_flush") @@ -203,8 +195,7 @@ static Request flushJob(FlushJobRequest flushJobRequest) throws IOException { static Request forecastJob(ForecastJobRequest forecastJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(forecastJobRequest.getJobId()) .addPathPartAsIs("_forecast") @@ -216,8 +207,7 @@ static Request forecastJob(ForecastJobRequest forecastJobRequest) throws IOExcep static Request updateJob(UpdateJobRequest updateJobRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(updateJobRequest.getJobUpdate().getJobId()) .addPathPartAsIs("_update") @@ -229,8 +219,7 @@ static Request updateJob(UpdateJobRequest updateJobRequest) throws IOException { static Request putDatafeed(PutDatafeedRequest putDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(putDatafeedRequest.getDatafeed().getId()) .build(); @@ -241,8 +230,7 @@ static Request putDatafeed(PutDatafeedRequest putDatafeedRequest) throws IOExcep static Request updateDatafeed(UpdateDatafeedRequest updateDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(updateDatafeedRequest.getDatafeedUpdate().getId()) .addPathPartAsIs("_update") @@ -254,8 +242,7 @@ static Request updateDatafeed(UpdateDatafeedRequest updateDatafeedRequest) throw static Request getDatafeed(GetDatafeedRequest getDatafeedRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(Strings.collectionToCommaDelimitedString(getDatafeedRequest.getDatafeedIds())) .build(); @@ -272,8 +259,7 @@ static Request getDatafeed(GetDatafeedRequest getDatafeedRequest) { static Request deleteDatafeed(DeleteDatafeedRequest deleteDatafeedRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(deleteDatafeedRequest.getDatafeedId()) .build(); @@ -287,8 +273,7 @@ static Request deleteDatafeed(DeleteDatafeedRequest deleteDatafeedRequest) { static Request startDatafeed(StartDatafeedRequest startDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(startDatafeedRequest.getDatafeedId()) .addPathPartAsIs("_start") @@ -300,8 +285,7 @@ static Request startDatafeed(StartDatafeedRequest startDatafeedRequest) throws I static Request stopDatafeed(StopDatafeedRequest stopDatafeedRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(Strings.collectionToCommaDelimitedString(stopDatafeedRequest.getDatafeedIds())) .addPathPartAsIs("_stop") @@ -313,8 +297,7 @@ static Request stopDatafeed(StopDatafeedRequest stopDatafeedRequest) throws IOEx static Request getDatafeedStats(GetDatafeedStatsRequest getDatafeedStatsRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(Strings.collectionToCommaDelimitedString(getDatafeedStatsRequest.getDatafeedIds())) .addPathPartAsIs("_stats") @@ -330,8 +313,7 @@ static Request getDatafeedStats(GetDatafeedStatsRequest getDatafeedStatsRequest) static Request previewDatafeed(PreviewDatafeedRequest previewDatafeedRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("datafeeds") .addPathPart(previewDatafeedRequest.getDatafeedId()) .addPathPartAsIs("_preview") @@ -341,8 +323,7 @@ static Request previewDatafeed(PreviewDatafeedRequest previewDatafeedRequest) { static Request deleteForecast(DeleteForecastRequest deleteForecastRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(deleteForecastRequest.getJobId()) .addPathPartAsIs("_forecast") @@ -361,8 +342,7 @@ static Request deleteForecast(DeleteForecastRequest deleteForecastRequest) { static Request deleteModelSnapshot(DeleteModelSnapshotRequest deleteModelSnapshotRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(deleteModelSnapshotRequest.getJobId()) .addPathPartAsIs("model_snapshots") @@ -373,8 +353,7 @@ static Request deleteModelSnapshot(DeleteModelSnapshotRequest deleteModelSnapsho static Request getBuckets(GetBucketsRequest getBucketsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(getBucketsRequest.getJobId()) .addPathPartAsIs("results") @@ -387,8 +366,7 @@ static Request getBuckets(GetBucketsRequest getBucketsRequest) throws IOExceptio static Request getCategories(GetCategoriesRequest getCategoriesRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(getCategoriesRequest.getJobId()) .addPathPartAsIs("results") @@ -401,8 +379,7 @@ static Request getCategories(GetCategoriesRequest getCategoriesRequest) throws I static Request getModelSnapshots(GetModelSnapshotsRequest getModelSnapshotsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(getModelSnapshotsRequest.getJobId()) .addPathPartAsIs("model_snapshots") @@ -414,8 +391,7 @@ static Request getModelSnapshots(GetModelSnapshotsRequest getModelSnapshotsReque static Request updateModelSnapshot(UpdateModelSnapshotRequest updateModelSnapshotRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(updateModelSnapshotRequest.getJobId()) .addPathPartAsIs("model_snapshots") @@ -429,8 +405,7 @@ static Request updateModelSnapshot(UpdateModelSnapshotRequest updateModelSnapsho static Request revertModelSnapshot(RevertModelSnapshotRequest revertModelSnapshotsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(revertModelSnapshotsRequest.getJobId()) .addPathPartAsIs("model_snapshots") @@ -444,8 +419,7 @@ static Request revertModelSnapshot(RevertModelSnapshotRequest revertModelSnapsho static Request getOverallBuckets(GetOverallBucketsRequest getOverallBucketsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(Strings.collectionToCommaDelimitedString(getOverallBucketsRequest.getJobIds())) .addPathPartAsIs("results") @@ -458,8 +432,7 @@ static Request getOverallBuckets(GetOverallBucketsRequest getOverallBucketsReque static Request getRecords(GetRecordsRequest getRecordsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(getRecordsRequest.getJobId()) .addPathPartAsIs("results") @@ -472,8 +445,7 @@ static Request getRecords(GetRecordsRequest getRecordsRequest) throws IOExceptio static Request postData(PostDataRequest postDataRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(postDataRequest.getJobId()) .addPathPartAsIs("_data") @@ -501,8 +473,7 @@ static Request postData(PostDataRequest postDataRequest) { static Request getInfluencers(GetInfluencersRequest getInfluencersRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("anomaly_detectors") .addPathPart(getInfluencersRequest.getJobId()) .addPathPartAsIs("results") @@ -515,8 +486,7 @@ static Request getInfluencers(GetInfluencersRequest getInfluencersRequest) throw static Request putCalendar(PutCalendarRequest putCalendarRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(putCalendarRequest.getCalendar().getId()) .build(); @@ -527,8 +497,7 @@ static Request putCalendar(PutCalendarRequest putCalendarRequest) throws IOExcep static Request getCalendars(GetCalendarsRequest getCalendarsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(getCalendarsRequest.getCalendarId()) .build(); @@ -539,8 +508,7 @@ static Request getCalendars(GetCalendarsRequest getCalendarsRequest) throws IOEx static Request putCalendarJob(PutCalendarJobRequest putCalendarJobRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(putCalendarJobRequest.getCalendarId()) .addPathPartAsIs("jobs") @@ -551,8 +519,7 @@ static Request putCalendarJob(PutCalendarJobRequest putCalendarJobRequest) { static Request deleteCalendarJob(DeleteCalendarJobRequest deleteCalendarJobRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(deleteCalendarJobRequest.getCalendarId()) .addPathPartAsIs("jobs") @@ -563,8 +530,7 @@ static Request deleteCalendarJob(DeleteCalendarJobRequest deleteCalendarJobReque static Request deleteCalendar(DeleteCalendarRequest deleteCalendarRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(deleteCalendarRequest.getCalendarId()) .build(); @@ -574,8 +540,7 @@ static Request deleteCalendar(DeleteCalendarRequest deleteCalendarRequest) { static Request getCalendarEvents(GetCalendarEventsRequest getCalendarEventsRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(getCalendarEventsRequest.getCalendarId()) .addPathPartAsIs("events") @@ -587,8 +552,7 @@ static Request getCalendarEvents(GetCalendarEventsRequest getCalendarEventsReque static Request postCalendarEvents(PostCalendarEventRequest postCalendarEventRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(postCalendarEventRequest.getCalendarId()) .addPathPartAsIs("events") @@ -602,8 +566,7 @@ static Request postCalendarEvents(PostCalendarEventRequest postCalendarEventRequ static Request deleteCalendarEvent(DeleteCalendarEventRequest deleteCalendarEventRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("calendars") .addPathPart(deleteCalendarEventRequest.getCalendarId()) .addPathPartAsIs("events") @@ -614,8 +577,7 @@ static Request deleteCalendarEvent(DeleteCalendarEventRequest deleteCalendarEven static Request putFilter(PutFilterRequest putFilterRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("filters") .addPathPart(putFilterRequest.getMlFilter().getId()) .build(); @@ -626,8 +588,7 @@ static Request putFilter(PutFilterRequest putFilterRequest) throws IOException { static Request getFilter(GetFiltersRequest getFiltersRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("filters") .addPathPart(getFiltersRequest.getFilterId()) .build(); @@ -644,8 +605,7 @@ static Request getFilter(GetFiltersRequest getFiltersRequest) { static Request updateFilter(UpdateFilterRequest updateFilterRequest) throws IOException { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("filters") .addPathPart(updateFilterRequest.getFilterId()) .addPathPartAsIs("_update") @@ -657,7 +617,7 @@ static Request updateFilter(UpdateFilterRequest updateFilterRequest) throws IOEx static Request deleteFilter(DeleteFilterRequest deleteFilterRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack", "ml", "filters") + .addPathPartAsIs("_ml", "filters") .addPathPart(deleteFilterRequest.getId()) .build(); Request request = new Request(HttpDelete.METHOD_NAME, endpoint); @@ -666,15 +626,14 @@ static Request deleteFilter(DeleteFilterRequest deleteFilterRequest) { static Request mlInfo(MlInfoRequest infoRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack", "ml", "info") + .addPathPartAsIs("_ml", "info") .build(); return new Request(HttpGet.METHOD_NAME, endpoint); } static Request findFileStructure(FindFileStructureRequest findFileStructureRequest) { String endpoint = new EndpointBuilder() - .addPathPartAsIs("_xpack") - .addPathPartAsIs("ml") + .addPathPartAsIs("_ml") .addPathPartAsIs("find_file_structure") .build(); Request request = new Request(HttpPost.METHOD_NAME, endpoint); diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/MLRequestConvertersTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/MLRequestConvertersTests.java index 98cd3761e5a3c..b472837f9c25d 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/MLRequestConvertersTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/MLRequestConvertersTests.java @@ -112,7 +112,7 @@ public void testPutJob() throws IOException { Request request = MLRequestConverters.putJob(putJobRequest); assertEquals(HttpPut.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/anomaly_detectors/foo")); + assertThat(request.getEndpoint(), equalTo("/_ml/anomaly_detectors/foo")); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { Job parsedJob = Job.PARSER.apply(parser, null).build(); assertThat(parsedJob, equalTo(job)); @@ -125,14 +125,14 @@ public void testGetJob() { Request request = MLRequestConverters.getJob(getJobRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors", request.getEndpoint()); assertFalse(request.getParameters().containsKey("allow_no_jobs")); getJobRequest = new GetJobRequest("job1", "jobs*"); getJobRequest.setAllowNoJobs(true); request = MLRequestConverters.getJob(getJobRequest); - assertEquals("/_xpack/ml/anomaly_detectors/job1,jobs*", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/job1,jobs*", request.getEndpoint()); assertEquals(Boolean.toString(true), request.getParameters().get("allow_no_jobs")); } @@ -142,14 +142,14 @@ public void testGetJobStats() { Request request = MLRequestConverters.getJobStats(getJobStatsRequestRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/_stats", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/_stats", request.getEndpoint()); assertFalse(request.getParameters().containsKey("allow_no_jobs")); getJobStatsRequestRequest = new GetJobStatsRequest("job1", "jobs*"); getJobStatsRequestRequest.setAllowNoJobs(true); request = MLRequestConverters.getJobStats(getJobStatsRequestRequest); - assertEquals("/_xpack/ml/anomaly_detectors/job1,jobs*/_stats", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/job1,jobs*/_stats", request.getEndpoint()); assertEquals(Boolean.toString(true), request.getParameters().get("allow_no_jobs")); } @@ -161,7 +161,7 @@ public void testOpenJob() throws Exception { Request request = MLRequestConverters.openJob(openJobRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_open", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_open", request.getEndpoint()); assertEquals(requestEntityToString(request), "{\"job_id\":\""+ jobId +"\",\"timeout\":\"10m\"}"); } @@ -171,7 +171,7 @@ public void testCloseJob() throws Exception { Request request = MLRequestConverters.closeJob(closeJobRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_close", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_close", request.getEndpoint()); assertEquals("{\"job_id\":\"somejobid\"}", requestEntityToString(request)); closeJobRequest = new CloseJobRequest(jobId, "otherjobs*"); @@ -180,7 +180,7 @@ public void testCloseJob() throws Exception { closeJobRequest.setTimeout(TimeValue.timeValueMinutes(10)); request = MLRequestConverters.closeJob(closeJobRequest); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + ",otherjobs*/_close", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + ",otherjobs*/_close", request.getEndpoint()); assertEquals("{\"job_id\":\"somejobid,otherjobs*\",\"timeout\":\"10m\",\"force\":true,\"allow_no_jobs\":false}", requestEntityToString(request)); } @@ -190,7 +190,7 @@ public void testDeleteExpiredData() { Request request = MLRequestConverters.deleteExpiredData(deleteExpiredDataRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/_delete_expired_data", request.getEndpoint()); + assertEquals("/_ml/_delete_expired_data", request.getEndpoint()); } public void testDeleteJob() { @@ -199,7 +199,7 @@ public void testDeleteJob() { Request request = MLRequestConverters.deleteJob(deleteJobRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId, request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId, request.getEndpoint()); assertNull(request.getParameters().get("force")); assertNull(request.getParameters().get("wait_for_completion")); @@ -220,7 +220,7 @@ public void testFlushJob() throws Exception { Request request = MLRequestConverters.flushJob(flushJobRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_flush", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_flush", request.getEndpoint()); assertEquals("{\"job_id\":\"" + jobId + "\"}", requestEntityToString(request)); flushJobRequest.setSkipTime("1000"); @@ -243,7 +243,7 @@ public void testForecastJob() throws Exception { forecastJobRequest.setExpiresIn(TimeValue.timeValueHours(12)); Request request = MLRequestConverters.forecastJob(forecastJobRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_forecast", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_forecast", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { ForecastJobRequest parsedRequest = ForecastJobRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(forecastJobRequest)); @@ -257,7 +257,7 @@ public void testUpdateJob() throws Exception { Request request = MLRequestConverters.updateJob(updateJobRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_update", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_update", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { JobUpdate.Builder parsedRequest = JobUpdate.PARSER.apply(parser, null); assertThat(parsedRequest.build(), equalTo(updates)); @@ -271,7 +271,7 @@ public void testPutDatafeed() throws IOException { Request request = MLRequestConverters.putDatafeed(putDatafeedRequest); assertEquals(HttpPut.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/datafeeds/" + datafeed.getId())); + assertThat(request.getEndpoint(), equalTo("/_ml/datafeeds/" + datafeed.getId())); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { DatafeedConfig parsedDatafeed = DatafeedConfig.PARSER.apply(parser, null).build(); assertThat(parsedDatafeed, equalTo(datafeed)); @@ -284,14 +284,14 @@ public void testGetDatafeed() { Request request = MLRequestConverters.getDatafeed(getDatafeedRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds", request.getEndpoint()); + assertEquals("/_ml/datafeeds", request.getEndpoint()); assertFalse(request.getParameters().containsKey("allow_no_datafeeds")); getDatafeedRequest = new GetDatafeedRequest("feed-1", "feed-*"); getDatafeedRequest.setAllowNoDatafeeds(true); request = MLRequestConverters.getDatafeed(getDatafeedRequest); - assertEquals("/_xpack/ml/datafeeds/feed-1,feed-*", request.getEndpoint()); + assertEquals("/_ml/datafeeds/feed-1,feed-*", request.getEndpoint()); assertEquals(Boolean.toString(true), request.getParameters().get("allow_no_datafeeds")); } @@ -301,7 +301,7 @@ public void testDeleteDatafeed() { Request request = MLRequestConverters.deleteDatafeed(deleteDatafeedRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds/" + datafeedId, request.getEndpoint()); + assertEquals("/_ml/datafeeds/" + datafeedId, request.getEndpoint()); assertFalse(request.getParameters().containsKey("force")); deleteDatafeedRequest.setForce(true); @@ -315,7 +315,7 @@ public void testStartDatafeed() throws Exception { Request request = MLRequestConverters.startDatafeed(datafeedRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds/" + datafeedId + "/_start", request.getEndpoint()); + assertEquals("/_ml/datafeeds/" + datafeedId + "/_start", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { StartDatafeedRequest parsedDatafeedRequest = StartDatafeedRequest.PARSER.apply(parser, null); assertThat(parsedDatafeedRequest, equalTo(datafeedRequest)); @@ -329,7 +329,7 @@ public void testStopDatafeed() throws Exception { datafeedRequest.setAllowNoDatafeeds(true); Request request = MLRequestConverters.stopDatafeed(datafeedRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds/" + + assertEquals("/_ml/datafeeds/" + Strings.collectionToCommaDelimitedString(datafeedRequest.getDatafeedIds()) + "/_stop", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { @@ -344,14 +344,14 @@ public void testGetDatafeedStats() { Request request = MLRequestConverters.getDatafeedStats(getDatafeedStatsRequestRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds/_stats", request.getEndpoint()); + assertEquals("/_ml/datafeeds/_stats", request.getEndpoint()); assertFalse(request.getParameters().containsKey("allow_no_datafeeds")); getDatafeedStatsRequestRequest = new GetDatafeedStatsRequest("datafeed1", "datafeeds*"); getDatafeedStatsRequestRequest.setAllowNoDatafeeds(true); request = MLRequestConverters.getDatafeedStats(getDatafeedStatsRequestRequest); - assertEquals("/_xpack/ml/datafeeds/datafeed1,datafeeds*/_stats", request.getEndpoint()); + assertEquals("/_ml/datafeeds/datafeed1,datafeeds*/_stats", request.getEndpoint()); assertEquals(Boolean.toString(true), request.getParameters().get("allow_no_datafeeds")); } @@ -359,7 +359,7 @@ public void testPreviewDatafeed() { PreviewDatafeedRequest datafeedRequest = new PreviewDatafeedRequest("datafeed_1"); Request request = MLRequestConverters.previewDatafeed(datafeedRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/datafeeds/" + datafeedRequest.getDatafeedId() + "/_preview", request.getEndpoint()); + assertEquals("/_ml/datafeeds/" + datafeedRequest.getDatafeedId() + "/_preview", request.getEndpoint()); } public void testDeleteForecast() { @@ -368,7 +368,7 @@ public void testDeleteForecast() { Request request = MLRequestConverters.deleteForecast(deleteForecastRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_forecast", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_forecast", request.getEndpoint()); assertFalse(request.getParameters().containsKey("timeout")); assertFalse(request.getParameters().containsKey("allow_no_forecasts")); @@ -378,7 +378,7 @@ public void testDeleteForecast() { request = MLRequestConverters.deleteForecast(deleteForecastRequest); assertEquals( - "/_xpack/ml/anomaly_detectors/" + + "/_ml/anomaly_detectors/" + jobId + "/_forecast/" + Strings.collectionToCommaDelimitedString(deleteForecastRequest.getForecastIds()), @@ -396,7 +396,7 @@ public void testDeleteModelSnapshot() { Request request = MLRequestConverters.deleteModelSnapshot(deleteModelSnapshotRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId, request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId, request.getEndpoint()); } public void testGetBuckets() throws IOException { @@ -409,7 +409,7 @@ public void testGetBuckets() throws IOException { Request request = MLRequestConverters.getBuckets(getBucketsRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/results/buckets", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/results/buckets", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetBucketsRequest parsedRequest = GetBucketsRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getBucketsRequest)); @@ -424,7 +424,7 @@ public void testGetCategories() throws IOException { Request request = MLRequestConverters.getCategories(getCategoriesRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/results/categories", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/results/categories", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetCategoriesRequest parsedRequest = GetCategoriesRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getCategoriesRequest)); @@ -439,7 +439,7 @@ public void testGetModelSnapshots() throws IOException { Request request = MLRequestConverters.getModelSnapshots(getModelSnapshotsRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/model_snapshots", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/model_snapshots", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetModelSnapshotsRequest parsedRequest = GetModelSnapshotsRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getModelSnapshotsRequest)); @@ -455,7 +455,7 @@ public void testUpdateModelSnapshot() throws IOException { Request request = MLRequestConverters.updateModelSnapshot(updateModelSnapshotRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId + "/_update", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId + "/_update", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { UpdateModelSnapshotRequest parsedRequest = UpdateModelSnapshotRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(updateModelSnapshotRequest)); @@ -472,7 +472,7 @@ public void testRevertModelSnapshot() throws IOException { Request request = MLRequestConverters.revertModelSnapshot(revertModelSnapshotRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId + "/_revert", + assertEquals("/_ml/anomaly_detectors/" + jobId + "/model_snapshots/" + snapshotId + "/_revert", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { RevertModelSnapshotRequest parsedRequest = RevertModelSnapshotRequest.PARSER.apply(parser, null); @@ -491,7 +491,7 @@ public void testGetOverallBuckets() throws IOException { Request request = MLRequestConverters.getOverallBuckets(getOverallBucketsRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/results/overall_buckets", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/results/overall_buckets", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetOverallBucketsRequest parsedRequest = GetOverallBucketsRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getOverallBucketsRequest)); @@ -511,7 +511,7 @@ public void testGetRecords() throws IOException { Request request = MLRequestConverters.getRecords(getRecordsRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/results/records", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/results/records", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetRecordsRequest parsedRequest = GetRecordsRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getRecordsRequest)); @@ -529,7 +529,7 @@ public void testPostData() throws Exception { Request request = MLRequestConverters.postData(postDataRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/_data", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/_data", request.getEndpoint()); assertEquals("{\"foo\":\"bar\"}", requestEntityToString(request)); assertEquals(postDataRequest.getXContentType().mediaTypeWithoutParameters(), request.getEntity().getContentType().getValue()); assertFalse(request.getParameters().containsKey(PostDataRequest.RESET_END.getPreferredName())); @@ -559,7 +559,7 @@ public void testGetInfluencers() throws IOException { Request request = MLRequestConverters.getInfluencers(getInfluencersRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/anomaly_detectors/" + jobId + "/results/influencers", request.getEndpoint()); + assertEquals("/_ml/anomaly_detectors/" + jobId + "/results/influencers", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetInfluencersRequest parsedRequest = GetInfluencersRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getInfluencersRequest)); @@ -570,7 +570,7 @@ public void testPutCalendar() throws IOException { PutCalendarRequest putCalendarRequest = new PutCalendarRequest(CalendarTests.testInstance()); Request request = MLRequestConverters.putCalendar(putCalendarRequest); assertEquals(HttpPut.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + putCalendarRequest.getCalendar().getId(), request.getEndpoint()); + assertEquals("/_ml/calendars/" + putCalendarRequest.getCalendar().getId(), request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { Calendar parsedCalendar = Calendar.PARSER.apply(parser, null); assertThat(parsedCalendar, equalTo(putCalendarRequest.getCalendar())); @@ -584,7 +584,7 @@ public void testPutCalendarJob() { PutCalendarJobRequest putCalendarJobRequest = new PutCalendarJobRequest(calendarId, job1, job2); Request request = MLRequestConverters.putCalendarJob(putCalendarJobRequest); assertEquals(HttpPut.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + calendarId + "/jobs/" + job1 + "," + job2, request.getEndpoint()); + assertEquals("/_ml/calendars/" + calendarId + "/jobs/" + job1 + "," + job2, request.getEndpoint()); } public void testDeleteCalendarJob() { @@ -594,12 +594,12 @@ public void testDeleteCalendarJob() { DeleteCalendarJobRequest deleteCalendarJobRequest = new DeleteCalendarJobRequest(calendarId, job1, job2); Request request = MLRequestConverters.deleteCalendarJob(deleteCalendarJobRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + calendarId + "/jobs/" + job1 + "," + job2, request.getEndpoint()); + assertEquals("/_ml/calendars/" + calendarId + "/jobs/" + job1 + "," + job2, request.getEndpoint()); } public void testGetCalendars() throws IOException { GetCalendarsRequest getCalendarsRequest = new GetCalendarsRequest(); - String expectedEndpoint = "/_xpack/ml/calendars"; + String expectedEndpoint = "/_ml/calendars"; if (randomBoolean()) { String calendarId = randomAlphaOfLength(10); @@ -623,7 +623,7 @@ public void testDeleteCalendar() { DeleteCalendarRequest deleteCalendarRequest = new DeleteCalendarRequest(randomAlphaOfLength(10)); Request request = MLRequestConverters.deleteCalendar(deleteCalendarRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + deleteCalendarRequest.getCalendarId(), request.getEndpoint()); + assertEquals("/_ml/calendars/" + deleteCalendarRequest.getCalendarId(), request.getEndpoint()); } public void testGetCalendarEvents() throws IOException { @@ -636,7 +636,7 @@ public void testGetCalendarEvents() throws IOException { Request request = MLRequestConverters.getCalendarEvents(getCalendarEventsRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + calendarId + "/events", request.getEndpoint()); + assertEquals("/_ml/calendars/" + calendarId + "/events", request.getEndpoint()); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { GetCalendarEventsRequest parsedRequest = GetCalendarEventsRequest.PARSER.apply(parser, null); assertThat(parsedRequest, equalTo(getCalendarEventsRequest)); @@ -652,7 +652,7 @@ public void testPostCalendarEvent() throws Exception { Request request = MLRequestConverters.postCalendarEvents(postCalendarEventRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + calendarId + "/events", request.getEndpoint()); + assertEquals("/_ml/calendars/" + calendarId + "/events", request.getEndpoint()); XContentBuilder builder = JsonXContent.contentBuilder(); builder = postCalendarEventRequest.toXContent(builder, PostCalendarEventRequest.EXCLUDE_CALENDAR_ID_PARAMS); @@ -665,7 +665,7 @@ public void testDeleteCalendarEvent() { DeleteCalendarEventRequest deleteCalendarEventRequest = new DeleteCalendarEventRequest(calendarId, eventId); Request request = MLRequestConverters.deleteCalendarEvent(deleteCalendarEventRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/calendars/" + calendarId + "/events/" + eventId, request.getEndpoint()); + assertEquals("/_ml/calendars/" + calendarId + "/events/" + eventId, request.getEndpoint()); } public void testPutFilter() throws IOException { @@ -675,7 +675,7 @@ public void testPutFilter() throws IOException { Request request = MLRequestConverters.putFilter(putFilterRequest); assertEquals(HttpPut.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/filters/foo")); + assertThat(request.getEndpoint(), equalTo("/_ml/filters/foo")); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { MlFilter parsedFilter = MlFilter.PARSER.apply(parser, null).build(); assertThat(parsedFilter, equalTo(filter)); @@ -690,7 +690,7 @@ public void testGetFilter() throws IOException { Request request = MLRequestConverters.getFilter(getFiltersRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/filters/" + id, request.getEndpoint()); + assertEquals("/_ml/filters/" + id, request.getEndpoint()); assertThat(request.getParameters().get(PageParams.FROM.getPreferredName()), is(nullValue())); assertThat(request.getParameters().get(PageParams.SIZE.getPreferredName()), is(nullValue())); @@ -711,7 +711,7 @@ public void testUpdateFilter() throws IOException { Request request = MLRequestConverters.updateFilter(updateFilterRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/filters/"+filterId+"/_update")); + assertThat(request.getEndpoint(), equalTo("/_ml/filters/"+filterId+"/_update")); try (XContentParser parser = createParser(JsonXContent.jsonXContent, request.getEntity().getContent())) { UpdateFilterRequest parsedFilterRequest = UpdateFilterRequest.PARSER.apply(parser, null); assertThat(parsedFilterRequest, equalTo(updateFilterRequest)); @@ -725,7 +725,7 @@ public void testDeleteFilter() { Request request = MLRequestConverters.deleteFilter(deleteFilterRequest); assertEquals(HttpDelete.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/filters/foo")); + assertThat(request.getEndpoint(), equalTo("/_ml/filters/foo")); assertNull(request.getEntity()); } @@ -735,7 +735,7 @@ public void testMlInfo() { Request request = MLRequestConverters.mlInfo(infoRequest); assertEquals(HttpGet.METHOD_NAME, request.getMethod()); - assertThat(request.getEndpoint(), equalTo("/_xpack/ml/info")); + assertThat(request.getEndpoint(), equalTo("/_ml/info")); assertNull(request.getEntity()); } @@ -747,7 +747,7 @@ public void testFindFileStructure() throws Exception { Request request = MLRequestConverters.findFileStructure(findFileStructureRequest); assertEquals(HttpPost.METHOD_NAME, request.getMethod()); - assertEquals("/_xpack/ml/find_file_structure", request.getEndpoint()); + assertEquals("/_ml/find_file_structure", request.getEndpoint()); if (findFileStructureRequest.getLinesToSample() != null) { assertEquals(findFileStructureRequest.getLinesToSample(), Integer.valueOf(request.getParameters().get("lines_to_sample"))); } else { diff --git a/docs/reference/ml/aggregations.asciidoc b/docs/reference/ml/aggregations.asciidoc index 4b873ea790b1e..7a9d30a518fbb 100644 --- a/docs/reference/ml/aggregations.asciidoc +++ b/docs/reference/ml/aggregations.asciidoc @@ -24,7 +24,7 @@ example: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/farequote +PUT _ml/anomaly_detectors/farequote { "analysis_config": { "bucket_span": "60m", @@ -55,7 +55,7 @@ The aggregations are defined in the {dfeed} as follows: [source,js] ---------------------------------- -PUT _xpack/ml/datafeeds/datafeed-farequote +PUT _ml/datafeeds/datafeed-farequote { "job_id":"farequote", "indices": ["farequote"], diff --git a/docs/reference/ml/apis/close-job.asciidoc b/docs/reference/ml/apis/close-job.asciidoc index 6dec6402c8766..317a67a287a0b 100644 --- a/docs/reference/ml/apis/close-job.asciidoc +++ b/docs/reference/ml/apis/close-job.asciidoc @@ -15,11 +15,11 @@ operations, but you can still explore and navigate results. ==== Request -`POST _xpack/ml/anomaly_detectors//_close` + +`POST _ml/anomaly_detectors//_close` + -`POST _xpack/ml/anomaly_detectors/,/_close` + +`POST _ml/anomaly_detectors/,/_close` + -`POST _xpack/ml/anomaly_detectors/_all/_close` + +`POST _ml/anomaly_detectors/_all/_close` + ==== Description @@ -78,7 +78,7 @@ The following example closes the `total-requests` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_close +POST _ml/anomaly_detectors/total-requests/_close -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_openjob] diff --git a/docs/reference/ml/apis/delete-calendar-event.asciidoc b/docs/reference/ml/apis/delete-calendar-event.asciidoc index 8961726f57322..7eb7b56dbb515 100644 --- a/docs/reference/ml/apis/delete-calendar-event.asciidoc +++ b/docs/reference/ml/apis/delete-calendar-event.asciidoc @@ -11,7 +11,7 @@ Deletes scheduled events from a calendar. ==== Request -`DELETE _xpack/ml/calendars//events/` +`DELETE _ml/calendars//events/` ==== Description @@ -42,7 +42,7 @@ calendar: [source,js] -------------------------------------------------- -DELETE _xpack/ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st +DELETE _ml/calendars/planned-outages/events/LS8LJGEBMTCMA-qz49st -------------------------------------------------- // CONSOLE // TEST[skip:catch:missing] diff --git a/docs/reference/ml/apis/delete-calendar-job.asciidoc b/docs/reference/ml/apis/delete-calendar-job.asciidoc index 4362a82b5cb7e..174f29c66736c 100644 --- a/docs/reference/ml/apis/delete-calendar-job.asciidoc +++ b/docs/reference/ml/apis/delete-calendar-job.asciidoc @@ -11,7 +11,7 @@ Deletes jobs from a calendar. ==== Request -`DELETE _xpack/ml/calendars//jobs/` +`DELETE _ml/calendars//jobs/` ==== Path Parameters @@ -36,7 +36,7 @@ calendar and `total-requests` job: [source,js] -------------------------------------------------- -DELETE _xpack/ml/calendars/planned-outages/jobs/total-requests +DELETE _ml/calendars/planned-outages/jobs/total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:calendar_outages_addjob] diff --git a/docs/reference/ml/apis/delete-calendar.asciidoc b/docs/reference/ml/apis/delete-calendar.asciidoc index 9f9f3457f24d2..5a7cf23146f02 100644 --- a/docs/reference/ml/apis/delete-calendar.asciidoc +++ b/docs/reference/ml/apis/delete-calendar.asciidoc @@ -11,7 +11,7 @@ Deletes a calendar. ==== Request -`DELETE _xpack/ml/calendars/` +`DELETE _ml/calendars/` ==== Description @@ -38,7 +38,7 @@ The following example deletes the `planned-outages` calendar: [source,js] -------------------------------------------------- -DELETE _xpack/ml/calendars/planned-outages +DELETE _ml/calendars/planned-outages -------------------------------------------------- // CONSOLE // TEST[skip:setup:calendar_outages] diff --git a/docs/reference/ml/apis/delete-datafeed.asciidoc b/docs/reference/ml/apis/delete-datafeed.asciidoc index 996d2c7dd2eaf..da077dfd87bdf 100644 --- a/docs/reference/ml/apis/delete-datafeed.asciidoc +++ b/docs/reference/ml/apis/delete-datafeed.asciidoc @@ -11,7 +11,7 @@ Deletes an existing {dfeed}. ==== Request -`DELETE _xpack/ml/datafeeds/` +`DELETE _ml/datafeeds/` ==== Description @@ -45,7 +45,7 @@ The following example deletes the `datafeed-total-requests` {dfeed}: [source,js] -------------------------------------------------- -DELETE _xpack/ml/datafeeds/datafeed-total-requests +DELETE _ml/datafeeds/datafeed-total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_datafeed] diff --git a/docs/reference/ml/apis/delete-expired-data.asciidoc b/docs/reference/ml/apis/delete-expired-data.asciidoc index 310a17ff10304..83a58179a31bf 100644 --- a/docs/reference/ml/apis/delete-expired-data.asciidoc +++ b/docs/reference/ml/apis/delete-expired-data.asciidoc @@ -10,7 +10,7 @@ Deletes expired and unused machine learning data. ==== Request -`DELETE _xpack/ml/_delete_expired_data` +`DELETE _ml/_delete_expired_data` ==== Description @@ -32,7 +32,7 @@ The endpoint takes no arguments: [source,js] -------------------------------------------------- -DELETE _xpack/ml/_delete_expired_data +DELETE _ml/_delete_expired_data -------------------------------------------------- // CONSOLE // TEST diff --git a/docs/reference/ml/apis/delete-filter.asciidoc b/docs/reference/ml/apis/delete-filter.asciidoc index 21e35b66076f6..5ca578f43dd32 100644 --- a/docs/reference/ml/apis/delete-filter.asciidoc +++ b/docs/reference/ml/apis/delete-filter.asciidoc @@ -11,7 +11,7 @@ Deletes a filter. ==== Request -`DELETE _xpack/ml/filters/` +`DELETE _ml/filters/` ==== Description @@ -39,7 +39,7 @@ The following example deletes the `safe_domains` filter: [source,js] -------------------------------------------------- -DELETE _xpack/ml/filters/safe_domains +DELETE _ml/filters/safe_domains -------------------------------------------------- // CONSOLE // TEST[skip:setup:ml_filter_safe_domains] diff --git a/docs/reference/ml/apis/delete-forecast.asciidoc b/docs/reference/ml/apis/delete-forecast.asciidoc index 159dafefb0efc..a051da31df3c6 100644 --- a/docs/reference/ml/apis/delete-forecast.asciidoc +++ b/docs/reference/ml/apis/delete-forecast.asciidoc @@ -10,11 +10,11 @@ Deletes forecasts from a {ml} job. ==== Request -`DELETE _xpack/ml/anomaly_detectors//_forecast` + +`DELETE _ml/anomaly_detectors//_forecast` + -`DELETE _xpack/ml/anomaly_detectors//_forecast/` + +`DELETE _ml/anomaly_detectors//_forecast/` + -`DELETE _xpack/ml/anomaly_detectors//_forecast/_all` +`DELETE _ml/anomaly_detectors//_forecast/_all` ==== Description @@ -63,7 +63,7 @@ The following example deletes all forecasts from the `total-requests` job: [source,js] -------------------------------------------------- -DELETE _xpack/ml/anomaly_detectors/total-requests/_forecast/_all +DELETE _ml/anomaly_detectors/total-requests/_forecast/_all -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_openjob] diff --git a/docs/reference/ml/apis/delete-job.asciidoc b/docs/reference/ml/apis/delete-job.asciidoc index b9dbe9e3cd6bd..b275ffafca73b 100644 --- a/docs/reference/ml/apis/delete-job.asciidoc +++ b/docs/reference/ml/apis/delete-job.asciidoc @@ -11,7 +11,7 @@ Deletes an existing anomaly detection job. ==== Request -`DELETE _xpack/ml/anomaly_detectors/` +`DELETE _ml/anomaly_detectors/` ==== Description @@ -57,7 +57,7 @@ The following example deletes the `total-requests` job: [source,js] -------------------------------------------------- -DELETE _xpack/ml/anomaly_detectors/total-requests +DELETE _ml/anomaly_detectors/total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_job] @@ -75,7 +75,7 @@ In the next example we delete the `total-requests` job asynchronously: [source,js] -------------------------------------------------- -DELETE _xpack/ml/anomaly_detectors/total-requests?wait_for_completion=false +DELETE _ml/anomaly_detectors/total-requests?wait_for_completion=false -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_job] @@ -88,4 +88,4 @@ of the job deletion task: "task": "oTUltX4IQMOUUVeiohTt8A:39" } ---- -// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/] \ No newline at end of file +// TESTRESPONSE[s/"task": "oTUltX4IQMOUUVeiohTt8A:39"/"task": $body.task/] diff --git a/docs/reference/ml/apis/delete-snapshot.asciidoc b/docs/reference/ml/apis/delete-snapshot.asciidoc index 96a3590054557..5802000546e92 100644 --- a/docs/reference/ml/apis/delete-snapshot.asciidoc +++ b/docs/reference/ml/apis/delete-snapshot.asciidoc @@ -11,7 +11,7 @@ Deletes an existing model snapshot. ==== Request -`DELETE _xpack/ml/anomaly_detectors//model_snapshots/` +`DELETE _ml/anomaly_detectors//model_snapshots/` ==== Description @@ -41,7 +41,7 @@ The following example deletes the `1491948163` snapshot: [source,js] -------------------------------------------------- -DELETE _xpack/ml/anomaly_detectors/farequote/model_snapshots/1491948163 +DELETE _ml/anomaly_detectors/farequote/model_snapshots/1491948163 -------------------------------------------------- // CONSOLE // TEST[skip:todo] @@ -53,4 +53,4 @@ When the snapshot is deleted, you receive the following results: "acknowledged": true } ---- -// TESTRESPONSE \ No newline at end of file +// TESTRESPONSE diff --git a/docs/reference/ml/apis/find-file-structure.asciidoc b/docs/reference/ml/apis/find-file-structure.asciidoc index 737df6e0cea21..8ed6a2385651d 100644 --- a/docs/reference/ml/apis/find-file-structure.asciidoc +++ b/docs/reference/ml/apis/find-file-structure.asciidoc @@ -13,7 +13,7 @@ suitable to be ingested into {es}. ==== Request -`POST _xpack/ml/find_file_structure` +`POST _ml/find_file_structure` ==== Description @@ -220,7 +220,7 @@ some books. You can send the contents to the `find_file_structure` endpoint: [source,js] ---- -POST _xpack/ml/find_file_structure +POST _ml/find_file_structure {"name": "Leviathan Wakes", "author": "James S.A. Corey", "release_date": "2011-06-02", "page_count": 561} {"name": "Hyperion", "author": "Dan Simmons", "release_date": "1989-05-26", "page_count": 482} {"name": "Dune", "author": "Frank Herbert", "release_date": "1965-06-01", "page_count": 604} @@ -501,7 +501,7 @@ to match what is specified in the `head` command. [source,js] ---- -curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -20000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&lines_to_sample=20000" -T - +curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -20000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&lines_to_sample=20000" -T - ---- // NOTCONSOLE // Not converting to console because this shows how curl can be used @@ -1305,7 +1305,7 @@ analysis: [source,js] ---- -curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -200000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&lines_to_sample=200000&timeout=1s" -T - +curl -s "s3.amazonaws.com/nyc-tlc/trip+data/yellow_tripdata_2018-06.csv" | head -200000 | curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&lines_to_sample=200000&timeout=1s" -T - ---- // NOTCONSOLE // Not converting to console because this shows how curl can be used @@ -1342,7 +1342,7 @@ This is an example of analyzing {es}'s own log file: [source,js] ---- -curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty" -T "$ES_HOME/logs/elasticsearch.log" +curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty" -T "$ES_HOME/logs/elasticsearch.log" ---- // NOTCONSOLE // Not converting to console because this shows how curl can be used @@ -1496,7 +1496,7 @@ query parameter (appropriately URL escaped): [source,js] ---- -curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_xpack/ml/find_file_structure?pretty&format=semi_structured_text&grok_pattern=%5C%5B%25%7BTIMESTAMP_ISO8601:timestamp%7D%5C%5D%5C%5B%25%7BLOGLEVEL:loglevel%7D%20*%5C%5D%5C%5B%25%7BJAVACLASS:class%7D%20*%5C%5D%20%5C%5B%25%7BHOSTNAME:node%7D%5C%5D%20%25%7BJAVALOGMESSAGE:message%7D" -T "$ES_HOME/logs/elasticsearch.log" +curl -s -H "Content-Type: application/json" -XPOST "localhost:9200/_ml/find_file_structure?pretty&format=semi_structured_text&grok_pattern=%5C%5B%25%7BTIMESTAMP_ISO8601:timestamp%7D%5C%5D%5C%5B%25%7BLOGLEVEL:loglevel%7D%20*%5C%5D%5C%5B%25%7BJAVACLASS:class%7D%20*%5C%5D%20%5C%5B%25%7BHOSTNAME:node%7D%5C%5D%20%25%7BJAVALOGMESSAGE:message%7D" -T "$ES_HOME/logs/elasticsearch.log" ---- // NOTCONSOLE // Not converting to console because this shows how curl can be used diff --git a/docs/reference/ml/apis/flush-job.asciidoc b/docs/reference/ml/apis/flush-job.asciidoc index f19d2aa648f68..b7d72efde016e 100644 --- a/docs/reference/ml/apis/flush-job.asciidoc +++ b/docs/reference/ml/apis/flush-job.asciidoc @@ -11,7 +11,7 @@ Forces any buffered data to be processed by the job. ==== Request -`POST _xpack/ml/anomaly_detectors//_flush` +`POST _ml/anomaly_detectors//_flush` ==== Description @@ -69,7 +69,7 @@ The following example flushes the `total-requests` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_flush +POST _ml/anomaly_detectors/total-requests/_flush { "calc_interim": true } @@ -96,7 +96,7 @@ on January 1, 2018: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_flush +POST _ml/anomaly_detectors/total-requests/_flush { "advance_time": "1514804400" } diff --git a/docs/reference/ml/apis/forecast.asciidoc b/docs/reference/ml/apis/forecast.asciidoc index 197876f3f04a7..9fa91462c294e 100644 --- a/docs/reference/ml/apis/forecast.asciidoc +++ b/docs/reference/ml/apis/forecast.asciidoc @@ -10,7 +10,7 @@ Predicts the future behavior of a time series by using its historical behavior. ==== Request -`POST _xpack/ml/anomaly_detectors//_forecast` +`POST _ml/anomaly_detectors//_forecast` ==== Description @@ -57,7 +57,7 @@ The following example requests a 10 day forecast for the `total-requests` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_forecast +POST _ml/anomaly_detectors/total-requests/_forecast { "duration": "10d" } diff --git a/docs/reference/ml/apis/get-bucket.asciidoc b/docs/reference/ml/apis/get-bucket.asciidoc index 3a276c13e895b..c97a18257f9bb 100644 --- a/docs/reference/ml/apis/get-bucket.asciidoc +++ b/docs/reference/ml/apis/get-bucket.asciidoc @@ -11,9 +11,9 @@ Retrieves job results for one or more buckets. ==== Request -`GET _xpack/ml/anomaly_detectors//results/buckets` + +`GET _ml/anomaly_detectors//results/buckets` + -`GET _xpack/ml/anomaly_detectors//results/buckets/` +`GET _ml/anomaly_detectors//results/buckets/` ==== Description @@ -90,7 +90,7 @@ The following example gets bucket information for the `it-ops-kpi` job: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/buckets +GET _ml/anomaly_detectors/it-ops-kpi/results/buckets { "anomaly_score": 80, "start": "1454530200001" diff --git a/docs/reference/ml/apis/get-calendar-event.asciidoc b/docs/reference/ml/apis/get-calendar-event.asciidoc index 43dd74e47c977..05364edbaecd5 100644 --- a/docs/reference/ml/apis/get-calendar-event.asciidoc +++ b/docs/reference/ml/apis/get-calendar-event.asciidoc @@ -12,9 +12,9 @@ calendars. ==== Request -`GET _xpack/ml/calendars//events` + +`GET _ml/calendars//events` + -`GET _xpack/ml/calendars/_all/events` +`GET _ml/calendars/_all/events` ===== Description @@ -64,7 +64,7 @@ The following example gets information about the scheduled events in the [source,js] -------------------------------------------------- -GET _xpack/ml/calendars/planned-outages/events +GET _ml/calendars/planned-outages/events -------------------------------------------------- // CONSOLE // TEST[skip:setup:calendar_outages_addevent] diff --git a/docs/reference/ml/apis/get-calendar.asciidoc b/docs/reference/ml/apis/get-calendar.asciidoc index f86875f326cd9..3f7f2e7072f4d 100644 --- a/docs/reference/ml/apis/get-calendar.asciidoc +++ b/docs/reference/ml/apis/get-calendar.asciidoc @@ -11,9 +11,9 @@ Retrieves configuration information for calendars. ==== Request -`GET _xpack/ml/calendars/` + +`GET _ml/calendars/` + -`GET _xpack/ml/calendars/_all` +`GET _ml/calendars/_all` ===== Description @@ -60,7 +60,7 @@ calendar: [source,js] -------------------------------------------------- -GET _xpack/ml/calendars/planned-outages +GET _ml/calendars/planned-outages -------------------------------------------------- // CONSOLE // TEST[skip:setup:calendar_outages_addjob] diff --git a/docs/reference/ml/apis/get-category.asciidoc b/docs/reference/ml/apis/get-category.asciidoc index e5d6fe16802a1..4307b6a7e2279 100644 --- a/docs/reference/ml/apis/get-category.asciidoc +++ b/docs/reference/ml/apis/get-category.asciidoc @@ -11,9 +11,9 @@ Retrieves job results for one or more categories. ==== Request -`GET _xpack/ml/anomaly_detectors//results/categories` + +`GET _ml/anomaly_detectors//results/categories` + -`GET _xpack/ml/anomaly_detectors//results/categories/` +`GET _ml/anomaly_detectors//results/categories/` ==== Description @@ -65,7 +65,7 @@ The following example gets information about one category for the [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/esxi_log/results/categories +GET _ml/anomaly_detectors/esxi_log/results/categories { "page":{ "size": 1 diff --git a/docs/reference/ml/apis/get-datafeed-stats.asciidoc b/docs/reference/ml/apis/get-datafeed-stats.asciidoc index 9ca67cc17fb44..d0bf7149b6a55 100644 --- a/docs/reference/ml/apis/get-datafeed-stats.asciidoc +++ b/docs/reference/ml/apis/get-datafeed-stats.asciidoc @@ -12,13 +12,13 @@ Retrieves usage information for {dfeeds}. ==== Request -`GET _xpack/ml/datafeeds//_stats` + +`GET _ml/datafeeds//_stats` + -`GET _xpack/ml/datafeeds/,/_stats` + +`GET _ml/datafeeds/,/_stats` + -`GET _xpack/ml/datafeeds/_stats` + +`GET _ml/datafeeds/_stats` + -`GET _xpack/ml/datafeeds/_all/_stats` + +`GET _ml/datafeeds/_all/_stats` + @@ -64,7 +64,7 @@ The following example gets usage information for the [source,js] -------------------------------------------------- -GET _xpack/ml/datafeeds/datafeed-total-requests/_stats +GET _ml/datafeeds/datafeed-total-requests/_stats -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_startdf] @@ -98,4 +98,4 @@ The API returns the following results: // TESTRESPONSE[s/"node-0"/$body.$_path/] // TESTRESPONSE[s/"hoXMLZB0RWKfR9UPPUCxXX"/$body.$_path/] // TESTRESPONSE[s/"127.0.0.1:9300"/$body.$_path/] -// TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/] \ No newline at end of file +// TESTRESPONSE[s/"17179869184"/$body.datafeeds.0.node.attributes.ml\\.machine_memory/] diff --git a/docs/reference/ml/apis/get-datafeed.asciidoc b/docs/reference/ml/apis/get-datafeed.asciidoc index db5f4249669bb..828fcae0a8d55 100644 --- a/docs/reference/ml/apis/get-datafeed.asciidoc +++ b/docs/reference/ml/apis/get-datafeed.asciidoc @@ -11,13 +11,13 @@ Retrieves configuration information for {dfeeds}. ==== Request -`GET _xpack/ml/datafeeds/` + +`GET _ml/datafeeds/` + -`GET _xpack/ml/datafeeds/,` + +`GET _ml/datafeeds/,` + -`GET _xpack/ml/datafeeds/` + +`GET _ml/datafeeds/` + -`GET _xpack/ml/datafeeds/_all` + +`GET _ml/datafeeds/_all` + ===== Description @@ -58,7 +58,7 @@ The following example gets configuration information for the [source,js] -------------------------------------------------- -GET _xpack/ml/datafeeds/datafeed-total-requests +GET _ml/datafeeds/datafeed-total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_datafeed] diff --git a/docs/reference/ml/apis/get-filter.asciidoc b/docs/reference/ml/apis/get-filter.asciidoc index 2dbb5d16cc5a4..d668d1a355593 100644 --- a/docs/reference/ml/apis/get-filter.asciidoc +++ b/docs/reference/ml/apis/get-filter.asciidoc @@ -11,9 +11,9 @@ Retrieves filters. ==== Request -`GET _xpack/ml/filters/` + +`GET _ml/filters/` + -`GET _xpack/ml/filters/` +`GET _ml/filters/` ===== Description @@ -60,7 +60,7 @@ filter: [source,js] -------------------------------------------------- -GET _xpack/ml/filters/safe_domains +GET _ml/filters/safe_domains -------------------------------------------------- // CONSOLE // TEST[skip:setup:ml_filter_safe_domains] diff --git a/docs/reference/ml/apis/get-influencer.asciidoc b/docs/reference/ml/apis/get-influencer.asciidoc index 182cca7aa9917..753b85b376f4b 100644 --- a/docs/reference/ml/apis/get-influencer.asciidoc +++ b/docs/reference/ml/apis/get-influencer.asciidoc @@ -11,7 +11,7 @@ Retrieves job results for one or more influencers. ==== Request -`GET _xpack/ml/anomaly_detectors//results/influencers` +`GET _ml/anomaly_detectors//results/influencers` //===== Description @@ -75,7 +75,7 @@ The following example gets influencer information for the `it_ops_new_kpi` job: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/it_ops_new_kpi/results/influencers +GET _ml/anomaly_detectors/it_ops_new_kpi/results/influencers { "sort": "influencer_score", "desc": true diff --git a/docs/reference/ml/apis/get-job-stats.asciidoc b/docs/reference/ml/apis/get-job-stats.asciidoc index 509d9448a693e..d4161474b3d64 100644 --- a/docs/reference/ml/apis/get-job-stats.asciidoc +++ b/docs/reference/ml/apis/get-job-stats.asciidoc @@ -13,13 +13,13 @@ Retrieves usage information for jobs. -`GET _xpack/ml/anomaly_detectors//_stats` +`GET _ml/anomaly_detectors//_stats` -`GET _xpack/ml/anomaly_detectors/,/_stats` + +`GET _ml/anomaly_detectors/,/_stats` + -`GET _xpack/ml/anomaly_detectors/_stats` + +`GET _ml/anomaly_detectors/_stats` + -`GET _xpack/ml/anomaly_detectors/_all/_stats` + +`GET _ml/anomaly_detectors/_all/_stats` + ===== Description @@ -60,7 +60,7 @@ The following example gets usage information for the `farequote` job: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/farequote/_stats +GET _ml/anomaly_detectors/farequote/_stats -------------------------------------------------- // CONSOLE // TEST[skip:todo] diff --git a/docs/reference/ml/apis/get-job.asciidoc b/docs/reference/ml/apis/get-job.asciidoc index c669ac6034eda..7d6df8175283c 100644 --- a/docs/reference/ml/apis/get-job.asciidoc +++ b/docs/reference/ml/apis/get-job.asciidoc @@ -11,13 +11,13 @@ Retrieves configuration information for jobs. ==== Request -`GET _xpack/ml/anomaly_detectors/` + +`GET _ml/anomaly_detectors/` + -`GET _xpack/ml/anomaly_detectors/,` + +`GET _ml/anomaly_detectors/,` + -`GET _xpack/ml/anomaly_detectors/` + +`GET _ml/anomaly_detectors/` + -`GET _xpack/ml/anomaly_detectors/_all` +`GET _ml/anomaly_detectors/_all` ===== Description @@ -57,7 +57,7 @@ The following example gets configuration information for the `total-requests` jo [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/total-requests +GET _ml/anomaly_detectors/total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_job] diff --git a/docs/reference/ml/apis/get-ml-info.asciidoc b/docs/reference/ml/apis/get-ml-info.asciidoc index d3f9e69560bc9..2e20fa08e6c58 100644 --- a/docs/reference/ml/apis/get-ml-info.asciidoc +++ b/docs/reference/ml/apis/get-ml-info.asciidoc @@ -10,7 +10,7 @@ Returns defaults and limits used by machine learning. ==== Request -`GET _xpack/ml/info` +`GET _ml/info` ==== Description @@ -35,7 +35,7 @@ The endpoint takes no arguments: [source,js] -------------------------------------------------- -GET _xpack/ml/info +GET _ml/info -------------------------------------------------- // CONSOLE // TEST diff --git a/docs/reference/ml/apis/get-overall-buckets.asciidoc b/docs/reference/ml/apis/get-overall-buckets.asciidoc index f4818f3bbbe44..343e8bc9818e8 100644 --- a/docs/reference/ml/apis/get-overall-buckets.asciidoc +++ b/docs/reference/ml/apis/get-overall-buckets.asciidoc @@ -11,11 +11,11 @@ bucket results of multiple jobs. ==== Request -`GET _xpack/ml/anomaly_detectors//results/overall_buckets` + +`GET _ml/anomaly_detectors//results/overall_buckets` + -`GET _xpack/ml/anomaly_detectors/,/results/overall_buckets` + +`GET _ml/anomaly_detectors/,/results/overall_buckets` + -`GET _xpack/ml/anomaly_detectors/_all/results/overall_buckets` +`GET _ml/anomaly_detectors/_all/results/overall_buckets` ==== Description @@ -102,7 +102,7 @@ The following example gets overall buckets for jobs with IDs matching `job-*`: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/job-*/results/overall_buckets +GET _ml/anomaly_detectors/job-*/results/overall_buckets { "overall_score": 80, "start": "1403532000000" @@ -148,7 +148,7 @@ The next example is similar but this time `top_n` is set to `2`: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/job-*/results/overall_buckets +GET _ml/anomaly_detectors/job-*/results/overall_buckets { "top_n": 2, "overall_score": 50.0, diff --git a/docs/reference/ml/apis/get-record.asciidoc b/docs/reference/ml/apis/get-record.asciidoc index 199cce1548427..dfb6b1b14bafd 100644 --- a/docs/reference/ml/apis/get-record.asciidoc +++ b/docs/reference/ml/apis/get-record.asciidoc @@ -11,7 +11,7 @@ Retrieves anomaly records for a job. ==== Request -`GET _xpack/ml/anomaly_detectors//results/records` +`GET _ml/anomaly_detectors//results/records` //===== Description @@ -76,7 +76,7 @@ The following example gets record information for the `it-ops-kpi` job: [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/it-ops-kpi/results/records +GET _ml/anomaly_detectors/it-ops-kpi/results/records { "sort": "record_score", "desc": true, diff --git a/docs/reference/ml/apis/get-snapshot.asciidoc b/docs/reference/ml/apis/get-snapshot.asciidoc index e194d944b636c..a5fba52566a29 100644 --- a/docs/reference/ml/apis/get-snapshot.asciidoc +++ b/docs/reference/ml/apis/get-snapshot.asciidoc @@ -11,9 +11,9 @@ Retrieves information about model snapshots. ==== Request -`GET _xpack/ml/anomaly_detectors//model_snapshots` + +`GET _ml/anomaly_detectors//model_snapshots` + -`GET _xpack/ml/anomaly_detectors//model_snapshots/` +`GET _ml/anomaly_detectors//model_snapshots/` //===== Description @@ -72,7 +72,7 @@ The following example gets model snapshot information for the [source,js] -------------------------------------------------- -GET _xpack/ml/anomaly_detectors/farequote/model_snapshots +GET _ml/anomaly_detectors/farequote/model_snapshots { "start": "1491852977000" } diff --git a/docs/reference/ml/apis/jobresource.asciidoc b/docs/reference/ml/apis/jobresource.asciidoc index e0c314724e762..9a9ea173cfb46 100644 --- a/docs/reference/ml/apis/jobresource.asciidoc +++ b/docs/reference/ml/apis/jobresource.asciidoc @@ -364,7 +364,7 @@ If you omit the `categorization_analyzer`, the following default values are used [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/_validate +POST _ml/anomaly_detectors/_validate { "analysis_config" : { "categorization_analyzer" : { diff --git a/docs/reference/ml/apis/open-job.asciidoc b/docs/reference/ml/apis/open-job.asciidoc index c1e5977b734fd..4a3a068bd57de 100644 --- a/docs/reference/ml/apis/open-job.asciidoc +++ b/docs/reference/ml/apis/open-job.asciidoc @@ -13,7 +13,7 @@ A job can be opened and closed multiple times throughout its lifecycle. ==== Request -`POST _xpack/ml/anomaly_detectors/{job_id}/_open` +`POST _ml/anomaly_detectors/{job_id}/_open` ==== Description @@ -51,7 +51,7 @@ property: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_open +POST _ml/anomaly_detectors/total-requests/_open { "timeout": "35m" } diff --git a/docs/reference/ml/apis/post-calendar-event.asciidoc b/docs/reference/ml/apis/post-calendar-event.asciidoc index 998db409fc7d6..18481bda3b92b 100644 --- a/docs/reference/ml/apis/post-calendar-event.asciidoc +++ b/docs/reference/ml/apis/post-calendar-event.asciidoc @@ -10,7 +10,7 @@ Posts scheduled events in a calendar. ==== Request -`POST _xpack/ml/calendars//events` +`POST _ml/calendars//events` ==== Description @@ -43,7 +43,7 @@ You can add scheduled events to the `planned-outages` calendar as follows: [source,js] -------------------------------------------------- -POST _xpack/ml/calendars/planned-outages/events +POST _ml/calendars/planned-outages/events { "events" : [ {"description": "event 1", "start_time": 1513641600000, "end_time": 1513728000000}, diff --git a/docs/reference/ml/apis/post-data.asciidoc b/docs/reference/ml/apis/post-data.asciidoc index 6a5a3d3d6cb5e..2c07332ee521d 100644 --- a/docs/reference/ml/apis/post-data.asciidoc +++ b/docs/reference/ml/apis/post-data.asciidoc @@ -11,7 +11,7 @@ Sends data to an anomaly detection job for analysis. ==== Request -`POST _xpack/ml/anomaly_detectors//_data` +`POST _ml/anomaly_detectors//_data` ==== Description @@ -79,7 +79,7 @@ The following example posts data from the it_ops_new_kpi.json file to the `it_op [source,js] -------------------------------------------------- $ curl -s -H "Content-type: application/json" --X POST http:\/\/localhost:9200/_xpack/ml/anomaly_detectors/it_ops_new_kpi/_data +-X POST http:\/\/localhost:9200/_ml/anomaly_detectors/it_ops_new_kpi/_data --data-binary @it_ops_new_kpi.json -------------------------------------------------- diff --git a/docs/reference/ml/apis/preview-datafeed.asciidoc b/docs/reference/ml/apis/preview-datafeed.asciidoc index 7b9eccd9a5920..4b903ddb8af4e 100644 --- a/docs/reference/ml/apis/preview-datafeed.asciidoc +++ b/docs/reference/ml/apis/preview-datafeed.asciidoc @@ -11,7 +11,7 @@ Previews a {dfeed}. ==== Request -`GET _xpack/ml/datafeeds//_preview` +`GET _ml/datafeeds//_preview` ==== Description @@ -51,7 +51,7 @@ The following example obtains a preview of the `datafeed-farequote` {dfeed}: [source,js] -------------------------------------------------- -GET _xpack/ml/datafeeds/datafeed-farequote/_preview +GET _ml/datafeeds/datafeed-farequote/_preview -------------------------------------------------- // CONSOLE // TEST[skip:setup:farequote_datafeed] diff --git a/docs/reference/ml/apis/put-calendar-job.asciidoc b/docs/reference/ml/apis/put-calendar-job.asciidoc index 0563047043ae4..e7e878a043ea0 100644 --- a/docs/reference/ml/apis/put-calendar-job.asciidoc +++ b/docs/reference/ml/apis/put-calendar-job.asciidoc @@ -10,7 +10,7 @@ Adds a job to a calendar. ==== Request -`PUT _xpack/ml/calendars//jobs/` +`PUT _ml/calendars//jobs/` ==== Path Parameters @@ -36,7 +36,7 @@ The following example associates the `planned-outages` calendar with the [source,js] -------------------------------------------------- -PUT _xpack/ml/calendars/planned-outages/jobs/total-requests +PUT _ml/calendars/planned-outages/jobs/total-requests -------------------------------------------------- // CONSOLE // TEST[skip:setup:calendar_outages_openjob] diff --git a/docs/reference/ml/apis/put-calendar.asciidoc b/docs/reference/ml/apis/put-calendar.asciidoc index 06b8e55d7747c..385636b9a4473 100644 --- a/docs/reference/ml/apis/put-calendar.asciidoc +++ b/docs/reference/ml/apis/put-calendar.asciidoc @@ -10,7 +10,7 @@ Instantiates a calendar. ==== Request -`PUT _xpack/ml/calendars/` +`PUT _ml/calendars/` ===== Description @@ -42,7 +42,7 @@ The following example creates the `planned-outages` calendar: [source,js] -------------------------------------------------- -PUT _xpack/ml/calendars/planned-outages +PUT _ml/calendars/planned-outages -------------------------------------------------- // CONSOLE // TEST[skip:need-license] diff --git a/docs/reference/ml/apis/put-datafeed.asciidoc b/docs/reference/ml/apis/put-datafeed.asciidoc index 223b88760be52..5803cc03876d5 100644 --- a/docs/reference/ml/apis/put-datafeed.asciidoc +++ b/docs/reference/ml/apis/put-datafeed.asciidoc @@ -11,7 +11,7 @@ Instantiates a {dfeed}. ==== Request -`PUT _xpack/ml/datafeeds/` +`PUT _ml/datafeeds/` ==== Description @@ -105,7 +105,7 @@ The following example creates the `datafeed-total-requests` {dfeed}: [source,js] -------------------------------------------------- -PUT _xpack/ml/datafeeds/datafeed-total-requests +PUT _ml/datafeeds/datafeed-total-requests { "job_id": "total-requests", "indices": ["server-metrics"] @@ -137,4 +137,4 @@ When the {dfeed} is created, you receive the following results: } ---- // TESTRESPONSE[s/"query_delay": "83474ms"/"query_delay": $body.query_delay/] -// TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/] \ No newline at end of file +// TESTRESPONSE[s/"query.boost": "1.0"/"query.boost": $body.query.boost/] diff --git a/docs/reference/ml/apis/put-filter.asciidoc b/docs/reference/ml/apis/put-filter.asciidoc index 165fe9697584c..7a3202daa5430 100644 --- a/docs/reference/ml/apis/put-filter.asciidoc +++ b/docs/reference/ml/apis/put-filter.asciidoc @@ -10,7 +10,7 @@ Instantiates a filter. ==== Request -`PUT _xpack/ml/filters/` +`PUT _ml/filters/` ===== Description @@ -49,7 +49,7 @@ The following example creates the `safe_domains` filter: [source,js] -------------------------------------------------- -PUT _xpack/ml/filters/safe_domains +PUT _ml/filters/safe_domains { "description": "A list of safe domains", "items": ["*.google.com", "wikipedia.org"] diff --git a/docs/reference/ml/apis/put-job.asciidoc b/docs/reference/ml/apis/put-job.asciidoc index e28bf4f1758d3..7022b9b00847d 100644 --- a/docs/reference/ml/apis/put-job.asciidoc +++ b/docs/reference/ml/apis/put-job.asciidoc @@ -10,7 +10,7 @@ Instantiates a job. ==== Request -`PUT _xpack/ml/anomaly_detectors/` +`PUT _ml/anomaly_detectors/` //===== Description @@ -85,7 +85,7 @@ The following example creates the `total-requests` job: [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/total-requests +PUT _ml/anomaly_detectors/total-requests { "description" : "Total sum of requests", "analysis_config" : { diff --git a/docs/reference/ml/apis/revert-snapshot.asciidoc b/docs/reference/ml/apis/revert-snapshot.asciidoc index 48fc65edf90fa..dc9ea66b7fa55 100644 --- a/docs/reference/ml/apis/revert-snapshot.asciidoc +++ b/docs/reference/ml/apis/revert-snapshot.asciidoc @@ -10,7 +10,7 @@ Reverts to a specific snapshot. ==== Request -`POST _xpack/ml/anomaly_detectors//model_snapshots//_revert` +`POST _ml/anomaly_detectors//model_snapshots//_revert` ==== Description @@ -61,7 +61,7 @@ The following example reverts to the `1491856080` snapshot for the [source,js] -------------------------------------------------- POST -_xpack/ml/anomaly_detectors/it_ops_new_kpi/model_snapshots/1491856080/_revert +_ml/anomaly_detectors/it_ops_new_kpi/model_snapshots/1491856080/_revert { "delete_intervening_results": true } diff --git a/docs/reference/ml/apis/start-datafeed.asciidoc b/docs/reference/ml/apis/start-datafeed.asciidoc index 566e700dd043b..790e4027b38ac 100644 --- a/docs/reference/ml/apis/start-datafeed.asciidoc +++ b/docs/reference/ml/apis/start-datafeed.asciidoc @@ -12,7 +12,7 @@ A {dfeed} can be started and stopped multiple times throughout its lifecycle. ==== Request -`POST _xpack/ml/datafeeds//_start` +`POST _ml/datafeeds//_start` ==== Description @@ -95,7 +95,7 @@ The following example starts the `datafeed-it-ops-kpi` {dfeed}: [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-total-requests/_start +POST _ml/datafeeds/datafeed-total-requests/_start { "start": "2017-04-07T18:22:16Z" } @@ -110,4 +110,4 @@ When the {dfeed} starts, you receive the following results: "started": true } ---- -// TESTRESPONSE \ No newline at end of file +// TESTRESPONSE diff --git a/docs/reference/ml/apis/stop-datafeed.asciidoc b/docs/reference/ml/apis/stop-datafeed.asciidoc index 7ea48974f2df1..13cb04286076b 100644 --- a/docs/reference/ml/apis/stop-datafeed.asciidoc +++ b/docs/reference/ml/apis/stop-datafeed.asciidoc @@ -13,11 +13,11 @@ A {dfeed} can be started and stopped multiple times throughout its lifecycle. ==== Request -`POST _xpack/ml/datafeeds//_stop` + +`POST _ml/datafeeds//_stop` + -`POST _xpack/ml/datafeeds/,/_stop` + +`POST _ml/datafeeds/,/_stop` + -`POST _xpack/ml/datafeeds/_all/_stop` +`POST _ml/datafeeds/_all/_stop` ===== Description @@ -57,7 +57,7 @@ The following example stops the `datafeed-total-requests` {dfeed}: [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-total-requests/_stop +POST _ml/datafeeds/datafeed-total-requests/_stop { "timeout": "30s" } @@ -73,4 +73,4 @@ When the {dfeed} stops, you receive the following results: "stopped": true } ---- -// TESTRESPONSE \ No newline at end of file +// TESTRESPONSE diff --git a/docs/reference/ml/apis/update-datafeed.asciidoc b/docs/reference/ml/apis/update-datafeed.asciidoc index be55d864c871e..e8e0a94f596ab 100644 --- a/docs/reference/ml/apis/update-datafeed.asciidoc +++ b/docs/reference/ml/apis/update-datafeed.asciidoc @@ -10,7 +10,7 @@ Updates certain properties of a {dfeed}. ==== Request -`POST _xpack/ml/datafeeds//_update` +`POST _ml/datafeeds//_update` //===== Description @@ -97,7 +97,7 @@ The following example updates the query for the `datafeed-total-requests` [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-total-requests/_update +POST _ml/datafeeds/datafeed-total-requests/_update { "query": { "term": { diff --git a/docs/reference/ml/apis/update-filter.asciidoc b/docs/reference/ml/apis/update-filter.asciidoc index f551c8e923b89..4480563adee2d 100644 --- a/docs/reference/ml/apis/update-filter.asciidoc +++ b/docs/reference/ml/apis/update-filter.asciidoc @@ -10,7 +10,7 @@ Updates the description of a filter, adds items, or removes items. ==== Request -`POST _xpack/ml/filters//_update` +`POST _ml/filters//_update` //==== Description @@ -45,7 +45,7 @@ You can change the description, add and remove items to the `safe_domains` filte [source,js] -------------------------------------------------- -POST _xpack/ml/filters/safe_domains/_update +POST _ml/filters/safe_domains/_update { "description": "Updated list of domains", "add_items": ["*.myorg.com"], diff --git a/docs/reference/ml/apis/update-job.asciidoc b/docs/reference/ml/apis/update-job.asciidoc index 58bfb2679d935..f56252eada8b8 100644 --- a/docs/reference/ml/apis/update-job.asciidoc +++ b/docs/reference/ml/apis/update-job.asciidoc @@ -10,7 +10,7 @@ Updates certain properties of a job. ==== Request -`POST _xpack/ml/anomaly_detectors//_update` +`POST _ml/anomaly_detectors//_update` ==== Path Parameters @@ -99,7 +99,7 @@ The following example updates the `total-requests` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_update +POST _ml/anomaly_detectors/total-requests/_update { "description":"An updated job", "groups": ["group1","group2"], @@ -178,4 +178,4 @@ information, including the updated property values. For example: } ---- // TESTRESPONSE[s/"job_version": "7.0.0-alpha1"/"job_version": $body.job_version/] -// TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/] \ No newline at end of file +// TESTRESPONSE[s/"create_time": 1518808660505/"create_time": $body.create_time/] diff --git a/docs/reference/ml/apis/update-snapshot.asciidoc b/docs/reference/ml/apis/update-snapshot.asciidoc index b58eebe810fa1..8cac88fe30224 100644 --- a/docs/reference/ml/apis/update-snapshot.asciidoc +++ b/docs/reference/ml/apis/update-snapshot.asciidoc @@ -10,7 +10,7 @@ Updates certain properties of a snapshot. ==== Request -`POST _xpack/ml/anomaly_detectors//model_snapshots//_update` +`POST _ml/anomaly_detectors//model_snapshots//_update` //==== Description @@ -53,7 +53,7 @@ The following example updates the snapshot identified as `1491852978`: [source,js] -------------------------------------------------- POST -_xpack/ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update +_ml/anomaly_detectors/it_ops_new_logs/model_snapshots/1491852978/_update { "description": "Snapshot 1", "retain": true diff --git a/docs/reference/ml/apis/validate-detector.asciidoc b/docs/reference/ml/apis/validate-detector.asciidoc index e525b1a1b2008..94857955ac1ac 100644 --- a/docs/reference/ml/apis/validate-detector.asciidoc +++ b/docs/reference/ml/apis/validate-detector.asciidoc @@ -10,7 +10,7 @@ Validates detector configuration information. ==== Request -`POST _xpack/ml/anomaly_detectors/_validate/detector` +`POST _ml/anomaly_detectors/_validate/detector` ==== Description @@ -37,7 +37,7 @@ The following example validates detector configuration information: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/_validate/detector +POST _ml/anomaly_detectors/_validate/detector { "function": "metric", "field_name": "responsetime", @@ -54,4 +54,4 @@ When the validation completes, you receive the following results: "acknowledged": true } ---- -// TESTRESPONSE \ No newline at end of file +// TESTRESPONSE diff --git a/docs/reference/ml/apis/validate-job.asciidoc b/docs/reference/ml/apis/validate-job.asciidoc index b83260582602e..e06f3837a55ab 100644 --- a/docs/reference/ml/apis/validate-job.asciidoc +++ b/docs/reference/ml/apis/validate-job.asciidoc @@ -10,7 +10,7 @@ Validates job configuration information. ==== Request -`POST _xpack/ml/anomaly_detectors/_validate` +`POST _ml/anomaly_detectors/_validate` ==== Description @@ -37,7 +37,7 @@ The following example validates job configuration information: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/_validate +POST _ml/anomaly_detectors/_validate { "description" : "Unusual response times by airlines", "analysis_config" : { @@ -65,4 +65,4 @@ When the validation is complete, you receive the following results: "acknowledged": true } ---- -// TESTRESPONSE \ No newline at end of file +// TESTRESPONSE diff --git a/docs/reference/ml/categories.asciidoc b/docs/reference/ml/categories.asciidoc index 03ebc8af76ee6..a75bf2a2eed75 100644 --- a/docs/reference/ml/categories.asciidoc +++ b/docs/reference/ml/categories.asciidoc @@ -21,7 +21,7 @@ messages by using count or rare functions. For example: //Obtained from it_ops_new_app_logs.sh [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/it_ops_new_logs +PUT _ml/anomaly_detectors/it_ops_new_logs { "description" : "IT Ops Application Logs", "analysis_config" : { @@ -91,7 +91,7 @@ categorization field values are interpreted. For example: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/it_ops_new_logs2 +PUT _ml/anomaly_detectors/it_ops_new_logs2 { "description" : "IT Ops Application Logs", "analysis_config" : { @@ -153,7 +153,7 @@ equivalent to the following analyzer, which is defined using only built-in {es} [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/it_ops_new_logs3 +PUT _ml/anomaly_detectors/it_ops_new_logs3 { "description" : "IT Ops Application Logs", "analysis_config" : { diff --git a/docs/reference/ml/customurl.asciidoc b/docs/reference/ml/customurl.asciidoc index 95f4f5f938f0a..bb88d96ed5013 100644 --- a/docs/reference/ml/customurl.asciidoc +++ b/docs/reference/ml/customurl.asciidoc @@ -92,7 +92,7 @@ For example, the following API updates a job to add a custom URL that uses [source,js] ---------------------------------- -POST _xpack/ml/anomaly_detectors/sample_job/_update +POST _ml/anomaly_detectors/sample_job/_update { "custom_settings": { "custom_urls": [ diff --git a/docs/reference/ml/detector-custom-rules.asciidoc b/docs/reference/ml/detector-custom-rules.asciidoc index 02881f4cc4313..ac0af6217394e 100644 --- a/docs/reference/ml/detector-custom-rules.asciidoc +++ b/docs/reference/ml/detector-custom-rules.asciidoc @@ -32,7 +32,7 @@ We create our filter using the {ref}/ml-put-filter.html[put filter API]: [source,js] ---------------------------------- -PUT _xpack/ml/filters/safe_domains +PUT _ml/filters/safe_domains { "description": "Our list of safe domains", "items": ["safe.com", "trusted.com"] @@ -46,7 +46,7 @@ filter for the `highest_registered_domain` field: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/dns_exfiltration_with_rule +PUT _ml/anomaly_detectors/dns_exfiltration_with_rule { "analysis_config" : { "bucket_span":"5m", @@ -79,7 +79,7 @@ domains that we want to add in the filter. We can do that by using the [source,js] ---------------------------------- -POST _xpack/ml/filters/safe_domains/_update +POST _ml/filters/safe_domains/_update { "add_items": ["another-safe.com"] } @@ -94,7 +94,7 @@ In the following example we scope multiple fields: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/scoping_multiple_fields +PUT _ml/anomaly_detectors/scoping_multiple_fields { "analysis_config" : { "bucket_span":"5m", @@ -144,7 +144,7 @@ utilization is less than 0.20. [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/cpu_with_rule +PUT _ml/anomaly_detectors/cpu_with_rule { "analysis_config" : { "bucket_span":"5m", @@ -180,7 +180,7 @@ is greater than 30 and less than 50: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/rule_with_range +PUT _ml/anomaly_detectors/rule_with_range { "analysis_config" : { "bucket_span":"5m", diff --git a/docs/reference/ml/functions/count.asciidoc b/docs/reference/ml/functions/count.asciidoc index abbbd118ffebf..3365a0923a8b0 100644 --- a/docs/reference/ml/functions/count.asciidoc +++ b/docs/reference/ml/functions/count.asciidoc @@ -45,7 +45,7 @@ see {ref}/ml-job-resource.html#ml-detectorconfig[Detector Configuration Objects] .Example 1: Analyzing events with the count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example1 +PUT _ml/anomaly_detectors/example1 { "analysis_config": { "detectors": [{ @@ -71,7 +71,7 @@ and detects when the event rate is unusual compared to its past behavior. .Example 2: Analyzing errors with the high_count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example2 +PUT _ml/anomaly_detectors/example2 { "analysis_config": { "detectors": [{ @@ -97,7 +97,7 @@ unusually high count of error codes compared to other users. .Example 3: Analyzing status codes with the low_count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example3 +PUT _ml/anomaly_detectors/example3 { "analysis_config": { "detectors": [{ @@ -124,7 +124,7 @@ compared to its past behavior. .Example 4: Analyzing aggregated data with the count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example4 +PUT _ml/anomaly_detectors/example4 { "analysis_config": { "summary_count_field_name" : "events_per_min", @@ -189,7 +189,7 @@ The `non_zero_count` function models only the following data: .Example 5: Analyzing signatures with the high_non_zero_count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example5 +PUT _ml/anomaly_detectors/example5 { "analysis_config": { "detectors": [{ @@ -243,7 +243,7 @@ see {ref}/ml-job-resource.html#ml-detectorconfig[Detector Configuration Objects] .Example 6: Analyzing users with the distinct_count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example6 +PUT _ml/anomaly_detectors/example6 { "analysis_config": { "detectors": [{ @@ -268,7 +268,7 @@ users is unusual compared to the past. .Example 7: Analyzing ports with the high_distinct_count function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example7 +PUT _ml/anomaly_detectors/example7 { "analysis_config": { "detectors": [{ diff --git a/docs/reference/ml/functions/geo.asciidoc b/docs/reference/ml/functions/geo.asciidoc index 461ab825ff5b2..3698ab7c0590e 100644 --- a/docs/reference/ml/functions/geo.asciidoc +++ b/docs/reference/ml/functions/geo.asciidoc @@ -31,7 +31,7 @@ see {ref}/ml-job-resource.html#ml-detectorconfig[Detector Configuration Objects] .Example 1: Analyzing transactions with the lat_long function [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/example1 +PUT _ml/anomaly_detectors/example1 { "analysis_config": { "detectors": [{ @@ -79,7 +79,7 @@ format. For example, the following Painless script transforms [source,js] -------------------------------------------------- -PUT _xpack/ml/datafeeds/datafeed-test2 +PUT _ml/datafeeds/datafeed-test2 { "job_id": "farequote", "indices": ["farequote"], diff --git a/docs/reference/ml/populations.asciidoc b/docs/reference/ml/populations.asciidoc index bd4e231706831..df1771039c098 100644 --- a/docs/reference/ml/populations.asciidoc +++ b/docs/reference/ml/populations.asciidoc @@ -28,7 +28,7 @@ To specify the population, use the `over_field_name` property. For example: [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/population +PUT _ml/anomaly_detectors/population { "description" : "Population analysis", "analysis_config" : { diff --git a/docs/reference/ml/stopping-ml.asciidoc b/docs/reference/ml/stopping-ml.asciidoc index 17505a02d1521..2b50294e3bcb4 100644 --- a/docs/reference/ml/stopping-ml.asciidoc +++ b/docs/reference/ml/stopping-ml.asciidoc @@ -25,7 +25,7 @@ request stops the `feed1` {dfeed}: [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-total-requests/_stop +POST _ml/datafeeds/datafeed-total-requests/_stop -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_startdf] @@ -46,7 +46,7 @@ If you are upgrading your cluster, you can use the following request to stop all [source,js] ---------------------------------- -POST _xpack/ml/datafeeds/_all/_stop +POST _ml/datafeeds/_all/_stop ---------------------------------- // CONSOLE // TEST[skip:needs-licence] @@ -65,7 +65,7 @@ example, the following request closes the `job1` job: [source,js] -------------------------------------------------- -POST _xpack/ml/anomaly_detectors/total-requests/_close +POST _ml/anomaly_detectors/total-requests/_close -------------------------------------------------- // CONSOLE // TEST[skip:setup:server_metrics_openjob] @@ -84,7 +84,7 @@ all open jobs on the cluster: [source,js] ---------------------------------- -POST _xpack/ml/anomaly_detectors/_all/_close +POST _ml/anomaly_detectors/_all/_close ---------------------------------- // CONSOLE // TEST[skip:needs-licence] diff --git a/docs/reference/ml/transforms.asciidoc b/docs/reference/ml/transforms.asciidoc index 5273a26c204e3..566f3685513bd 100644 --- a/docs/reference/ml/transforms.asciidoc +++ b/docs/reference/ml/transforms.asciidoc @@ -105,7 +105,7 @@ version of the same field, use multi-fields. For more information, see .Example 1: Adding two numerical fields [source,js] ---------------------------------- -PUT _xpack/ml/anomaly_detectors/test1 +PUT _ml/anomaly_detectors/test1 { "analysis_config":{ "bucket_span": "10m", @@ -123,7 +123,7 @@ PUT _xpack/ml/anomaly_detectors/test1 } } -PUT _xpack/ml/datafeeds/datafeed-test1 +PUT _ml/datafeeds/datafeed-test1 { "job_id": "test1", "indices": ["my_index"], @@ -160,7 +160,7 @@ You can preview the contents of the {dfeed} by using the following API: [source,js] ---------------------------------- -GET _xpack/ml/datafeeds/datafeed-test1/_preview +GET _ml/datafeeds/datafeed-test1/_preview ---------------------------------- // CONSOLE // TEST[skip:continued] @@ -211,7 +211,7 @@ that convert your strings to upper or lowercase letters. .Example 2: Concatenating strings [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/test2 +PUT _ml/anomaly_detectors/test2 { "analysis_config":{ "bucket_span": "10m", @@ -229,7 +229,7 @@ PUT _xpack/ml/anomaly_detectors/test2 } } -PUT _xpack/ml/datafeeds/datafeed-test2 +PUT _ml/datafeeds/datafeed-test2 { "job_id": "test2", "indices": ["my_index"], @@ -249,7 +249,7 @@ PUT _xpack/ml/datafeeds/datafeed-test2 } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:needs-licence] @@ -274,7 +274,7 @@ and "SMITH " have been concatenated and an underscore was added: .Example 3: Trimming strings [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-test2/_update +POST _ml/datafeeds/datafeed-test2/_update { "script_fields": { "my_script_field": { @@ -286,7 +286,7 @@ POST _xpack/ml/datafeeds/datafeed-test2/_update } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:continued] @@ -310,7 +310,7 @@ has been trimmed to "SMITH": .Example 4: Converting strings to lowercase [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-test2/_update +POST _ml/datafeeds/datafeed-test2/_update { "script_fields": { "my_script_field": { @@ -322,7 +322,7 @@ POST _xpack/ml/datafeeds/datafeed-test2/_update } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:continued] @@ -347,7 +347,7 @@ has been converted to "joe": .Example 5: Converting strings to mixed case formats [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-test2/_update +POST _ml/datafeeds/datafeed-test2/_update { "script_fields": { "my_script_field": { @@ -359,7 +359,7 @@ POST _xpack/ml/datafeeds/datafeed-test2/_update } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:continued] @@ -384,7 +384,7 @@ has been converted to "Joe": .Example 6: Replacing tokens [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-test2/_update +POST _ml/datafeeds/datafeed-test2/_update { "script_fields": { "my_script_field": { @@ -396,7 +396,7 @@ POST _xpack/ml/datafeeds/datafeed-test2/_update } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:continued] @@ -420,7 +420,7 @@ The preview {dfeed} API returns the following results, which show that .Example 7: Regular expression matching and concatenation [source,js] -------------------------------------------------- -POST _xpack/ml/datafeeds/datafeed-test2/_update +POST _ml/datafeeds/datafeed-test2/_update { "script_fields": { "my_script_field": { @@ -432,7 +432,7 @@ POST _xpack/ml/datafeeds/datafeed-test2/_update } } -GET _xpack/ml/datafeeds/datafeed-test2/_preview +GET _ml/datafeeds/datafeed-test2/_preview -------------------------------------------------- // CONSOLE // TEST[skip:continued] @@ -457,7 +457,7 @@ The preview {dfeed} API returns the following results, which show that .Example 8: Splitting strings by domain name [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/test3 +PUT _ml/anomaly_detectors/test3 { "description":"DNS tunneling", "analysis_config":{ @@ -478,7 +478,7 @@ PUT _xpack/ml/anomaly_detectors/test3 } } -PUT _xpack/ml/datafeeds/datafeed-test3 +PUT _ml/datafeeds/datafeed-test3 { "job_id": "test3", "indices": ["my_index"], @@ -498,7 +498,7 @@ PUT _xpack/ml/datafeeds/datafeed-test3 } } -GET _xpack/ml/datafeeds/datafeed-test3/_preview +GET _ml/datafeeds/datafeed-test3/_preview -------------------------------------------------- // CONSOLE // TEST[skip:needs-licence] @@ -530,7 +530,7 @@ The preview {dfeed} API returns the following results, which show that .Example 9: Transforming geo_point data [source,js] -------------------------------------------------- -PUT _xpack/ml/anomaly_detectors/test4 +PUT _ml/anomaly_detectors/test4 { "analysis_config":{ "bucket_span": "10m", @@ -547,7 +547,7 @@ PUT _xpack/ml/anomaly_detectors/test4 } } -PUT _xpack/ml/datafeeds/datafeed-test4 +PUT _ml/datafeeds/datafeed-test4 { "job_id": "test4", "indices": ["my_index"], @@ -567,7 +567,7 @@ PUT _xpack/ml/datafeeds/datafeed-test4 } } -GET _xpack/ml/datafeeds/datafeed-test4/_preview +GET _ml/datafeeds/datafeed-test4/_preview -------------------------------------------------- // CONSOLE // TEST[skip:needs-licence] diff --git a/docs/reference/monitoring/collectors.asciidoc b/docs/reference/monitoring/collectors.asciidoc index bd48d1287006a..bc77480561a8d 100644 --- a/docs/reference/monitoring/collectors.asciidoc +++ b/docs/reference/monitoring/collectors.asciidoc @@ -67,7 +67,7 @@ routing table without any network timeout issues unlike most other collectors. Each shard is represented by a separate monitoring document. | Jobs | `job_stats` | Gathers details about all machine learning job statistics (for example, -`GET /_xpack/ml/anomaly_detectors/_stats`). +`GET /_ml/anomaly_detectors/_stats`). + This information only needs to be collected once, so it is collected on the _elected_ master node. However, for the master node to be able to perform the diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java index 62746834281c4..cecdb0a6a2d2f 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/XPackIT.java @@ -83,10 +83,10 @@ public void testTrialLicense() throws IOException { client().performRequest(startTrial); String noJobs = EntityUtils.toString( - client().performRequest(new Request("GET", "/_xpack/ml/anomaly_detectors")).getEntity()); + client().performRequest(new Request("GET", "/_ml/anomaly_detectors")).getEntity()); assertEquals("{\"count\":0,\"jobs\":[]}", noJobs); - Request createJob = new Request("PUT", "/_xpack/ml/anomaly_detectors/test_job"); + Request createJob = new Request("PUT", "/_ml/anomaly_detectors/test_job"); createJob.setJsonEntity( "{\n" + " \"analysis_config\" : {\n" diff --git a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/integration/MlRestTestStateCleaner.java b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/integration/MlRestTestStateCleaner.java index 50500f0e9399e..46d7c5b9e43da 100644 --- a/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/integration/MlRestTestStateCleaner.java +++ b/x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/integration/MlRestTestStateCleaner.java @@ -34,7 +34,7 @@ public void clearMlMetadata() throws IOException { @SuppressWarnings("unchecked") private void deleteAllDatafeeds() throws IOException { - final Request datafeedsRequest = new Request("GET", "/_xpack/ml/datafeeds"); + final Request datafeedsRequest = new Request("GET", "/_ml/datafeeds"); datafeedsRequest.addParameter("filter_path", "datafeeds"); final Response datafeedsResponse = adminClient.performRequest(datafeedsRequest); final List> datafeeds = @@ -44,11 +44,11 @@ private void deleteAllDatafeeds() throws IOException { } try { - adminClient.performRequest(new Request("POST", "/_xpack/ml/datafeeds/_all/_stop")); + adminClient.performRequest(new Request("POST", "/_ml/datafeeds/_all/_stop")); } catch (Exception e1) { logger.warn("failed to stop all datafeeds. Forcing stop", e1); try { - adminClient.performRequest(new Request("POST", "/_xpack/ml/datafeeds/_all/_stop?force=true")); + adminClient.performRequest(new Request("POST", "/_ml/datafeeds/_all/_stop?force=true")); } catch (Exception e2) { logger.warn("Force-closing all data feeds failed", e2); } @@ -58,12 +58,12 @@ private void deleteAllDatafeeds() throws IOException { for (Map datafeed : datafeeds) { String datafeedId = (String) datafeed.get("datafeed_id"); - adminClient.performRequest(new Request("DELETE", "/_xpack/ml/datafeeds/" + datafeedId)); + adminClient.performRequest(new Request("DELETE", "/_ml/datafeeds/" + datafeedId)); } } private void deleteAllJobs() throws IOException { - final Request jobsRequest = new Request("GET", "/_xpack/ml/anomaly_detectors"); + final Request jobsRequest = new Request("GET", "/_ml/anomaly_detectors"); jobsRequest.addParameter("filter_path", "jobs"); final Response response = adminClient.performRequest(jobsRequest); @SuppressWarnings("unchecked") @@ -74,11 +74,11 @@ private void deleteAllJobs() throws IOException { } try { - adminClient.performRequest(new Request("POST", "/_xpack/ml/anomaly_detectors/_all/_close")); + adminClient.performRequest(new Request("POST", "/_ml/anomaly_detectors/_all/_close")); } catch (Exception e1) { logger.warn("failed to close all jobs. Forcing closed", e1); try { - adminClient.performRequest(new Request("POST", "/_xpack/ml/anomaly_detectors/_all/_close?force=true")); + adminClient.performRequest(new Request("POST", "/_ml/anomaly_detectors/_all/_close?force=true")); } catch (Exception e2) { logger.warn("Force-closing all jobs failed", e2); } @@ -88,7 +88,7 @@ private void deleteAllJobs() throws IOException { for (Map jobConfig : jobConfigs) { String jobId = (String) jobConfig.get("job_id"); - adminClient.performRequest(new Request("DELETE", "/_xpack/ml/anomaly_detectors/" + jobId)); + adminClient.performRequest(new Request("DELETE", "/_ml/anomaly_detectors/" + jobId)); } } } diff --git a/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java b/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java index 170b4f14486bc..b3485b266d877 100644 --- a/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java +++ b/x-pack/plugin/ml/qa/disabled/src/test/java/org/elasticsearch/xpack/ml/integration/MlPluginDisabledIT.java @@ -58,6 +58,8 @@ public void testActionsFail() throws Exception { Request request = new Request("PUT", MachineLearning.BASE_PATH + "anomaly_detectors/foo"); request.setJsonEntity(Strings.toString(xContentBuilder)); ResponseException exception = expectThrows(ResponseException.class, () -> client().performRequest(request)); - assertThat(exception.getMessage(), containsString("no handler found for uri [/_xpack/ml/anomaly_detectors/foo] and method [PUT]")); + assertThat(exception.getMessage(), containsString("method [PUT]")); + assertThat(exception.getMessage(), containsString("URI [/_ml/anomaly_detectors/foo]")); + assertThat(exception.getMessage(), containsString("400 Bad Request")); } } diff --git a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java index 9825189ba64cd..37c44b6ecf073 100644 --- a/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java +++ b/x-pack/plugin/ml/qa/native-multi-node-tests/src/test/java/org/elasticsearch/xpack/ml/integration/DatafeedJobsRestIT.java @@ -955,7 +955,7 @@ public void testRealtime() throws Exception { assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(EntityUtils.toString(response.getEntity()), equalTo("{\"stopped\":true}")); - client().performRequest(new Request("POST", "/_xpack/ml/anomaly_detectors/" + jobId + "/_close")); + client().performRequest(new Request("POST", "/_ml/anomaly_detectors/" + jobId + "/_close")); response = client().performRequest(new Request("DELETE", MachineLearning.BASE_PATH + "datafeeds/" + datafeedId)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); @@ -992,7 +992,7 @@ public void testForceDeleteWhileDatafeedIsRunning() throws Exception { assertThat(EntityUtils.toString(response.getEntity()), equalTo("{\"acknowledged\":true}")); expectThrows(ResponseException.class, - () -> client().performRequest(new Request("GET", "/_xpack/ml/datafeeds/" + datafeedId))); + () -> client().performRequest(new Request("GET", "/_ml/datafeeds/" + datafeedId))); } private class LookbackOnlyTestHelper { 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 233e697407ff6..19650b348a2eb 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 @@ -244,7 +244,8 @@ public class MachineLearning extends Plugin implements ActionPlugin, AnalysisPlugin, PersistentTaskPlugin { public static final String NAME = "ml"; - public static final String BASE_PATH = "/_xpack/ml/"; + public static final String BASE_PATH = "/_ml/"; + public static final String PRE_V7_BASE_PATH = "/_xpack/ml/"; public static final String DATAFEED_THREAD_POOL_NAME = NAME + "_datafeed"; public static final String AUTODETECT_THREAD_POOL_NAME = NAME + "_autodetect"; 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 3939efed54001..b3b6d43229e0e 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -16,16 +18,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteExpiredDataAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteExpiredDataAction.class)); + public RestDeleteExpiredDataAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "_delete_expired_data", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "_delete_expired_data", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_expired_data_action"; + return "ml_delete_expired_data_action"; } @Override diff --git a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java index 0528c30e059c2..5810a2e929daa 100644 --- a/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java +++ b/x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/rest/RestFindFileStructureAction.java @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; @@ -23,18 +25,26 @@ import java.util.Set; import java.util.concurrent.TimeUnit; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestFindFileStructureAction extends BaseRestHandler { private static final TimeValue DEFAULT_TIMEOUT = new TimeValue(25, TimeUnit.SECONDS); + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestFindFileStructureAction.class)); + public RestFindFileStructureAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "find_file_structure", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "find_file_structure", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "find_file_structure", deprecationLogger); } @Override public String getName() { - return "xpack_ml_find_file_structure_action"; + return "ml_find_file_structure_action"; } @Override 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 ddb15086e2a90..3ffdf03ed63e6 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -16,16 +18,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestMlInfoAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestMlInfoAction.class)); + public RestMlInfoAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "info", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "info", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "info", deprecationLogger); } @Override public String getName() { - return "xpack_ml_info_action"; + return "ml_info_action"; } @Override 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 58b6e4adc10e9..2ab68052d8ee1 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -17,17 +19,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteCalendarAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarAction.class)); + public RestDeleteCalendarAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_calendar_action"; + return "ml_delete_calendar_action"; } @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 9b89aadec2583..446c642ca0a0a 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,18 +20,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteCalendarEventAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarEventAction.class)); + public RestDeleteCalendarEventAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + - ScheduledEvent.EVENT_ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + + ScheduledEvent.EVENT_ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" + + ScheduledEvent.EVENT_ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_calendar_event_action"; + return "ml_delete_calendar_event_action"; } @Override 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 ee3c797216e61..ca7993d9cf07f 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,18 +20,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteCalendarJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteCalendarJobAction.class)); + public RestDeleteCalendarJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_calendar_job_action"; + return "ml_delete_calendar_job_action"; } @Override 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 185164ad09488..e958b329e453d 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -20,16 +22,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetCalendarEventsAction extends BaseRestHandler { + + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetCalendarEventsAction.class)); + public RestGetCalendarEventsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_calendar_events_action"; + return "ml_get_calendar_events_action"; } @Override 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 80fb6b02eb7de..190111f5bc513 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -20,23 +22,36 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetCalendarsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetCalendarsAction.class)); + public RestGetCalendarsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "calendars/{" + - Calendar.ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "calendars/", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "calendars/", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger); // endpoints that support body parameters must also accept POST - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "calendars/{" + - Calendar.ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "calendars/", this); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "calendars/", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_calendars_action"; + return "ml_get_calendars_action"; } @Override 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 5d0b8aa7f3d62..3c0092b9c2219 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestPostCalendarEventAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPostCalendarEventAction.class)); + public RestPostCalendarEventAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events", deprecationLogger); } @Override public String getName() { - return "xpack_ml_post_calendar_event_action"; + return "ml_post_calendar_event_action"; } @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 4e86770fa92cd..aa14f302804c7 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -19,17 +21,24 @@ import java.io.IOException; import java.util.Collections; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutCalendarAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPutCalendarAction.class)); + public RestPutCalendarAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.PUT, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", this, + PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_put_calendar_action"; + return "ml_put_calendar_action"; } @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 eea0197b2d88f..164218820e4b5 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.calendar; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,18 +20,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutCalendarJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPutCalendarJobAction.class)); + public RestPutCalendarJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.PUT, - MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + - Job.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", this, + PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + + Job.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_put_calendar_job_action"; + return "ml_put_calendar_job_action"; } @Override 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 ca275f0844148..07dcfd0034857 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteDatafeedAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteDatafeedAction.class)); + public RestDeleteDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, MachineLearning.BASE_PATH + "datafeeds/{" - + DatafeedConfig.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_datafeed_action"; + return "ml_delete_datafeed_action"; } @Override 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 0ec179be42f96..d31594e164222 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,19 +20,27 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetDatafeedStatsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetDatafeedStatsAction.class)); + public RestGetDatafeedStatsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "datafeeds/_stats", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "datafeeds/_stats", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/_stats", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_datafeed_stats_action"; + return "ml_get_datafeed_stats_action"; } @Override 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 354731d21c62b..31b2256c0c624 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -17,19 +19,27 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetDatafeedsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetDatafeedsAction.class)); + public RestGetDatafeedsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "datafeeds", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "datafeeds", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_datafeeds_action"; + return "ml_get_datafeeds_action"; } @Override 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 8436d257ce8f2..9c8b562267fe1 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -17,17 +19,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestPreviewDatafeedAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPreviewDatafeedAction.class)); + public RestPreviewDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview", deprecationLogger); } @Override public String getName() { - return "xpack_ml_preview_datafeed_action"; + return "ml_preview_datafeed_action"; } @Override 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 1bc8da7b57ef0..fb7e7d25b1d29 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutDatafeedAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPutDatafeedAction.class)); + public RestPutDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.PUT, MachineLearning.BASE_PATH + "datafeeds/{" - + DatafeedConfig.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", this, + PUT, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_put_datafeed_action"; + return "ml_put_datafeed_action"; } @Override 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 07906a49c280f..1802158284ab5 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -24,19 +26,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStartDatafeedAction extends BaseRestHandler { private static final String DEFAULT_START = "0"; + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestStartDatafeedAction.class)); + public RestStartDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start", deprecationLogger); } @Override public String getName() { - return "xpack_ml_start_datafeed_action"; + return "ml_start_datafeed_action"; } @Override 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 5015df58e7972..2eb34d7786dd5 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -24,17 +26,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestStopDatafeedAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestStopDatafeedAction.class)); + public RestStopDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "datafeeds/{" - + DatafeedConfig.ID.getPreferredName() + "}/_stop", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop", deprecationLogger); } @Override public String getName() { - return "xpack_ml_stop_datafeed_action"; + return "ml_stop_datafeed_action"; } @Override 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 ae44f18e5d1fb..06c887c7beeb1 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.datafeeds; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestUpdateDatafeedAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestUpdateDatafeedAction.class)); + public RestUpdateDatafeedAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "datafeeds/{" - + DatafeedConfig.ID.getPreferredName() + "}/_update", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_update", deprecationLogger); } @Override public String getName() { - return "xpack_ml_update_datafeed_action"; + return "ml_update_datafeed_action"; } @Override 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 f3cfc6d1d6cc9..44ede7e75eca7 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.filter; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -17,17 +19,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteFilterAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteFilterAction.class)); + public RestDeleteFilterAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, - MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + Request.FILTER_ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_filter_action"; + return "ml_delete_filter_action"; } @Override 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 c62b3258e6d3b..c89cd861ae832 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.filter; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -19,18 +21,27 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetFiltersAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetFiltersAction.class)); + public RestGetFiltersAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", - this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "filters/", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "filters/", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "filters/", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_filters_action"; + return "ml_get_filters_action"; } @Override 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 bbc756e279f27..098a18cb724e3 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.filter; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutFilterAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPutFilterAction.class)); + public RestPutFilterAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.PUT, - MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + PUT, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", this, + PUT, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_put_filter_action"; + return "ml_put_filter_action"; } @Override 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 80acf3d7e4e35..68f1d40d1f6da 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.filter; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestUpdateFilterAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestUpdateFilterAction.class)); + public RestUpdateFilterAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "filters/{" + MlFilter.ID.getPreferredName() + "}/_update", deprecationLogger); } @Override public String getName() { - return "xpack_ml_update_filter_action"; + return "ml_update_filter_action"; } @Override 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 ae6257d53850f..2d477778b2dab 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; @@ -19,17 +21,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestCloseJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestCloseJobAction.class)); + public RestCloseJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", deprecationLogger); } @Override public String getName() { - return "xpack_ml_close_job_action"; + return "ml_close_job_action"; } @Override 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 e42a73204eb3c..c3316b702552e 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -19,20 +21,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteForecastAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteForecastAction.class)); + public RestDeleteForecastAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, - MachineLearning.BASE_PATH + - "anomaly_detectors/{" + Job.ID.getPreferredName() + - "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", - this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/_forecast/{" + Forecast.FORECAST_ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_forecast_action"; + return "ml_delete_forecast_action"; } @Override 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 3a76b71980bec..62494a03f9c52 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; @@ -23,17 +25,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteJobAction.class)); + public RestDeleteJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_job_action"; + return "ml_delete_job_action"; } @Override 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 11c51fffb3c61..8503408cd3818 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,23 +20,30 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestFlushJobAction extends BaseRestHandler { - private final boolean DEFAULT_CALC_INTERIM = false; - private final String DEFAULT_START = ""; - private final String DEFAULT_END = ""; - private final String DEFAULT_ADVANCE_TIME = ""; - private final String DEFAULT_SKIP_TIME = ""; + private static final boolean DEFAULT_CALC_INTERIM = false; + private static final String DEFAULT_START = ""; + private static final String DEFAULT_END = ""; + private static final String DEFAULT_ADVANCE_TIME = ""; + private static final String DEFAULT_SKIP_TIME = ""; + + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestFlushJobAction.class)); public RestFlushJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", deprecationLogger); } @Override public String getName() { - return "xpack_ml_flush_job_action"; + return "ml_flush_job_action"; } @Override 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 a67f9f31aaed4..5fb0bfa549942 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestForecastJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestForecastJobAction.class)); + public RestForecastJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_forecast", deprecationLogger); } @Override public String getName() { - return "xpack_ml_forecast_job_action"; + return "ml_forecast_job_action"; } @Override 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 b35629e72e7a4..7fe908c131a50 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 @@ -5,9 +5,11 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -19,19 +21,27 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetJobStatsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetJobStatsAction.class)); + public RestGetJobStatsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "anomaly_detectors/_stats", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/_stats", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_stats", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_job_stats_action"; + return "ml_get_job_stats_action"; } @Override 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 ed6f20d989948..c791dfeeb8837 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 @@ -5,9 +5,11 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -19,20 +21,28 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; + public class RestGetJobsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetJobsAction.class)); + public RestGetJobsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH - + "anomaly_detectors", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_jobs_action"; + return "ml_get_jobs_action"; } @Override 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 4da4e540307b3..53aee5130e502 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -23,17 +25,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestOpenJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestOpenJobAction.class)); + public RestOpenJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", deprecationLogger); } @Override public String getName() { - return "xpack_ml_open_job_action"; + return "ml_open_job_action"; } @Override 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 b7095c6fbfcc0..5de9028acd08b 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -17,20 +19,27 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestPostDataAction extends BaseRestHandler { private static final String DEFAULT_RESET_START = ""; private static final String DEFAULT_RESET_END = ""; + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPostDataAction.class)); + public RestPostDataAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH - + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_data", deprecationLogger); } @Override public String getName() { - return "xpack_ml_post_data_action"; + return "ml_post_data_action"; } @Override @@ -47,4 +56,4 @@ protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient public boolean supportsContentStream() { return true; } -} \ No newline at end of file +} 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 f0937bdae58a0..f4e1d7ecfe4ec 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,16 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestPostJobUpdateAction extends BaseRestHandler { + + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPostJobUpdateAction.class)); + public RestPostJobUpdateAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_update", deprecationLogger); } @Override public String getName() { - return "xpack_ml_post_job_update_action"; + return "ml_post_job_update_action"; } @Override 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 14b76bbe59954..a7afcf15b2d5e 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.job; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,17 +20,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.PUT; + public class RestPutJobAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestPutJobAction.class)); + public RestPutJobAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.PUT, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + PUT, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this, + PUT, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_put_job_action"; + return "ml_put_job_action"; } @Override 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 8e0a3f5b40bbd..b4a2de4570a26 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.modelsnapshots; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -18,17 +20,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.DELETE; + public class RestDeleteModelSnapshotAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestDeleteModelSnapshotAction.class)); + public RestDeleteModelSnapshotAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + DELETE, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", this, + DELETE, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); } @Override public String getName() { - return "xpack_ml_delete_model_snapshot_action"; + return "ml_delete_model_snapshot_action"; } @Override 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 5b4895f6bbbfe..6286c931713d1 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.modelsnapshots; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -20,36 +22,55 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetModelSnapshotsAction extends BaseRestHandler { - private final String ALL = "_all"; - private final String ALL_SNAPSHOT_IDS = null; + private static final String ALL = "_all"; + private static final String ALL_SNAPSHOT_IDS = null; // Even though these are null, setting up the defaults in case // we want to change them later - private final String DEFAULT_SORT = null; - private final String DEFAULT_START = null; - private final String DEFAULT_END = null; - private final boolean DEFAULT_DESC_ORDER = true; + private static final String DEFAULT_SORT = null; + private static final String DEFAULT_START = null; + private static final String DEFAULT_END = null; + private static final boolean DEFAULT_DESC_ORDER = true; + + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetModelSnapshotsAction.class)); public RestGetModelSnapshotsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); // endpoints that support body parameters must also accept POST - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + Request.SNAPSHOT_ID.getPreferredName() + "}", deprecationLogger); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", this); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", deprecationLogger); // endpoints that support body parameters must also accept POST - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots", this); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_model_snapshot_action"; + return "ml_get_model_snapshot_action"; } @Override 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 3939991cf1572..48b89abde6c78 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.modelsnapshots; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -18,20 +20,28 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestRevertModelSnapshotAction extends BaseRestHandler { - private final boolean DELETE_INTERVENING_DEFAULT = false; + private static final boolean DELETE_INTERVENING_DEFAULT = false; + + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestRevertModelSnapshotAction.class)); public RestRevertModelSnapshotAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + - RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/model_snapshots/{" + + RevertModelSnapshotAction.Request.SNAPSHOT_ID.getPreferredName() + "}/_revert", deprecationLogger); } @Override public String getName() { - return "xpack_ml_revert_model_snapshot_action"; + return "ml_revert_model_snapshot_action"; } @Override 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 b428f43b55ef6..98990edffd38c 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.modelsnapshots; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -19,18 +21,26 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestUpdateModelSnapshotAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestUpdateModelSnapshotAction.class)); + public RestUpdateModelSnapshotAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", - this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + + Job.ID.getPreferredName() + "}/model_snapshots/{" + ModelSnapshotField.SNAPSHOT_ID +"}/_update", deprecationLogger); } @Override public String getName() { - return "xpack_ml_update_model_snapshot_action"; + return "ml_update_model_snapshot_action"; } @Override 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 9783870acc43b..47f8c8a85cce0 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 @@ -5,8 +5,10 @@ */ package org.elasticsearch.xpack.ml.rest.results; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -21,26 +23,43 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetBucketsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetBucketsAction.class)); + public RestGetBucketsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() - + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets/{" + Result.TIMESTAMP.getPreferredName() + "}", deprecationLogger); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", this); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", this); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + + "}/results/buckets", deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_buckets_action"; + return "ml_get_buckets_action"; } @Override 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 e8a74575197b7..900acec1b5a6d 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.results; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -20,26 +22,43 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetCategoriesAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetCategoriesAction.class)); + public RestGetCategoriesAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + deprecationLogger); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" - + Request.CATEGORY_ID.getPreferredName() + "}", this); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", this); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories/{" + + Request.CATEGORY_ID.getPreferredName() + "}", deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categories", + deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_catagories_action"; + return "ml_get_catagories_action"; } @Override 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 53794c7a45b06..ee15150a0b944 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.results; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -19,20 +21,33 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetInfluencersAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetInfluencersAction.class)); + public RestGetInfluencersAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + deprecationLogger); // endpoints that support body parameters must also accept POST - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", this); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", + deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_influencers_action"; + return "ml_get_influencers_action"; } @Override 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 bf4121c3ec7ed..49087024012ed 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.results; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -19,19 +21,32 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetOverallBucketsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetOverallBucketsAction.class)); + public RestGetOverallBucketsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", this); - controller.registerHandler(RestRequest.Method.POST, - MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/overall_buckets", + deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_overall_buckets_action"; + return "ml_get_overall_buckets_action"; } @Override 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 c7e571f2cdce3..d8f06283c591c 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.results; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -19,19 +21,32 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.GET; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestGetRecordsAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestGetRecordsAction.class)); + public RestGetRecordsAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/results/records", this); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" - + Job.ID.getPreferredName() + "}/results/records", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + GET, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + this, + GET, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + deprecationLogger); + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/records", + deprecationLogger); } @Override public String getName() { - return "xpack_ml_get_records_action"; + return "ml_get_records_action"; } @Override 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 d611d1d956f4b..c24cb63380a26 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.validate; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -17,16 +19,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestValidateDetectorAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestValidateDetectorAction.class)); + public RestValidateDetectorAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate/detector", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate/detector", deprecationLogger); } @Override public String getName() { - return "xpack_ml_validate_detector_action"; + return "ml_validate_detector_action"; } @Override 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 8bd7ef88b6641..97795ccba48be 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 @@ -5,7 +5,9 @@ */ package org.elasticsearch.xpack.ml.rest.validate; +import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; +import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; @@ -17,16 +19,24 @@ import java.io.IOException; +import static org.elasticsearch.rest.RestRequest.Method.POST; + public class RestValidateJobConfigAction extends BaseRestHandler { + private static final DeprecationLogger deprecationLogger = + new DeprecationLogger(LogManager.getLogger(RestValidateJobConfigAction.class)); + public RestValidateJobConfigAction(Settings settings, RestController controller) { super(settings); - controller.registerHandler(RestRequest.Method.POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", this); + // TODO: remove deprecated endpoint in 8.0.0 + controller.registerWithDeprecatedHandler( + POST, MachineLearning.BASE_PATH + "anomaly_detectors/_validate", this, + POST, MachineLearning.PRE_V7_BASE_PATH + "anomaly_detectors/_validate", deprecationLogger); } @Override public String getName() { - return "xpack_ml_validate_job_config_action"; + return "ml_validate_job_config_action"; } @Override diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.close_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.close_job.json similarity index 85% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.close_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.close_job.json index 8830926ed5c05..e0b0cd646d798 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.close_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.close_job.json @@ -1,10 +1,10 @@ { - "xpack.ml.close_job": { + "ml.close_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_close", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_close" ], + "path": "/_ml/anomaly_detectors/{job_id}/_close", + "paths": [ "/_ml/anomaly_detectors/{job_id}/_close" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar.json similarity index 64% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar.json index 3fcfa8582e570..0eb3a61cdf887 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar.json @@ -1,9 +1,9 @@ { - "xpack.ml.delete_calendar": { + "ml.delete_calendar": { "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}", - "paths": [ "/_xpack/ml/calendars/{calendar_id}" ], + "path": "/_ml/calendars/{calendar_id}", + "paths": [ "/_ml/calendars/{calendar_id}" ], "parts": { "calendar_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_event.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_event.json similarity index 69% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_event.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_event.json index d31990645076c..91b041f6c5141 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_event.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_event.json @@ -1,9 +1,9 @@ { - "xpack.ml.delete_calendar_event": { + "ml.delete_calendar_event": { "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}/events/{event_id}", - "paths": [ "/_xpack/ml/calendars/{calendar_id}/events/{event_id}" ], + "path": "/_ml/calendars/{calendar_id}/events/{event_id}", + "paths": [ "/_ml/calendars/{calendar_id}/events/{event_id}" ], "parts": { "calendar_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_job.json similarity index 70% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_job.json index 43dc1b94789b5..196eb78e9936d 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_calendar_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_calendar_job.json @@ -1,9 +1,9 @@ { - "xpack.ml.delete_calendar_job": { + "ml.delete_calendar_job": { "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}", - "paths": [ "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}" ], + "path": "/_ml/calendars/{calendar_id}/jobs/{job_id}", + "paths": [ "/_ml/calendars/{calendar_id}/jobs/{job_id}" ], "parts": { "calendar_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_datafeed.json similarity index 79% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_datafeed.json index 05ec6e0cd2ddb..039d6ee3273c3 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_datafeed.json @@ -1,10 +1,10 @@ { - "xpack.ml.delete_datafeed": { + "ml.delete_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html", "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}", - "paths": [ "/_xpack/ml/datafeeds/{datafeed_id}" ], + "path": "/_ml/datafeeds/{datafeed_id}", + "paths": [ "/_ml/datafeeds/{datafeed_id}" ], "parts": { "datafeed_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_expired_data.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_expired_data.json new file mode 100644 index 0000000000000..2bb04bd286016 --- /dev/null +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_expired_data.json @@ -0,0 +1,11 @@ +{ + "ml.delete_expired_data": { + "methods": [ "DELETE" ], + "url": { + "path": "/_ml/_delete_expired_data", + "paths": [ "/_ml/_delete_expired_data" ], + "parts": {} + }, + "body": null + } +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_filter.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_filter.json similarity index 65% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_filter.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_filter.json index 6c120fc243f51..c4bd51988b030 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_filter.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_filter.json @@ -1,9 +1,9 @@ { - "xpack.ml.delete_filter": { + "ml.delete_filter": { "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters/{filter_id}" ], + "path": "/_ml/filters/{filter_id}", + "paths": [ "/_ml/filters/{filter_id}" ], "parts": { "filter_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_forecast.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_forecast.json similarity index 80% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_forecast.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_forecast.json index 78040351d3517..ef6ad3406e6c0 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_forecast.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_forecast.json @@ -1,12 +1,12 @@ { - "xpack.ml.delete_forecast": { + "ml.delete_forecast": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html", "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}", + "path": "/_ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/_forecast", - "/_xpack/ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}" + "/_ml/anomaly_detectors/{job_id}/_forecast", + "/_ml/anomaly_detectors/{job_id}/_forecast/{forecast_id}" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_job.json similarity index 83% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_job.json index f93fff6eaab4e..550505a263525 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_job.json @@ -1,10 +1,10 @@ { - "xpack.ml.delete_job": { + "ml.delete_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html", "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}" ], + "path": "/_ml/anomaly_detectors/{job_id}", + "paths": [ "/_ml/anomaly_detectors/{job_id}" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_model_snapshot.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_model_snapshot.json similarity index 70% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_model_snapshot.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_model_snapshot.json index 4616e45737ed4..d61c0ec46c5e5 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_model_snapshot.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.delete_model_snapshot.json @@ -1,10 +1,10 @@ { - "xpack.ml.delete_model_snapshot": { + "ml.delete_model_snapshot": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html", "methods": [ "DELETE" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}" ], + "path": "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", + "paths": [ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.find_file_structure.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.find_file_structure.json similarity index 95% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.find_file_structure.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.find_file_structure.json index 66dc18c8c20b3..94b69951e32ec 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.find_file_structure.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.find_file_structure.json @@ -1,10 +1,10 @@ { - "xpack.ml.find_file_structure": { + "ml.find_file_structure": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-file-structure.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/find_file_structure", - "paths": [ "/_xpack/ml/find_file_structure" ], + "path": "/_ml/find_file_structure", + "paths": [ "/_ml/find_file_structure" ], "params": { "lines_to_sample": { "type": "int", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.flush_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.flush_job.json similarity index 90% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.flush_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.flush_job.json index 22dba0ed6cee6..22a59928fc2bf 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.flush_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.flush_job.json @@ -1,13 +1,13 @@ { - "xpack.ml.flush_job": { + "ml.flush_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_flush", + "path": "/_ml/anomaly_detectors/{job_id}/_flush", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/_flush" + "/_ml/anomaly_detectors/{job_id}/_flush" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.forecast.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.forecast.json similarity index 80% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.forecast.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.forecast.json index 10c3725d374af..050b80be4c9bd 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.forecast.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.forecast.json @@ -1,9 +1,9 @@ { - "xpack.ml.forecast": { + "ml.forecast": { "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_forecast", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_forecast" ], + "path": "/_ml/anomaly_detectors/{job_id}/_forecast", + "paths": [ "/_ml/anomaly_detectors/{job_id}/_forecast" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_buckets.json similarity index 87% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_buckets.json index b94f534884df5..a861eb1f7d59f 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_buckets.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_buckets.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_buckets": { + "ml.get_buckets": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html", "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets/{timestamp}", + "path": "/_ml/anomaly_detectors/{job_id}/results/buckets/{timestamp}", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets/{timestamp}", - "/_xpack/ml/anomaly_detectors/{job_id}/results/buckets" + "/_ml/anomaly_detectors/{job_id}/results/buckets/{timestamp}", + "/_ml/anomaly_detectors/{job_id}/results/buckets" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendar_events.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendar_events.json similarity index 86% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendar_events.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendar_events.json index 48b1bd07fd61c..2252db62618fb 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendar_events.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendar_events.json @@ -1,10 +1,10 @@ { - "xpack.ml.get_calendar_events": { + "ml.get_calendar_events": { "methods": [ "GET" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}/events", + "path": "/_ml/calendars/{calendar_id}/events", "paths": [ - "/_xpack/ml/calendars/{calendar_id}/events" + "/_ml/calendars/{calendar_id}/events" ], "parts": { "calendar_id": { @@ -38,4 +38,4 @@ }, "body": null } -} \ No newline at end of file +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendars.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendars.json similarity index 76% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendars.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendars.json index 5b252a0e89c32..29d0067b5f989 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_calendars.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_calendars.json @@ -1,11 +1,11 @@ { - "xpack.ml.get_calendars": { + "ml.get_calendars": { "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}", + "path": "/_ml/calendars/{calendar_id}", "paths": [ - "/_xpack/ml/calendars", - "/_xpack/ml/calendars/{calendar_id}" + "/_ml/calendars", + "/_ml/calendars/{calendar_id}" ], "parts": { "calendar_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_categories.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_categories.json similarity index 77% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_categories.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_categories.json index 481aba426dfe7..a096ba07986cc 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_categories.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_categories.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_categories": { + "ml.get_categories": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html", "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}", + "path": "/_ml/anomaly_detectors/{job_id}/results/categories/{category_id}", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/{category_id}", - "/_xpack/ml/anomaly_detectors/{job_id}/results/categories/" + "/_ml/anomaly_detectors/{job_id}/results/categories/{category_id}", + "/_ml/anomaly_detectors/{job_id}/results/categories/" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeed_stats.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeed_stats.json similarity index 77% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeed_stats.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeed_stats.json index f22dfee9b1623..155701dbee5fa 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeed_stats.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeed_stats.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_datafeed_stats": { + "ml.get_datafeed_stats": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html", "methods": [ "GET"], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}/_stats", + "path": "/_ml/datafeeds/{datafeed_id}/_stats", "paths": [ - "/_xpack/ml/datafeeds/{datafeed_id}/_stats", - "/_xpack/ml/datafeeds/_stats" + "/_ml/datafeeds/{datafeed_id}/_stats", + "/_ml/datafeeds/_stats" ], "parts": { "datafeed_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeeds.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeeds.json similarity index 80% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeeds.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeeds.json index e646ef8cd03fd..c911079cd2217 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_datafeeds.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_datafeeds.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_datafeeds": { + "ml.get_datafeeds": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html", "methods": [ "GET"], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}", + "path": "/_ml/datafeeds/{datafeed_id}", "paths": [ - "/_xpack/ml/datafeeds/{datafeed_id}", - "/_xpack/ml/datafeeds" + "/_ml/datafeeds/{datafeed_id}", + "/_ml/datafeeds" ], "parts": { "datafeed_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_filters.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_filters.json similarity index 75% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_filters.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_filters.json index f5dfe0c74e013..c544b6dd37a34 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_filters.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_filters.json @@ -1,9 +1,9 @@ { - "xpack.ml.get_filters": { + "ml.get_filters": { "methods": [ "GET" ], "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters", "/_xpack/ml/filters/{filter_id}" ], + "path": "/_ml/filters/{filter_id}", + "paths": [ "/_ml/filters", "/_ml/filters/{filter_id}" ], "parts": { "filter_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_influencers.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_influencers.json similarity index 88% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_influencers.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_influencers.json index 88a42a880919d..adb8206dbf03c 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_influencers.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_influencers.json @@ -1,10 +1,10 @@ { - "xpack.ml.get_influencers": { + "ml.get_influencers": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html", "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/influencers", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/results/influencers" ], + "path": "/_ml/anomaly_detectors/{job_id}/results/influencers", + "paths": [ "/_ml/anomaly_detectors/{job_id}/results/influencers" ], "parts": { "job_id": { "type" : "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_job_stats.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_job_stats.json similarity index 76% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_job_stats.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_job_stats.json index 174de8907e963..66b7c836df513 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_job_stats.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_job_stats.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_job_stats": { + "ml.get_job_stats": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html", "methods": [ "GET"], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_stats", + "path": "/_ml/anomaly_detectors/{job_id}/_stats", "paths": [ - "/_xpack/ml/anomaly_detectors/_stats", - "/_xpack/ml/anomaly_detectors/{job_id}/_stats" + "/_ml/anomaly_detectors/_stats", + "/_ml/anomaly_detectors/{job_id}/_stats" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_jobs.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_jobs.json similarity index 78% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_jobs.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_jobs.json index 0da7be761d068..6777b9ffb7747 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_jobs.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_jobs.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_jobs": { + "ml.get_jobs": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html", "methods": [ "GET"], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}", + "path": "/_ml/anomaly_detectors/{job_id}", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}", - "/_xpack/ml/anomaly_detectors" + "/_ml/anomaly_detectors/{job_id}", + "/_ml/anomaly_detectors" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_model_snapshots.json similarity index 84% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_model_snapshots.json index f820bf43562a0..04a6eba021494 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_model_snapshots.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_model_snapshots.json @@ -1,12 +1,12 @@ { - "xpack.ml.get_model_snapshots": { + "ml.get_model_snapshots": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html", "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", + "path": "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", - "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots" + "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}", + "/_ml/anomaly_detectors/{job_id}/model_snapshots" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_overall_buckets.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_overall_buckets.json similarity index 90% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_overall_buckets.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_overall_buckets.json index eaf3b2a233f51..679aa67d3ccd6 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_overall_buckets.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_overall_buckets.json @@ -1,11 +1,11 @@ { - "xpack.ml.get_overall_buckets": { + "ml.get_overall_buckets": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html", "methods": [ "GET", "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/overall_buckets", + "path": "/_ml/anomaly_detectors/{job_id}/results/overall_buckets", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/results/overall_buckets" + "/_ml/anomaly_detectors/{job_id}/results/overall_buckets" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_records.json similarity index 88% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_records.json index d039d9d4a4070..4831629b90c6f 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.get_records.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.get_records.json @@ -1,11 +1,11 @@ { - "xpack.ml.get_records": { + "ml.get_records": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html", "methods": ["GET", "POST"], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/results/records", + "path": "/_ml/anomaly_detectors/{job_id}/results/records", "paths": [ - "/_xpack/ml/anomaly_detectors/{job_id}/results/records" + "/_ml/anomaly_detectors/{job_id}/results/records" ], "parts": { "job_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.info.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.info.json new file mode 100644 index 0000000000000..5afbaffd1fcd6 --- /dev/null +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.info.json @@ -0,0 +1,11 @@ +{ + "ml.info": { + "methods": [ "GET" ], + "url": { + "path": "/_ml/info", + "paths": [ "/_ml/info" ], + "parts": {}, + "body": null + } + } +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.open_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.open_job.json similarity index 81% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.open_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.open_job.json index 4a1d8a7c63310..331f71132b927 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.open_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.open_job.json @@ -1,10 +1,10 @@ { - "xpack.ml.open_job": { + "ml.open_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_open", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_open" ], + "path": "/_ml/anomaly_detectors/{job_id}/_open", + "paths": [ "/_ml/anomaly_detectors/{job_id}/_open" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_calendar_events.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_calendar_events.json similarity index 66% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_calendar_events.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_calendar_events.json index 71ed167a7367e..6775317ec6aec 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_calendar_events.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_calendar_events.json @@ -1,9 +1,9 @@ { - "xpack.ml.post_calendar_events": { + "ml.post_calendar_events": { "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}/events", - "paths": [ "/_xpack/ml/calendars/{calendar_id}/events" ], + "path": "/_ml/calendars/{calendar_id}/events", + "paths": [ "/_ml/calendars/{calendar_id}/events" ], "parts": { "calendar_id": { "type": "string", @@ -17,4 +17,4 @@ "required" : true } } -} \ No newline at end of file +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_data.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_data.json similarity index 83% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_data.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_data.json index b25af68b268c6..9acf4883e9344 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.post_data.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.post_data.json @@ -1,10 +1,10 @@ { - "xpack.ml.post_data": { + "ml.post_data": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_data", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_data" ], + "path": "/_ml/anomaly_detectors/{job_id}/_data", + "paths": [ "/_ml/anomaly_detectors/{job_id}/_data" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.preview_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.preview_datafeed.json similarity index 69% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.preview_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.preview_datafeed.json index 66e201e630ae2..1d48948fb7c02 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.preview_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.preview_datafeed.json @@ -1,10 +1,10 @@ { - "xpack.ml.preview_datafeed": { + "ml.preview_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html", "methods": [ "GET" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}/_preview", - "paths": [ "/_xpack/ml/datafeeds/{datafeed_id}/_preview" ], + "path": "/_ml/datafeeds/{datafeed_id}/_preview", + "paths": [ "/_ml/datafeeds/{datafeed_id}/_preview" ], "parts": { "datafeed_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar.json similarity index 69% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar.json index d762ad2931571..4a5473cd49699 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar.json @@ -1,9 +1,9 @@ { - "xpack.ml.put_calendar": { + "ml.put_calendar": { "methods": [ "PUT" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}", - "paths": [ "/_xpack/ml/calendars/{calendar_id}" ], + "path": "/_ml/calendars/{calendar_id}", + "paths": [ "/_ml/calendars/{calendar_id}" ], "parts": { "calendar_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar_job.json similarity index 70% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar_job.json index 2abf870058c7e..e17fdacd167f2 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_calendar_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_calendar_job.json @@ -1,9 +1,9 @@ { - "xpack.ml.put_calendar_job": { + "ml.put_calendar_job": { "methods": [ "PUT" ], "url": { - "path": "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}", - "paths": [ "/_xpack/ml/calendars/{calendar_id}/jobs/{job_id}" ], + "path": "/_ml/calendars/{calendar_id}/jobs/{job_id}", + "paths": [ "/_ml/calendars/{calendar_id}/jobs/{job_id}" ], "parts": { "calendar_id": { "type": "string", @@ -19,4 +19,4 @@ }, "body": null } -} \ No newline at end of file +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_datafeed.json similarity index 75% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_datafeed.json index 0f7e4de21c7d2..8545d0727d7d7 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_datafeed.json @@ -1,10 +1,10 @@ { - "xpack.ml.put_datafeed": { + "ml.put_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html", "methods": [ "PUT" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}", - "paths": [ "/_xpack/ml/datafeeds/{datafeed_id}" ], + "path": "/_ml/datafeeds/{datafeed_id}", + "paths": [ "/_ml/datafeeds/{datafeed_id}" ], "parts": { "datafeed_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_filter.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_filter.json similarity index 71% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_filter.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_filter.json index 36c5f0582cbd8..3ef67502b6464 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_filter.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_filter.json @@ -1,9 +1,9 @@ { - "xpack.ml.put_filter": { + "ml.put_filter": { "methods": [ "PUT" ], "url": { - "path": "/_xpack/ml/filters/{filter_id}", - "paths": [ "/_xpack/ml/filters/{filter_id}" ], + "path": "/_ml/filters/{filter_id}", + "paths": [ "/_ml/filters/{filter_id}" ], "parts": { "filter_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_job.json similarity index 74% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_job.json index f7b292cdafc32..01bb28290acc6 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.put_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.put_job.json @@ -1,10 +1,10 @@ { - "xpack.ml.put_job": { + "ml.put_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html", "methods": [ "PUT" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}" ], + "path": "/_ml/anomaly_detectors/{job_id}", + "paths": [ "/_ml/anomaly_detectors/{job_id}" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.revert_model_snapshot.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.revert_model_snapshot.json similarity index 76% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.revert_model_snapshot.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.revert_model_snapshot.json index 6f7810aff7f55..3c71279c23bf0 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.revert_model_snapshot.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.revert_model_snapshot.json @@ -1,10 +1,10 @@ { - "xpack.ml.revert_model_snapshot": { + "ml.revert_model_snapshot": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert" ], + "path": "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert", + "paths": [ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_revert" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.start_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.start_datafeed.json similarity index 86% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.start_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.start_datafeed.json index 1018cb224363b..ce3fd9cdf4b80 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.start_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.start_datafeed.json @@ -1,10 +1,10 @@ { - "xpack.ml.start_datafeed": { + "ml.start_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}/_start", - "paths": [ "/_xpack/ml/datafeeds/{datafeed_id}/_start" ], + "path": "/_ml/datafeeds/{datafeed_id}/_start", + "paths": [ "/_ml/datafeeds/{datafeed_id}/_start" ], "parts": { "datafeed_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.stop_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.stop_datafeed.json similarity index 88% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.stop_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.stop_datafeed.json index 0876e3019ab42..96d28abc15118 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.stop_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.stop_datafeed.json @@ -1,13 +1,13 @@ { - "xpack.ml.stop_datafeed": { + "ml.stop_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}/_stop", + "path": "/_ml/datafeeds/{datafeed_id}/_stop", "paths": [ - "/_xpack/ml/datafeeds/{datafeed_id}/_stop" + "/_ml/datafeeds/{datafeed_id}/_stop" ], "parts": { "datafeed_id": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_datafeed.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_datafeed.json similarity index 73% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_datafeed.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_datafeed.json index d089012325a46..aebeade84e20e 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_datafeed.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_datafeed.json @@ -1,10 +1,10 @@ { - "xpack.ml.update_datafeed": { + "ml.update_datafeed": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/datafeeds/{datafeed_id}/_update", - "paths": [ "/_xpack/ml/datafeeds/{datafeed_id}/_update" ], + "path": "/_ml/datafeeds/{datafeed_id}/_update", + "paths": [ "/_ml/datafeeds/{datafeed_id}/_update" ], "parts": { "datafeed_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_filter.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_filter.json similarity index 68% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_filter.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_filter.json index 06aceea4c1240..d55fb80755a31 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_filter.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_filter.json @@ -1,9 +1,9 @@ { - "xpack.ml.update_filter": { + "ml.update_filter": { "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/filters/{filter_id}/_update", - "paths": [ "/_xpack/ml/filters/{filter_id}/_update" ], + "path": "/_ml/filters/{filter_id}/_update", + "paths": [ "/_ml/filters/{filter_id}/_update" ], "parts": { "filter_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_job.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_job.json similarity index 72% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_job.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_job.json index d59e5811364b6..f2a9a29a416b4 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_job.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_job.json @@ -1,10 +1,10 @@ { - "xpack.ml.update_job": { + "ml.update_job": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/_update", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/_update" ], + "path": "/_ml/anomaly_detectors/{job_id}/_update", + "paths": [ "/_ml/anomaly_detectors/{job_id}/_update" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_model_snapshot.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_model_snapshot.json similarity index 72% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_model_snapshot.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_model_snapshot.json index 5c62e0d3b8a2a..ba57e18b0aad6 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.update_model_snapshot.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_model_snapshot.json @@ -1,10 +1,10 @@ { - "xpack.ml.update_model_snapshot": { + "ml.update_model_snapshot": { "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html", "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update", - "paths": [ "/_xpack/ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update" ], + "path": "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update", + "paths": [ "/_ml/anomaly_detectors/{job_id}/model_snapshots/{snapshot_id}/_update" ], "parts": { "job_id": { "type": "string", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json similarity index 52% rename from x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate.json rename to x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json index bee1f20b2f267..140057db9fcfd 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate.json +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate.json @@ -1,9 +1,9 @@ { - "xpack.ml.validate": { + "ml.validate": { "methods": [ "POST" ], "url": { - "path": "/_xpack/ml/anomaly_detectors/_validate", - "paths": [ "/_xpack/ml/anomaly_detectors/_validate" ], + "path": "/_ml/anomaly_detectors/_validate", + "paths": [ "/_ml/anomaly_detectors/_validate" ], "params": {} }, "body": { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json new file mode 100644 index 0000000000000..33e91b6832b9f --- /dev/null +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.validate_detector.json @@ -0,0 +1,14 @@ +{ + "ml.validate_detector": { + "methods": [ "POST" ], + "url": { + "path": "/_ml/anomaly_detectors/_validate/detector", + "paths": [ "/_ml/anomaly_detectors/_validate/detector" ], + "params": {} + }, + "body": { + "description" : "The detector", + "required" : true + } + } +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_expired_data.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_expired_data.json deleted file mode 100644 index 4a4c079d52243..0000000000000 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.delete_expired_data.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "xpack.ml.delete_expired_data": { - "methods": [ "DELETE" ], - "url": { - "path": "/_xpack/ml/_delete_expired_data", - "paths": [ "/_xpack/ml/_delete_expired_data" ], - "parts": {} - }, - "body": null - } -} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.info.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.info.json deleted file mode 100644 index 770438251f616..0000000000000 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.info.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "xpack.ml.info": { - "methods": [ "GET" ], - "url": { - "path": "/_xpack/ml/info", - "paths": [ "/_xpack/ml/info" ], - "parts": {}, - "body": null - } - } -} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate_detector.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate_detector.json deleted file mode 100644 index 587bc3fb51a2c..0000000000000 --- a/x-pack/plugin/src/test/resources/rest-api-spec/api/xpack.ml.validate_detector.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "xpack.ml.validate_detector": { - "methods": [ "POST" ], - "url": { - "path": "/_xpack/ml/anomaly_detectors/_validate/detector", - "paths": [ "/_xpack/ml/anomaly_detectors/_validate/detector" ], - "params": {} - }, - "body": { - "description" : "The detector", - "required" : true - } - } -} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/calendar_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/calendar_crud.yml index 1406e04c8da2d..d6a7792db7d0c 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/calendar_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/calendar_crud.yml @@ -2,7 +2,7 @@ "Test calendar CRUD": - do: - xpack.ml.put_job: + ml.put_job: job_id: cal-job body: > { @@ -15,7 +15,7 @@ - match: { job_id: "cal-job" } - do: - xpack.ml.put_job: + ml.put_job: job_id: cal-job2 body: > { @@ -29,7 +29,7 @@ - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "advent" body: > { @@ -42,7 +42,7 @@ - match: { description: "This is a calendar about..."} - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "advent" - match: { count: 1 } - match: @@ -53,7 +53,7 @@ - is_false: type - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "dogs_of_the_year" body: > { @@ -61,66 +61,66 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "cats_of_the_year" - do: - xpack.ml.get_calendars: {} + ml.get_calendars: {} - match: { count: 3 } - do: - xpack.ml.delete_calendar: + ml.delete_calendar: calendar_id: "dogs_of_the_year" - do: - xpack.ml.get_calendars: {} + ml.get_calendars: {} - match: { count: 2 } - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: _all - match: { count: 2 } - do: catch: missing - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "dogs_of_the_year" --- "Test get calendar given missing": - do: catch: /No calendar with id \[unknown\]/ - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "unknown" --- "Test put calendar given id contains invalid chars": - do: catch: bad_request - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "Mayas" --- "Test PageParams": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "calendar1" - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "calendar2" - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "calendar3" - do: - xpack.ml.get_calendars: + ml.get_calendars: from: 2 - match: { count: 3 } - length: { calendars: 1} - match: { calendars.0.calendar_id: calendar3 } - do: - xpack.ml.get_calendars: + ml.get_calendars: from: 1 size: 1 - match: { count: 3 } @@ -131,7 +131,7 @@ "Test PageParams with ID is invalid": - do: catch: bad_request - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: tides size: 10 @@ -139,26 +139,26 @@ "Test cannot overwrite an exisiting calendar": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "mayan" - do: catch: bad_request - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "mayan" --- "Test cannot create calendar with name _all": - do: catch: bad_request - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "_all" --- "Test deleted job is removed from calendar": - do: - xpack.ml.put_job: + ml.put_job: job_id: cal-crud-test-delete body: > { @@ -171,7 +171,7 @@ - match: { job_id: "cal-crud-test-delete" } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "delete-test" body: > { @@ -179,12 +179,12 @@ } - do: - xpack.ml.delete_job: + ml.delete_job: job_id: cal-crud-test-delete - match: { acknowledged: true } - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "delete-test" - match: { count: 1 } - match: { calendars.0.job_ids: [] } @@ -193,11 +193,11 @@ "Test update calendar job ids": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "wildlife" - do: - xpack.ml.put_job: + ml.put_job: job_id: tiger body: > { @@ -210,7 +210,7 @@ - match: { job_id: "tiger" } - do: - xpack.ml.put_job: + ml.put_job: job_id: otter body: > { @@ -223,14 +223,14 @@ - match: { job_id: "otter" } - do: - xpack.ml.put_calendar_job: + ml.put_calendar_job: calendar_id: "wildlife" job_id: "tiger" - match: { calendar_id: "wildlife" } - match: { job_ids.0: "tiger" } - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "wildlife" - match: { count: 1 } - match: { calendars.0.calendar_id: "wildlife" } @@ -238,7 +238,7 @@ - match: { calendars.0.job_ids.0: "tiger" } - do: - xpack.ml.delete_calendar_job: + ml.delete_calendar_job: calendar_id: "wildlife" job_id: "tiger" - match: { calendar_id: "wildlife" } @@ -246,12 +246,12 @@ - do: catch: /Cannot remove \[otter\] as it is not present in calendar \[wildlife\]/ - xpack.ml.delete_calendar_job: + ml.delete_calendar_job: calendar_id: "wildlife" job_id: "otter" - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "wildlife" - match: { count: 1 } - match: { calendars.0.calendar_id: "wildlife" } @@ -259,18 +259,18 @@ - do: catch: /Cannot remove \[missing_job\] as it is not present in calendar \[wildlife\]/ - xpack.ml.delete_calendar_job: + ml.delete_calendar_job: calendar_id: "wildlife" job_id: "missing_job" --- "Test calendar get events": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "events" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "events" body: > { @@ -282,7 +282,7 @@ } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "events" - length: { events: 4 } - match: { events.0.description: "event 1" } @@ -293,7 +293,7 @@ - set: { events.0.event_id: event_1_id } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "events" from: 1 size: 2 @@ -302,7 +302,7 @@ - match: { events.1.description: "event 3" } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "events" end: "2017-12-12T00:00:00Z" - length: { events: 2 } @@ -310,7 +310,7 @@ - match: { events.1.description: "event 2" } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "events" start: "2017-12-05T03:00:00Z" - length: { events: 3 } @@ -319,7 +319,7 @@ - match: { events.2.description: "event 4" } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "events" start: "2017-12-02T00:00:00Z" end: "2017-12-12T00:00:00Z" @@ -327,11 +327,11 @@ - match: { events.0.description: "event 2" } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "events-2" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "events-2" body: > { @@ -342,7 +342,7 @@ - do: catch: bad_request - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "events-2" body: > { @@ -353,18 +353,18 @@ # Event is not in calendar events-2 - do: catch: bad_request - xpack.ml.delete_calendar_event: + ml.delete_calendar_event: calendar_id: "events-2" event_id: $event_1_id - do: - xpack.ml.delete_calendar_event: + ml.delete_calendar_event: calendar_id: "events" event_id: $event_1_id - do: catch: missing - xpack.ml.delete_calendar_event: + ml.delete_calendar_event: calendar_id: "events" event_id: "missing event" @@ -373,11 +373,11 @@ "Test delete calendar deletes events": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "cal-foo" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "cal-foo" body: > { @@ -388,11 +388,11 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "cal-bar" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "cal-bar" body: > { @@ -402,7 +402,7 @@ } - do: - xpack.ml.delete_calendar: + ml.delete_calendar: calendar_id: "cal-foo" # Check the event from calendar 1 is deleted @@ -434,11 +434,11 @@ "Test get all calendar events": - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "dave-holidays" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "dave-holidays" body: > { @@ -448,11 +448,11 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "tom-holidays" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "tom-holidays" body: > { @@ -462,7 +462,7 @@ } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "_all" - length: { events: 4 } @@ -470,7 +470,7 @@ "Test get calendar events for job": - do: - xpack.ml.put_job: + ml.put_job: job_id: cal-crud-job-with-events body: > { @@ -482,7 +482,7 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "dave-holidays" body: > { @@ -490,7 +490,7 @@ } - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "dave-holidays" body: > { @@ -499,7 +499,7 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "tom-holidays" body: > { @@ -507,7 +507,7 @@ } - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "tom-holidays" body: > { @@ -517,11 +517,11 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "not-used-by-job" - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "not-used-by-job" body: > { @@ -534,19 +534,19 @@ # Calendar Id must be _all if a job id is used - do: catch: /action_request_validation_exception/ - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "dave-holiday" job_id: cal-crud-job-with-events - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: _all job_id: cal-crud-job-with-events - match: { count: 4 } - length: { events: 4 } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: _all start: "2018-01-01T00:00:00Z" job_id: cal-crud-job-with-events @@ -559,7 +559,7 @@ "Test get calendar events with job groups": # Test job group - do: - xpack.ml.put_job: + ml.put_job: job_id: cal-crud-job-with-events-group body: > { @@ -572,7 +572,7 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "ben-holidays" body: > { @@ -580,7 +580,7 @@ } - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "ben-holidays" body: > { @@ -590,7 +590,7 @@ } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: _all job_id: "cal-crud-job-with-events-group" - match: { count: 2 } @@ -599,7 +599,7 @@ - match: { events.1.description: snow } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: _all job_id: "ben-holidays-group" - match: { count: 2 } @@ -612,7 +612,7 @@ - do: catch: /At least 1 event is required/ - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "foo" body: > { @@ -624,7 +624,7 @@ - do: catch: /No calendar with id \[unknown\]/ - xpack.ml.delete_calendar_event: + ml.delete_calendar_event: calendar_id: "unknown" event_id: "event_1" @@ -633,14 +633,14 @@ - do: catch: /No calendar with id \[unknown\]/ - xpack.ml.delete_calendar_job: + ml.delete_calendar_job: calendar_id: "unknown" job_id: "missing_calendar" --- "Test list of job Ids": - do: - xpack.ml.put_job: + ml.put_job: job_id: foo-a body: > { @@ -652,7 +652,7 @@ } - do: - xpack.ml.put_job: + ml.put_job: job_id: foo-b body: > { @@ -664,7 +664,7 @@ } - do: - xpack.ml.put_job: + ml.put_job: job_id: bar-a body: > { @@ -676,7 +676,7 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "expression" body: > { @@ -684,14 +684,14 @@ } - do: - xpack.ml.put_calendar_job: + ml.put_calendar_job: calendar_id: "expression" job_id: "foo-a,foo-b" - match: { calendar_id: "expression" } - length: { job_ids: 3 } - do: - xpack.ml.delete_calendar_job: + ml.delete_calendar_job: calendar_id: "expression" job_id: "foo-a,foo-b" - match: { calendar_id: "expression" } @@ -701,7 +701,7 @@ --- "Test calendar actions with new job group": - do: - xpack.ml.put_job: + ml.put_job: job_id: calendar-job body: > { @@ -713,7 +713,7 @@ } - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "cal_with_new_job_group" body: > { @@ -721,7 +721,7 @@ } - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "cal_with_new_job_group" - match: { count: 1 } - match: @@ -730,7 +730,7 @@ job_ids: ["calendar-job", "new-job-group"] - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "cal_with_new_job_group" body: > { @@ -738,28 +738,28 @@ } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: cal_with_new_job_group - length: { events: 1 } - match: { events.0.description: beach } - do: - xpack.ml.delete_calendar: + ml.delete_calendar: calendar_id: "cal_with_new_job_group" - do: - xpack.ml.put_calendar: + ml.put_calendar: calendar_id: "started_empty_calendar" - do: - xpack.ml.put_calendar_job: + ml.put_calendar_job: calendar_id: "started_empty_calendar" job_id: "new-group" - match: { calendar_id: "started_empty_calendar" } - length: { job_ids: 1 } - do: - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "started_empty_calendar" - match: { count: 1 } - match: @@ -768,7 +768,7 @@ job_ids: ["new-group"] - do: - xpack.ml.post_calendar_events: + ml.post_calendar_events: calendar_id: "started_empty_calendar" body: > { @@ -776,27 +776,27 @@ } - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "started_empty_calendar" - length: { events: 1 } - match: { events.0.description: beach } - set: { events.0.event_id: beach_event_id } - do: - xpack.ml.delete_calendar_event: + ml.delete_calendar_event: calendar_id: "started_empty_calendar" event_id: $beach_event_id - do: - xpack.ml.get_calendar_events: + ml.get_calendar_events: calendar_id: "started_empty_calendar" - length: { events: 0 } - do: - xpack.ml.delete_calendar: + ml.delete_calendar: calendar_id: "started_empty_calendar" - do: catch: missing - xpack.ml.get_calendars: + ml.get_calendars: calendar_id: "started_empty_calendar" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/custom_all_field.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/custom_all_field.yml index 435d890e7beab..04949aaa2b78d 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/custom_all_field.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/custom_all_field.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: custom-all-test-1 body: > { @@ -17,7 +17,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: custom-all-test-2 body: > { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml index d9e4c5ba6410a..a2914834c8978 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/datafeeds_crud.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: datafeeds-crud-1 body: > { @@ -24,7 +24,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: datafeeds-crud-2 body: > { @@ -41,13 +41,13 @@ setup: "Test get all datafeeds and stats given no datafeed exists": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: "_all" - match: { count: 0 } - match: { datafeeds: [] } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "_all" - match: { count: 0 } - match: { datafeeds: [] } @@ -56,7 +56,7 @@ setup: "Test get datafeed with expression that does not match and allow_no_datafeeds": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: "missing-*" allow_no_datafeeds: true - match: { count: 0 } @@ -67,7 +67,7 @@ setup: - do: catch: missing - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: "missing-*" allow_no_datafeeds: false @@ -75,7 +75,7 @@ setup: "Test put datafeed referring to missing job_id": - do: catch: /resource_not_found_exception/ - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -88,7 +88,7 @@ setup: "Test put datafeed with security headers in the body": - do: catch: /unknown field \[headers\], parser not found/ - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -100,7 +100,7 @@ setup: --- "Test put datafeed referring to existing job_id": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -119,7 +119,7 @@ setup: --- "Test put datafeed whose id is already taken": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -131,7 +131,7 @@ setup: - do: catch: /resource_already_exists_exception/ - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -143,7 +143,7 @@ setup: --- "Test put datafeed with job_id that is already used by another datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -155,7 +155,7 @@ setup: - do: catch: /A datafeed \[test-datafeed-1\] already exists for job \[datafeeds-crud-1\]/ - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-2 body: > { @@ -168,7 +168,7 @@ setup: "Test put datafeed with invalid query": - do: catch: /parsing_exception/ - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -181,7 +181,7 @@ setup: --- "Test update datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -194,7 +194,7 @@ setup: } - do: - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -214,7 +214,7 @@ setup: --- "Test update datafeed to point to different job": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -225,7 +225,7 @@ setup: } - do: - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -241,7 +241,7 @@ setup: - do: catch: /resource_not_found_exception/ - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: a-missing-datafeed body: > {} @@ -249,7 +249,7 @@ setup: --- "Test update datafeed to point to missing job": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -261,7 +261,7 @@ setup: - do: catch: /resource_not_found_exception/ - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -271,7 +271,7 @@ setup: --- "Test update datafeed to point to job already attached to another datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -281,7 +281,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-2 body: > { @@ -292,7 +292,7 @@ setup: - do: catch: /A datafeed \[test-datafeed-2\] already exists for job \[datafeeds-crud-2\]/ - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -303,13 +303,13 @@ setup: "Test delete datafeed with missing id": - do: catch: /resource_not_found_exception/ - xpack.ml.delete_datafeed: + ml.delete_datafeed: datafeed_id: a-missing-datafeed --- "Test put datafeed with chunking_config": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -325,7 +325,7 @@ setup: --- "Test put datafeed with aggregations": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-aggs-1 body: > { @@ -369,7 +369,7 @@ setup: } } - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: test-datafeed-aggs-1 - match: { datafeeds.0.datafeed_id: "test-datafeed-aggs-1" } - match: { datafeeds.0.aggregations.histogram_buckets.date_histogram.field: "@timestamp" } @@ -380,7 +380,7 @@ setup: --- "Test delete datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -391,14 +391,14 @@ setup: - match: { datafeed_id: "test-datafeed-1" } - do: - xpack.ml.delete_datafeed: + ml.delete_datafeed: datafeed_id: test-datafeed-1 - match: { acknowledged: true } --- "Test force delete datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: test-datafeed-1 body: > { @@ -409,7 +409,7 @@ setup: - match: { datafeed_id: "test-datafeed-1" } - do: - xpack.ml.delete_datafeed: + ml.delete_datafeed: datafeed_id: test-datafeed-1 force: true - match: { acknowledged: true } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_forecast.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_forecast.yml index 5ca3349d6c031..d780677ea2dcb 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_forecast.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_forecast.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: delete-forecast-job body: > { @@ -22,7 +22,7 @@ setup: "Test delete forecast on missing forecast": - do: catch: /resource_not_found_exception/ - xpack.ml.delete_forecast: + ml.delete_forecast: job_id: delete-forecast-job forecast_id: this-is-a-bad-forecast @@ -103,7 +103,7 @@ setup: indices.refresh: index: .ml-anomalies-delete-forecast-job - do: - xpack.ml.delete_forecast: + ml.delete_forecast: job_id: delete-forecast-job forecast_id: someforecastid - match: { acknowledged: true } @@ -130,7 +130,7 @@ setup: "Test delete on _all forecasts not allow no forecasts": - do: catch: /resource_not_found_exception/ - xpack.ml.delete_forecast: + ml.delete_forecast: job_id: delete-forecast-job forecast_id: _all allow_no_forecasts: false @@ -138,7 +138,7 @@ setup: --- "Test delete on _all forecasts": - do: - xpack.ml.delete_forecast: + ml.delete_forecast: job_id: delete-forecast-job forecast_id: _all allow_no_forecasts: true diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml index 3ef47c2b60880..b5e3e68c3c5b8 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_job_force.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: force-delete-job body: > { @@ -19,13 +19,13 @@ setup: --- "Test force delete a closed job": - do: - xpack.ml.delete_job: + ml.delete_job: force: true job_id: force-delete-job - match: { acknowledged: true } - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "_all" - match: { count: 0 } @@ -33,17 +33,17 @@ setup: "Test force delete an open job": - do: - xpack.ml.open_job: + ml.open_job: job_id: force-delete-job - do: - xpack.ml.delete_job: + ml.delete_job: force: true job_id: force-delete-job - match: { acknowledged: true } - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "_all" - match: { count: 0 } @@ -52,7 +52,7 @@ setup: - do: catch: /resource_not_found_exception/ - xpack.ml.delete_job: + ml.delete_job: force: true job_id: inexistent-job @@ -60,7 +60,7 @@ setup: "Test force delete job that is referred by a datafeed": - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: force-delete-job-datafeed body: > { @@ -72,5 +72,5 @@ setup: - do: catch: /Cannot delete job \[force-delete-job\] because datafeed \[force-delete-job-datafeed\] refers to it/ - xpack.ml.delete_job: + ml.delete_job: job_id: force-delete-job diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_model_snapshot.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_model_snapshot.yml index e4f9bc579f48e..a070625a7138b 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_model_snapshot.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/delete_model_snapshot.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: delete-model-snapshot body: > { @@ -24,13 +24,13 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.open_job: + ml.open_job: job_id: delete-model-snapshot - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.close_job: + ml.close_job: job_id: delete-model-snapshot - do: @@ -127,7 +127,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: delete-model-snapshot snapshot_id: "active-snapshot" @@ -136,20 +136,20 @@ setup: "Test delete snapshot missing snapshotId": - do: catch: param - xpack.ml.delete_model_snapshot: + ml.delete_model_snapshot: job_id: "delete-model-snapshot" --- "Test delete snapshot missing job_id": - do: catch: param - xpack.ml.delete_model_snapshot: + ml.delete_model_snapshot: snapshot_id: "inactive-snapshot" --- "Test valid delete snapshot": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "delete-model-snapshot" - match: { count: 2 } @@ -163,7 +163,7 @@ setup: - match: { count: 3 } - do: - xpack.ml.delete_model_snapshot: + ml.delete_model_snapshot: job_id: "delete-model-snapshot" snapshot_id: "inactive-snapshot" - match: { acknowledged: true } @@ -181,7 +181,7 @@ setup: index: .ml-state - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "delete-model-snapshot" - match: { count: 1 } - match: { model_snapshots.0.snapshot_id: "active-snapshot"} @@ -200,7 +200,7 @@ setup: - do: catch: bad_request - xpack.ml.delete_model_snapshot: + ml.delete_model_snapshot: job_id: "delete-model-snapshot" snapshot_id: "active-snapshot" @@ -208,6 +208,6 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.delete_model_snapshot: + ml.delete_model_snapshot: job_id: "non-existent-job" snapshot_id: "delete-model-snapshot" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/filter_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/filter_crud.yml index 28b5d5c9315e8..9ff70b2a65026 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/filter_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/filter_crud.yml @@ -20,7 +20,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_filter: + ml.put_filter: filter_id: filter-foo body: > { @@ -30,7 +30,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_filter: + ml.put_filter: filter_id: filter-foo2 body: > { @@ -48,14 +48,14 @@ setup: - do: catch: missing - xpack.ml.get_filters: + ml.get_filters: filter_id: "do_not_exist" --- "Test get filter API": - do: - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" - match: { count: 1 } @@ -68,7 +68,7 @@ setup: "Test get filters API": - do: - xpack.ml.get_filters: {} + ml.get_filters: {} - match: { count: 2 } - match: @@ -83,7 +83,7 @@ setup: items: ["123", "lmnop"] - do: - xpack.ml.get_filters: + ml.get_filters: from: 1 size: 1 @@ -94,19 +94,19 @@ setup: - do: catch: bad_request - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" from: 0 - do: catch: bad_request - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" size: 1 - do: catch: bad_request - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" from: 0 size: 1 @@ -115,7 +115,7 @@ setup: "Test create filter given invalid filter_id": - do: catch: bad_request - xpack.ml.put_filter: + ml.put_filter: filter_id: Invalid body: > { @@ -125,7 +125,7 @@ setup: --- "Test create filter api": - do: - xpack.ml.put_filter: + ml.put_filter: filter_id: new-filter body: > { @@ -138,7 +138,7 @@ setup: - match: { items: ["abc", "xyz"]} - do: - xpack.ml.get_filters: + ml.get_filters: filter_id: "new-filter" - match: { count: 1 } @@ -152,7 +152,7 @@ setup: "Test create filter api with mismatching body ID": - do: catch: /illegal_argument_exception/ - xpack.ml.put_filter: + ml.put_filter: filter_id: "uri_id" body: > { @@ -164,7 +164,7 @@ setup: "Test update filter given no filter matches filter_id": - do: catch: missing - xpack.ml.update_filter: + ml.update_filter: filter_id: "missing_filter" body: > { @@ -173,7 +173,7 @@ setup: --- "Test update filter": - do: - xpack.ml.put_filter: + ml.put_filter: filter_id: "test_update_filter" body: > { @@ -183,7 +183,7 @@ setup: - match: { filter_id: test_update_filter } - do: - xpack.ml.update_filter: + ml.update_filter: filter_id: "test_update_filter" body: > { @@ -196,7 +196,7 @@ setup: - match: { items: ["b", "c", "d"] } - do: - xpack.ml.get_filters: + ml.get_filters: filter_id: "test_update_filter" - match: filters.0: @@ -205,14 +205,14 @@ setup: items: ["b", "c", "d"] - do: - xpack.ml.delete_filter: + ml.delete_filter: filter_id: test_update_filter --- "Test update filter given remove item is not present": - do: catch: /Cannot remove item \[not present item\] as it is not present in filter \[filter-foo\]/ - xpack.ml.update_filter: + ml.update_filter: filter_id: "filter-foo" body: > { @@ -222,7 +222,7 @@ setup: --- "Test delete in-use filter": - do: - xpack.ml.put_job: + ml.put_job: job_id: filter-crud body: > { @@ -247,21 +247,21 @@ setup: } - do: catch: conflict - xpack.ml.delete_filter: + ml.delete_filter: filter_id: "filter-foo" --- "Test non-existing filter": - do: catch: missing - xpack.ml.delete_filter: + ml.delete_filter: filter_id: "does_not_exist" --- "Test valid delete filter": - do: - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" - match: { count: 1 } @@ -271,26 +271,26 @@ setup: items: ["abc", "xyz"] - do: - xpack.ml.delete_filter: + ml.delete_filter: filter_id: "filter-foo" - do: catch: missing - xpack.ml.get_filters: + ml.get_filters: filter_id: "filter-foo" --- "Test get all filter given no filter exists": - do: - xpack.ml.delete_filter: + ml.delete_filter: filter_id: "filter-foo" - do: - xpack.ml.delete_filter: + ml.delete_filter: filter_id: "filter-foo2" - do: - xpack.ml.get_filters: {} + ml.get_filters: {} - match: { count: 0 } - match: { filters: [] } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/find_file_structure.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/find_file_structure.yml index 7f1cf3137a1ba..7c6aff66e3df2 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/find_file_structure.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/find_file_structure.yml @@ -8,7 +8,7 @@ setup: # This is to stop the usual content type randomization, which # would obviously ruin the results for this particular test Content-Type: "application/json" - xpack.ml.find_file_structure: + ml.find_file_structure: lines_to_sample: 3 timeout: 10s body: @@ -65,7 +65,7 @@ setup: # This is to stop the usual content type randomization, which # would obviously ruin the results for this particular test Content-Type: "application/json" - xpack.ml.find_file_structure: + ml.find_file_structure: charset: UTF-8 format: ndjson timestamp_field: time diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml index df44751a37cd9..433a49362ff62 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/forecast.yml @@ -1,6 +1,6 @@ setup: - do: - xpack.ml.put_job: + ml.put_job: job_id: forecast-job body: > { @@ -17,21 +17,21 @@ setup: "Test forecast unknown job": - do: catch: missing - xpack.ml.forecast: + ml.forecast: job_id: "non-existing-job" --- "Test forecast on closed job": - do: catch: /status_exception/ - xpack.ml.forecast: + ml.forecast: job_id: "forecast-job" --- "Test forecast given duration is zero": - do: catch: /\[duration\] must be positive[:] \[0s\]/ - xpack.ml.forecast: + ml.forecast: job_id: "forecast-job" duration: "0s" @@ -39,7 +39,7 @@ setup: "Test forecast given duration is negative": - do: catch: /\[duration\] must be positive[:] \[-1\]/ - xpack.ml.forecast: + ml.forecast: job_id: "forecast-job" duration: "-1s" @@ -47,6 +47,6 @@ setup: "Test forecast given expires_in is negative": - do: catch: /\[expires_in\] must be non-negative[:] \[-1\]/ - xpack.ml.forecast: + ml.forecast: job_id: "forecast-job" expires_in: "-1s" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml index 2bc1a25ddad73..046044ed38b63 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeed_stats.yml @@ -34,7 +34,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-datafeed-stats-1 body: > { @@ -56,7 +56,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-datafeed-stats-2 body: > { @@ -76,7 +76,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: datafeed-1 body: > { @@ -88,7 +88,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: datafeed-2 body: > { @@ -102,14 +102,14 @@ setup: - do: catch: missing - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: missing-datafeed --- "Test get datafeed stats with expression that does not match and allow_no_datafeeds": - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "missing-*" allow_no_datafeeds: true - match: { count: 0 } @@ -120,7 +120,7 @@ setup: - do: catch: missing - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "missing-*" allow_no_datafeeds: false @@ -128,14 +128,14 @@ setup: "Test get single datafeed stats": - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: datafeed-1 - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.state: "stopped"} - is_false: datafeeds.0.node - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: datafeed-2 - match: { datafeeds.0.datafeed_id: "datafeed-2"} - match: { datafeeds.0.state: "stopped"} @@ -145,16 +145,16 @@ setup: "Test get stats for started datafeed": - do: - xpack.ml.open_job: + ml.open_job: job_id: get-datafeed-stats-1 - do: - xpack.ml.start_datafeed: + ml.start_datafeed: "datafeed_id": "datafeed-1" "start": 0 - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: datafeed-1 - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.state: "started"} @@ -166,25 +166,25 @@ setup: "Test implicit get all datafeed stats given started datafeeds": - do: - xpack.ml.open_job: + ml.open_job: job_id: get-datafeed-stats-1 - do: - xpack.ml.start_datafeed: + ml.start_datafeed: "datafeed_id": "datafeed-1" "start": 0 - do: - xpack.ml.open_job: + ml.open_job: job_id: get-datafeed-stats-2 - do: - xpack.ml.start_datafeed: + ml.start_datafeed: "datafeed_id": "datafeed-2" "start": 0 - do: - xpack.ml.get_datafeed_stats: {} + ml.get_datafeed_stats: {} - match: { count: 2 } - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.state: "started"} @@ -195,7 +195,7 @@ setup: "Test explicit get all datafeed stats given stopped datafeeds": - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: _all - match: { count: 2 } - match: { datafeeds.0.datafeed_id: "datafeed-1"} @@ -207,7 +207,7 @@ setup: "Test implicit get all datafeed stats given stopped datafeeds": - do: - xpack.ml.get_datafeed_stats: {} + ml.get_datafeed_stats: {} - match: { count: 2 } - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.state: "stopped"} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml index e1509084d9186..5595f4d99077b 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_datafeeds.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-datafeed-1 body: > { @@ -23,7 +23,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-datafeed-2 body: > { @@ -40,7 +40,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: datafeed-1 body: > { @@ -52,7 +52,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: datafeed-2 body: > { @@ -66,20 +66,20 @@ setup: - do: catch: missing - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: missing-datafeed --- "Test get single datafeed": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: datafeed-1 - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.job_id: "get-datafeed-1"} - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: datafeed-2 - match: { datafeeds.0.datafeed_id: "datafeed-2"} - match: { datafeeds.0.job_id: "get-datafeed-2"} @@ -88,7 +88,7 @@ setup: "Test explicit get all datafeeds": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: _all - match: { count: 2 } - match: { datafeeds.0.datafeed_id: "datafeed-1"} @@ -100,7 +100,7 @@ setup: "Test implicit get all datafeeds": - do: - xpack.ml.get_datafeeds: {} + ml.get_datafeeds: {} - match: { count: 2 } - match: { datafeeds.0.datafeed_id: "datafeed-1"} - match: { datafeeds.0.job_id: "get-datafeed-1"} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_model_snapshots.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_model_snapshots.yml index 33da3db73cbf8..df8fd41ca04d6 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_model_snapshots.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/get_model_snapshots.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-model-snapshots body: > { @@ -92,7 +92,7 @@ setup: --- "Test get model snapshots API with no params": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" - match: { count: 2 } @@ -102,7 +102,7 @@ setup: --- "Test get model snapshots API with _all": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" snapshot_id: "_all" @@ -113,7 +113,7 @@ setup: --- "Test get specific model snapshot": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" snapshot_id: "2" @@ -123,7 +123,7 @@ setup: --- "Test get model snapshots API with start/end": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" @@ -135,7 +135,7 @@ setup: --- "Test get model snapshots API with ascending": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" desc: false @@ -146,7 +146,7 @@ setup: --- "Test get model snapshots API with size": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" size: 1 @@ -157,7 +157,7 @@ setup: --- "Test get model snapshots API with from": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "get-model-snapshots" from: 1 @@ -169,5 +169,5 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "non-existent-job" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/index_layout.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/index_layout.yml index fac725e8d5efe..c0be64dd30e1f 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/index_layout.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/index_layout.yml @@ -5,7 +5,7 @@ setup: "Test CRUD on two jobs in shared index": - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-job body: > { @@ -28,7 +28,7 @@ setup: - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-job2 body: > { @@ -50,22 +50,22 @@ setup: - match: { job_id: "index-layout-job2" } - do: - xpack.ml.open_job: + ml.open_job: job_id: index-layout-job - do: - xpack.ml.open_job: + ml.open_job: job_id: index-layout-job2 - do: - xpack.ml.post_data: + ml.post_data: job_id: index-layout-job body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"} - do: - xpack.ml.post_data: + ml.post_data: job_id: index-layout-job2 body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} @@ -73,23 +73,23 @@ setup: - do: - xpack.ml.flush_job: + ml.flush_job: job_id: index-layout-job - match: { flushed: true } - do: - xpack.ml.flush_job: + ml.flush_job: job_id: index-layout-job2 - match: { flushed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: index-layout-job - match: { closed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: index-layout-job2 - match: { closed: true } @@ -202,7 +202,7 @@ setup: key: value - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "index-layout-job" - match: { acknowledged: true } @@ -270,7 +270,7 @@ setup: - match: {count: 3} - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "index-layout-job2" - match: { acknowledged: true } @@ -338,7 +338,7 @@ setup: "Test unrelated index": - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-job body: > { @@ -360,11 +360,11 @@ setup: - match: { job_id: "index-layout-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: index-layout-job - do: - xpack.ml.post_data: + ml.post_data: job_id: index-layout-job body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} @@ -411,17 +411,17 @@ setup: job_id: foo - do: - xpack.ml.flush_job: + ml.flush_job: job_id: index-layout-job - match: { flushed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: index-layout-job - match: { closed: true } - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "index-layout-job" - match: { acknowledged: true } @@ -490,7 +490,7 @@ setup: "Test delete removes quantiles": - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-quantiles-job body: > { @@ -523,7 +523,7 @@ setup: indices.refresh: {} - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "index-layout-quantiles-job" - match: { acknowledged: true } @@ -538,7 +538,7 @@ setup: "Test delete removes state": - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-state-job body: > { @@ -620,7 +620,7 @@ setup: indices.refresh: {} - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "index-layout-state-job" - match: { acknowledged: true } @@ -648,7 +648,7 @@ setup: index: .ml-state - do: - xpack.ml.put_job: + ml.put_job: job_id: index-layout-force-close-job body: > { @@ -668,18 +668,18 @@ setup: - match: { job_id: "index-layout-force-close-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: index-layout-force-close-job - do: - xpack.ml.post_data: + ml.post_data: job_id: index-layout-force-close-job body: > {"airline":"AAL","responsetime":"132.2046","sourcetype":"farequote","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","sourcetype":"farequote","time":"1403481700"} - do: - xpack.ml.close_job: + ml.close_job: job_id: index-layout-force-close-job force: true - match: { closed: true } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/job_groups.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/job_groups.yml index c398cc15fafe2..c95c16b3e27e3 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/job_groups.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/job_groups.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-foo-1 body: > { @@ -21,7 +21,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-foo-2 body: > { @@ -38,7 +38,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-bar-1 body: > { @@ -55,7 +55,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-bar-2 body: > { @@ -72,7 +72,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-nogroup body: > { @@ -90,7 +90,7 @@ setup: - do: catch: /resource_already_exists_exception/ - xpack.ml.put_job: + ml.put_job: job_id: foo-group body: > { @@ -105,7 +105,7 @@ setup: - do: catch: /resource_already_exists_exception/ - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-job-with-group-matching-existing-job-id body: > { @@ -121,7 +121,7 @@ setup: - do: catch: /resource_already_exists_exception/ - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-job-with-group-matching-its-id body: > { @@ -137,7 +137,7 @@ setup: - do: catch: /Invalid group id ''; must be non-empty string and may contain lowercase alphanumeric \(a-z and 0-9\), hyphens or underscores; must start and end with alphanumeric/ - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-job-with-empty-group body: > { @@ -153,7 +153,7 @@ setup: - do: catch: /Invalid group id '___'; must be non-empty string and may contain lowercase alphanumeric \(a-z and 0-9\), hyphens or underscores; must start and end with alphanumeric/ - xpack.ml.put_job: + ml.put_job: job_id: test-job-groups-job-with-invalid-group body: > { @@ -168,7 +168,7 @@ setup: "Test get job API": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "_all" - match: { count: 5 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} @@ -178,41 +178,41 @@ setup: - match: { jobs.4.job_id: "test-job-groups-nogroup"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "test-job-groups-bar-1" - match: { count: 1 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "foo-group" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-foo-1"} - match: { jobs.1.job_id: "test-job-groups-foo-2"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "bar-group" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} - match: { jobs.1.job_id: "test-job-groups-bar-2"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "ones" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} - match: { jobs.1.job_id: "test-job-groups-foo-1"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "twos" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-bar-2"} - match: { jobs.1.job_id: "test-job-groups-foo-2"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "*-group" - match: { count: 4 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} @@ -221,7 +221,7 @@ setup: - match: { jobs.3.job_id: "test-job-groups-foo-2"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "bar-group,test-job-groups-nogroup" - match: { count: 3 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} @@ -232,7 +232,7 @@ setup: "Test get job stats API": - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "foo-group" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-foo-1"} @@ -242,15 +242,15 @@ setup: "Test close job API": - do: - xpack.ml.open_job: + ml.open_job: job_id: "test-job-groups-foo-1" - do: - xpack.ml.open_job: + ml.open_job: job_id: "test-job-groups-bar-1" - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "ones" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} @@ -259,11 +259,11 @@ setup: - match: { jobs.1.state: opened} - do: - xpack.ml.close_job: + ml.close_job: job_id: "ones" - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "ones" - match: { count: 2 } - match: { jobs.0.job_id: "test-job-groups-bar-1"} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml index 32b7785e42506..707da022f44b8 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_crud.yml @@ -2,13 +2,13 @@ "Test get all jobs and stats given no job exists": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "_all" - match: { count: 0 } - match: { jobs: [] } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "_all" - match: { count: 0 } - match: { jobs: [] } @@ -17,7 +17,7 @@ "Test get jobs with expression that does not match and allow_no_jobs": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "missing-*" allow_no_jobs: true - match: { count: 0 } @@ -28,7 +28,7 @@ - do: catch: missing - xpack.ml.get_jobs: + ml.get_jobs: job_id: "missing-*" allow_no_jobs: false @@ -36,7 +36,7 @@ "Test job crud apis": - do: - xpack.ml.put_job: + ml.put_job: job_id: job-crud-test-apis body: > { @@ -56,7 +56,7 @@ - match: { analysis_limits.categorization_examples_limit: 4 } - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: "job-crud-test-apis" - match: { count: 1 } - match: { jobs.0.job_id: "job-crud-test-apis" } @@ -73,7 +73,7 @@ - match: { \.ml-anomalies-shared.aliases.\.ml-anomalies-\.write-job-crud-test-apis: {} } - do: - xpack.ml.delete_job: + ml.delete_job: job_id: "job-crud-test-apis" - match: { acknowledged: true } @@ -96,7 +96,7 @@ "Test put job with model_memory_limit as number": - do: - xpack.ml.put_job: + ml.put_job: job_id: job-model-memory-limit-as-number body: > { @@ -116,7 +116,7 @@ "Test put job with model_memory_limit as string": - do: - xpack.ml.put_job: + ml.put_job: job_id: job-model-memory-limit-as-string body: > { @@ -136,14 +136,14 @@ "Test get job API with non existing job id": - do: catch: missing - xpack.ml.get_jobs: + ml.get_jobs: job_id: "non-existing" --- "Test put job with inconsistent body/param ids": - do: catch: /illegal_argument_exception/ - xpack.ml.put_job: + ml.put_job: job_id: an_id body: > { @@ -162,7 +162,7 @@ - do: catch: /Inconsistent job_id; 'a_different_id' specified in the body differs from 'an_id' specified as a URL argument/ - xpack.ml.put_job: + ml.put_job: job_id: an_id body: > { @@ -182,7 +182,7 @@ --- "Test put job with id that is already taken": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-id-already-taken body: > { @@ -202,7 +202,7 @@ - do: catch: /resource_already_exists_exception/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-id-already-taken body: > { @@ -220,7 +220,7 @@ } - do: catch: /The job cannot be created with the Id 'jobs-crud-id-already-taken'. The Id is already used./ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-id-already-taken body: > { @@ -238,7 +238,7 @@ } - do: catch: param - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-id-already-taken body: > { @@ -258,7 +258,7 @@ --- "Test update job": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-update-job body: > { @@ -291,11 +291,11 @@ - match: { job_id: "jobs-crud-update-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-update-job - do: - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-update-job body: > { @@ -352,7 +352,7 @@ - do: catch: "/Cannot update analysis_limits while the job is open/" - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-update-job body: > { @@ -362,12 +362,12 @@ } - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-update-job - match: { closed: true } - do: - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-update-job body: > { @@ -378,7 +378,7 @@ - match: { analysis_limits.model_memory_limit: "20mb" } - do: - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-update-job body: > { @@ -390,7 +390,7 @@ - do: catch: bad_request - xpack.ml.update_job: + ml.update_job: job_id: _all body: > { @@ -402,7 +402,7 @@ - skip: features: headers - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-model-memory-limit-decrease body: > { @@ -439,7 +439,7 @@ - do: catch: /Invalid update value for analysis_limits[:] model_memory_limit cannot be decreased below current usage; current usage \[9mb\], update had \[5mb\]/ - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-model-memory-limit-decrease body: > { @@ -450,7 +450,7 @@ # Decreasing over current usage works - do: - xpack.ml.update_job: + ml.update_job: job_id: jobs-crud-model-memory-limit-decrease body: > { @@ -464,13 +464,13 @@ "Test delete job that does not exist": - do: catch: missing - xpack.ml.delete_job: + ml.delete_job: job_id: not-a-job --- "Test delete job that is referred by a datafeed": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-datafeed-job body: > { @@ -489,7 +489,7 @@ - match: { job_id: "jobs-crud-datafeed-job" } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: jobs-crud-test-datafeed-1 body: > { @@ -501,13 +501,13 @@ - do: catch: /Cannot delete job \[jobs-crud-datafeed-job\] because datafeed \[jobs-crud-test-datafeed-1\] refers to it/ - xpack.ml.delete_job: + ml.delete_job: job_id: jobs-crud-datafeed-job --- "Test delete job that is opened": - do: - xpack.ml.put_job: + ml.put_job: job_id: delete-opened-job body: > { @@ -525,13 +525,13 @@ - match: { job_id: "delete-opened-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: delete-opened-job - match: { opened: true } - do: catch: /Cannot delete job \[delete-opened-job\] because the job is opened/ - xpack.ml.delete_job: + ml.delete_job: job_id: delete-opened-job --- @@ -539,7 +539,7 @@ - skip: features: headers - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-close-job body: > { @@ -558,11 +558,11 @@ - match: { job_id: "jobs-crud-close-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-close-job - do: - xpack.ml.post_data: + ml.post_data: job_id: jobs-crud-close-job body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} @@ -570,33 +570,33 @@ - do: - xpack.ml.flush_job: + ml.flush_job: job_id: jobs-crud-close-job - match: { flushed: true } - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: jobs-crud-close-job - match: {"jobs.0.state": opened} - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-close-job - match: { closed: true } - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: jobs-crud-close-job - match: {"jobs.0.state": closed} --- "Test closing a closed job isn't an error": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-close-a-closed-job body: > { @@ -614,23 +614,23 @@ - match: { job_id: "jobs-crud-close-a-closed-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-close-a-closed-job - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-close-a-closed-job - match: { closed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-close-a-closed-job - match: { closed: true } --- "Test close all jobs": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-close-all-1 body: > { @@ -648,7 +648,7 @@ - match: { job_id: "jobs-crud-close-all-1" } - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-close-all-2 body: > { @@ -666,16 +666,16 @@ - match: { job_id: "jobs-crud-close-all-2" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-close-all-2 - do: - xpack.ml.close_job: + ml.close_job: job_id: _all - match: { closed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: _all - match: { jobs.0.state: closed } - match: { jobs.1.state: closed } @@ -683,7 +683,7 @@ --- "Test close jobs with expression that matches": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-with-expression-that-matches-foo-1 body: > { @@ -697,7 +697,7 @@ } - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-with-expression-that-matches-foo-2 body: > { @@ -711,7 +711,7 @@ } - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-with-expression-that-matches-bar-1 body: > { @@ -725,30 +725,30 @@ } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-with-expression-that-matches-foo-1 - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-with-expression-that-matches-foo-2 - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-with-expression-that-matches-bar-1 - do: - xpack.ml.close_job: + ml.close_job: job_id: "*foo-*" - match: { closed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "*foo-*" - match: { jobs.0.state: closed } - match: { jobs.1.state: closed } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "*bar-1" - match: { jobs.0.state: opened } @@ -756,7 +756,7 @@ "Test close jobs with expression that does not match and allow_no_jobs": - do: - xpack.ml.close_job: + ml.close_job: job_id: "missing-*" allow_no_jobs: true - match: { closed: true } @@ -766,7 +766,7 @@ - do: catch: missing - xpack.ml.close_job: + ml.close_job: job_id: "missing-*" allow_no_jobs: false @@ -775,7 +775,7 @@ - skip: features: headers - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-force-close-job body: > { @@ -797,11 +797,11 @@ - match: { job_id: "jobs-crud-force-close-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-force-close-job - do: - xpack.ml.post_data: + ml.post_data: job_id: jobs-crud-force-close-job body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} @@ -809,19 +809,19 @@ - do: - xpack.ml.flush_job: + ml.flush_job: job_id: jobs-crud-force-close-job - match: { flushed: true } - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: jobs-crud-force-close-job - match: {"jobs.0.state": opened} - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-force-close-job force: true - match: { closed: true } @@ -829,14 +829,14 @@ - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: jobs-crud-force-close-job - match: {"jobs.0.state": closed} --- "Test force closing a closed job isn't an error": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-close-a-closed-job body: > { @@ -854,17 +854,17 @@ - match: { job_id: "jobs-crud-close-a-closed-job" } - do: - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-close-a-closed-job - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-close-a-closed-job force: true - match: { closed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-close-a-closed-job force: true - match: { closed: true } @@ -873,12 +873,12 @@ "Test open and close an unknown job is resource not found": - do: catch: missing - xpack.ml.open_job: + ml.open_job: job_id: jobs-crud-some-missing-job-i-made-up - do: catch: missing - xpack.ml.close_job: + ml.close_job: job_id: jobs-crud-some-missing-job-i-made-up --- @@ -897,7 +897,7 @@ - do: catch: /status_exception/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-existing-docs body: > { @@ -925,7 +925,7 @@ - do: catch: /status_exception/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-existing-docs body: > { @@ -963,7 +963,7 @@ - do: catch: /status_exception/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-existing-result-docs body: > { @@ -980,7 +980,7 @@ - do: catch: /illegal_argument_exception/ - xpack.ml.put_job: + ml.put_job: job_id: has-model-snapshot-id body: > { @@ -998,7 +998,7 @@ - do: catch: /illegal_argument_exception/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-time-field-in-analysis_config body: > { @@ -1013,7 +1013,7 @@ - do: catch: /data_description.time_field may not be used in the analysis_config/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-time-field-in-analysis_config body: > { @@ -1037,7 +1037,7 @@ - do: catch: /Cannot create job \[closed-results-job\] as it requires closed index \[\.ml-anomalies-shared\]/ - xpack.ml.put_job: + ml.put_job: job_id: closed-results-job body: > { @@ -1064,7 +1064,7 @@ - do: catch: /Cannot create job \[closed-results-job\] as it requires closed index \[\.ml-state\]/ - xpack.ml.put_job: + ml.put_job: job_id: closed-results-job body: > { @@ -1092,7 +1092,7 @@ - match: {transient.xpack.ml.max_model_memory_limit: "9g"} - do: - xpack.ml.put_job: + ml.put_job: job_id: job-model-memory-limit-below-global-max body: > { @@ -1110,7 +1110,7 @@ - do: catch: /model_memory_limit \[10gb\] must be less than the value of the xpack.ml.max_model_memory_limit setting \[9gb\]/ - xpack.ml.put_job: + ml.put_job: job_id: job-model-memory-limit-above-global-max body: > { @@ -1134,7 +1134,7 @@ - match: {transient: {}} - do: - xpack.ml.put_job: + ml.put_job: job_id: job-model-memory-limit-above-removed-global-max body: > { @@ -1160,7 +1160,7 @@ - do: warnings: - Creating jobs with delimited data format is deprecated. Please use xcontent instead. - xpack.ml.put_job: + ml.put_job: job_id: delimited-format-job body: > { @@ -1180,7 +1180,7 @@ --- "Test job with named categorization_analyzer": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-categorization-analyzer-job body: > { @@ -1199,7 +1199,7 @@ --- "Test job with custom categorization_analyzer": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-categorization-analyzer-job body: > { @@ -1225,7 +1225,7 @@ "Test job with categorization_analyzer and categorization_filters": - do: catch: /categorization_filters cannot be used with categorization_analyzer - instead specify them as pattern_replace char_filters in the analyzer/ - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-categorization-analyzer-job body: > { @@ -1248,7 +1248,7 @@ "Test job with rules": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-crud-rules body: > { @@ -1284,7 +1284,7 @@ } - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: jobs-crud-rules - match: { count: 1 } - match: { @@ -1313,7 +1313,7 @@ --- "Test function shortcut expansion": - do: - xpack.ml.put_job: + ml.put_job: job_id: jobs-function-shortcut-expansion body: > { @@ -1340,7 +1340,7 @@ - match: {transient.cluster.persistent_tasks.allocation.enable: "none"} - do: - xpack.ml.put_job: + ml.put_job: job_id: persistent-task-allocation-allowed-test body: > { @@ -1357,7 +1357,7 @@ - do: catch: /no persistent task assignments are allowed due to cluster settings/ - xpack.ml.open_job: + ml.open_job: job_id: persistent-task-allocation-allowed-test - do: @@ -1370,6 +1370,6 @@ - match: {transient.cluster.persistent_tasks.allocation.enable: "all"} - do: - xpack.ml.open_job: + ml.open_job: job_id: persistent-task-allocation-allowed-test - match: { opened: true } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml index 507b6ddd45828..1ef10bfec1472 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-1 body: > { @@ -24,7 +24,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-2 body: > { @@ -46,20 +46,20 @@ setup: - do: catch: missing - xpack.ml.get_jobs: + ml.get_jobs: job_id: missing-job --- "Test get single job": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: jobs-get-1 - match: { jobs.0.job_id: "jobs-get-1"} - match: { jobs.0.description: "Job 1"} - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: jobs-get-2 - match: { jobs.0.job_id: "jobs-get-2"} - match: { jobs.0.description: "Job 2"} @@ -68,7 +68,7 @@ setup: "Test explicit get all jobs": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: _all - match: { count: 2 } - match: { jobs.0.job_id: "jobs-get-1"} @@ -80,7 +80,7 @@ setup: "Test implicit get all jobs": - do: - xpack.ml.get_jobs: {} + ml.get_jobs: {} - match: { count: 2 } - match: { jobs.0.job_id: "jobs-get-1"} - match: { jobs.0.description: "Job 1"} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_buckets.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_buckets.yml index 6feecf82333b2..d70d964a83acb 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_buckets.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_buckets.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-buckets body: > { @@ -77,7 +77,7 @@ setup: --- "Test result buckets api with time range": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" start: "2016-05-01T00:00:00Z" end: "2016-07-01T00:00:00Z" @@ -90,7 +90,7 @@ setup: --- "Test result buckets api": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" - match: { count: 3 } @@ -110,7 +110,7 @@ setup: --- "Test get buckets with paging": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" from: 1 size: 2 @@ -125,7 +125,7 @@ setup: --- "Test get buckets with paging in body": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: > { @@ -145,7 +145,7 @@ setup: --- "Test get buckets given exclude_interim is false": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" exclude_interim: false @@ -154,7 +154,7 @@ setup: --- "Test get buckets given exclude_interim is true": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" exclude_interim: true @@ -167,7 +167,7 @@ setup: --- "Test result single bucket api": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" @@ -178,7 +178,7 @@ setup: --- "Test result single bucket api with empty body": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" body: {} @@ -191,35 +191,35 @@ setup: "Test mutually-exclusive params": - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" start: "2016-05-01T00:00:00Z" - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" end: "2016-05-01T00:00:00Z" - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" from: "2016-05-01T00:00:00Z" - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" end: "2016-05-01T00:00:00Z" - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" timestamp: "2016-06-01T00:00:00Z" anomaly_score: "80.0" @@ -228,7 +228,7 @@ setup: "Test mutually-exclusive params via body": - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: timestamp: "2016-06-01T00:00:00Z" @@ -236,7 +236,7 @@ setup: - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: timestamp: "2016-06-01T00:00:00Z" @@ -244,7 +244,7 @@ setup: - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: timestamp: "2016-06-01T00:00:00Z" @@ -252,7 +252,7 @@ setup: - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: timestamp: "2016-06-01T00:00:00Z" @@ -260,7 +260,7 @@ setup: - do: catch: bad_request - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" body: timestamp: "2016-06-01T00:00:00Z" @@ -270,13 +270,13 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.get_buckets: + ml.get_buckets: job_id: "non-existent-job" --- "Test get buckets with sort field and secondary sort by time": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" sort: anomaly_score @@ -289,7 +289,7 @@ setup: - match: { buckets.2.timestamp: 1464739200000 } - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "jobs-get-result-buckets" sort: anomaly_score desc: true diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_categories.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_categories.yml index c5545120d8c60..3db46d6904f6a 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_categories.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_categories.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-categories body: > { @@ -54,7 +54,7 @@ setup: --- "Test result categories api": - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" - match: { count: 2 } @@ -66,7 +66,7 @@ setup: --- "Test get categories with pagination": - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" size: 1 @@ -75,7 +75,7 @@ setup: - match: { categories.0.category_id: 1 } - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" from: 1 size: 2 @@ -87,7 +87,7 @@ setup: --- "Test post get categories with pagination": - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" body: > { @@ -99,7 +99,7 @@ setup: - match: { categories.0.category_id: 1 } - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" body: > { @@ -113,7 +113,7 @@ setup: --- "Test get category by id": - do: - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: "1" @@ -124,21 +124,21 @@ setup: "Test with invalid param combinations": - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 from: 0 - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 size: 1 - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 from: 0 @@ -148,7 +148,7 @@ setup: "Test with invalid param combinations via body": - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 body: @@ -156,7 +156,7 @@ setup: - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 body: @@ -164,7 +164,7 @@ setup: - do: catch: bad_request - xpack.ml.get_categories: + ml.get_categories: job_id: "jobs-get-result-categories" category_id: 1 body: @@ -175,5 +175,5 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.get_categories: + ml.get_categories: job_id: "non-existent-job" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_influencers.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_influencers.yml index b25884da5fd00..b1569ef8370b1 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_influencers.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_influencers.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: get-influencers-test body: > { @@ -84,7 +84,7 @@ setup: --- "Test result influencers api": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" - match: { count: 3 } @@ -98,7 +98,7 @@ setup: --- "Test get influencers with paging": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" from: 1 size: 2 @@ -113,7 +113,7 @@ setup: --- "Test get influencers with paging in body": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" body: > { @@ -133,7 +133,7 @@ setup: --- "Test get influencers given exclude_interim false": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" exclude_interim: false @@ -142,7 +142,7 @@ setup: --- "Test get influencers given exclude_interim true": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" exclude_interim: true @@ -155,7 +155,7 @@ setup: --- "Test result influencers api with time range": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" start: "2016-06-01T00:00:00Z" end: "2016-06-01T01:00:00Z" @@ -167,13 +167,13 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.get_influencers: + ml.get_influencers: job_id: "non-existent-job" --- "Test get influencers api with influencer score filter": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" influencer_score: 70 @@ -183,7 +183,7 @@ setup: --- "Test get influencers api sort": - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" desc: false @@ -193,7 +193,7 @@ setup: - match: { influencers.2.influencer_score: 80} - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "get-influencers-test" sort: timestamp diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_overall_buckets.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_overall_buckets.yml index 654e98c468fbe..66821f1aac491 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_overall_buckets.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_overall_buckets.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-overall-buckets-60 body: > { @@ -21,7 +21,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-overall-buckets-30 body: > { @@ -38,7 +38,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-overall-buckets-17 body: > { @@ -238,13 +238,13 @@ setup: "Test overall buckets given missing job": - do: catch: missing - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "missing-job" --- "Test overall buckets given non-matching expression and allow_no_jobs": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "none-matching-*" - match: { count: 0 } @@ -252,7 +252,7 @@ setup: "Test overall buckets given non-matching expression and not allow_no_jobs": - do: catch: missing - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "none-matching-*" allow_no_jobs: false @@ -260,7 +260,7 @@ setup: "Test overall buckets given top_n is 0": - do: catch: /\[topN\] parameter must be positive, found \[0\]/ - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 0 @@ -268,14 +268,14 @@ setup: "Test overall buckets given top_n is negative": - do: catch: /\[topN\] parameter must be positive, found \[-1\]/ - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: -1 --- "Test overall buckets given default": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" - match: { count: 3 } - match: { overall_buckets.0.timestamp: 1464739200000 } @@ -314,7 +314,7 @@ setup: --- "Test overall buckets given top_n is 2": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-group" top_n: 2 - match: { count: 3 } @@ -354,7 +354,7 @@ setup: --- "Test overall buckets given top_n is 3": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-group" top_n: 3 - match: { count: 3 } @@ -394,7 +394,7 @@ setup: --- "Test overall buckets given top_n is greater than the job count": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 333 - match: { count: 3 } @@ -434,7 +434,7 @@ setup: --- "Test overall buckets given overall_score filter": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 2 overall_score: 50.0 @@ -445,7 +445,7 @@ setup: --- "Test overall buckets given exclude_interim": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" exclude_interim: true - match: { count: 3 } @@ -485,7 +485,7 @@ setup: --- "Test overall buckets given string start and end params": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 2 start: "2016-06-01T00:30:00Z" @@ -498,7 +498,7 @@ setup: --- "Test overall buckets given epoch start and end params": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 2 start: 1464744600000 @@ -518,7 +518,7 @@ setup: "Test overall buckets given invalid start param": - do: catch: /.*Query param \[start\] with value \[invalid\] cannot be parsed as a date or converted to a number.*/ - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" start: "invalid" @@ -526,14 +526,14 @@ setup: "Test overall buckets given invalid end param": - do: catch: /.*Query param \[end\] with value \[invalid\] cannot be parsed as a date or converted to a number.*/ - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" end: "invalid" --- "Test overall buckets given bucket_span": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" bucket_span: "2h" - match: { count: 2 } @@ -565,7 +565,7 @@ setup: --- "Test overall buckets given bucket_span and top_n is 2": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" top_n: 2 bucket_span: "2h" @@ -599,7 +599,7 @@ setup: --- "Test overall buckets given bucket_span and overall_score filter": - do: - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" bucket_span: "2h" overall_score: "41.0" @@ -622,6 +622,6 @@ setup: "Test overall buckets given bucket_span is smaller than max job bucket_span": - do: catch: /.*Param \[bucket_span\] must be greater or equal to the max bucket_span \[60m\]*/ - xpack.ml.get_overall_buckets: + ml.get_overall_buckets: job_id: "jobs-get-result-overall-buckets-*" bucket_span: "59m" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_records.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_records.yml index a050ddf286297..5e91b80754039 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_records.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_result_records.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-result-records body: > { @@ -61,7 +61,7 @@ setup: --- "Test result records api": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" - match: { count: 2 } @@ -75,7 +75,7 @@ setup: --- "Test get records with paging": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" from: 1 size: 1 @@ -89,7 +89,7 @@ setup: --- "Test get records with paging in body": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" body: > { @@ -108,7 +108,7 @@ setup: --- "Test get records given exclude_interim is false": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" exclude_interim: false @@ -117,7 +117,7 @@ setup: --- "Test get records given exclude_interim is true": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" exclude_interim: true @@ -128,7 +128,7 @@ setup: --- "Test result records api with time range": - do: - xpack.ml.get_records: + ml.get_records: job_id: "jobs-get-result-records" start: "2016-05-01T00:00:00Z" end: "2016-06-01T01:00:00Z" @@ -142,5 +142,5 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.get_records: + ml.get_records: job_id: "non-existent-job" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml index 75003bbff053d..a764775301824 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/jobs_get_stats.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: job-stats-test body: > { @@ -27,13 +27,13 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.open_job: + ml.open_job: job_id: job-stats-test - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: jobs-get-stats-datafeed-job body: > { @@ -55,13 +55,13 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.open_job: + ml.open_job: job_id: jobs-get-stats-datafeed-job - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: datafeed-1 body: > { @@ -74,20 +74,20 @@ setup: "Test get job stats after uploading data prompting the creation of some stats": - do: - xpack.ml.post_data: + ml.post_data: job_id: job-stats-test body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","time":"1403481600"} - do: - xpack.ml.flush_job: + ml.flush_job: job_id: job-stats-test - match: { flushed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: job-stats-test - match: { jobs.0.job_id : job-stats-test } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -104,24 +104,24 @@ setup: "Test get job stats for closed job": - do: - xpack.ml.post_data: + ml.post_data: job_id: job-stats-test body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","time":"1403481600"} - do: - xpack.ml.flush_job: + ml.flush_job: job_id: job-stats-test - match: { flushed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: job-stats-test - match: { closed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: job-stats-test - match: { jobs.0.job_id : job-stats-test } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -136,7 +136,7 @@ setup: "Test get job stats of datafeed job that has not received any data": - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: jobs-get-stats-datafeed-job - match: { jobs.0.job_id : jobs-get-stats-datafeed-job } - match: { jobs.0.data_counts.processed_record_count: 0 } @@ -148,7 +148,7 @@ setup: "Test get all job stats with _all": - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: _all - match: { count: 2 } - match: { jobs.0.state: opened } @@ -158,7 +158,7 @@ setup: "Test get all job stats with wildcard": - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "*" - match: { count: 2 } - match: { jobs.0.state: opened } @@ -168,7 +168,7 @@ setup: "Test get all job stats implicitly": - do: - xpack.ml.get_job_stats: {} + ml.get_job_stats: {} - match: { count: 2 } --- @@ -176,14 +176,14 @@ setup: - do: catch: missing - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: unknown-job --- "Test get job stats given pattern and allow_no_jobs": - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "missing-*" allow_no_jobs: true - match: { count: 0 } @@ -193,7 +193,7 @@ setup: - do: catch: missing - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: "missing-*" allow_no_jobs: false @@ -201,7 +201,7 @@ setup: "Test reading v54 data counts and model size stats": - do: - xpack.ml.put_job: + ml.put_job: job_id: job-stats-v54-bwc-test body: > { @@ -278,7 +278,7 @@ setup: index: [.ml-anomalies-shared] - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: job-stats-v54-bwc-test - match: { jobs.0.job_id : job-stats-v54-bwc-test } - match: { jobs.0.data_counts.processed_record_count: 10 } @@ -288,19 +288,19 @@ setup: "Test no exception on get job stats with missing index": - do: - xpack.ml.post_data: + ml.post_data: job_id: job-stats-test body: > {"airline":"AAL","responsetime":"132.2046","time":"1403481600"} {"airline":"JZA","responsetime":"990.4628","time":"1403481600"} - do: - xpack.ml.close_job: + ml.close_job: job_id: jobs-get-stats-datafeed-job - match: { closed: true } - do: - xpack.ml.close_job: + ml.close_job: job_id: job-stats-test - match: { closed: true } @@ -309,7 +309,7 @@ setup: index: .ml-anomalies-shared - do: - xpack.ml.get_job_stats: {} + ml.get_job_stats: {} - match: { count: 2 } - match: { jobs.0.data_counts.processed_record_count: 0 } - match: { jobs.0.data_counts.processed_field_count: 0 } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml index 576b0295abd53..b230e12589f53 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_anomalies_default_mappings.yml @@ -5,7 +5,7 @@ setup: "Test new fields are mapped as keyword": - do: - xpack.ml.put_job: + ml.put_job: job_id: ml-anomalies-default-mappings-job body: > { @@ -51,7 +51,7 @@ setup: "Test _meta exists when two jobs share an index": - do: - xpack.ml.put_job: + ml.put_job: job_id: ml-anomalies-shared-mappings-job1 body: > { @@ -79,7 +79,7 @@ setup: - is_true: \.ml-anomalies-shared.mappings.doc._meta.version - do: - xpack.ml.put_job: + ml.put_job: job_id: ml-anomalies-shared-mappings-job2 body: > { diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_info.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_info.yml index ce934c1d2f640..7d2b05e852873 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_info.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/ml_info.yml @@ -1,7 +1,7 @@ --- "Test ml info": - do: - xpack.ml.info: {} + ml.info: {} - match: { defaults.anomaly_detectors.model_memory_limit: "1gb" } - match: { defaults.anomaly_detectors.categorization_examples_limit: 4 } - match: { defaults.anomaly_detectors.model_snapshot_retention_days: 1 } @@ -15,7 +15,7 @@ xpack.ml.max_model_memory_limit: "512mb" - do: - xpack.ml.info: {} + ml.info: {} - match: { defaults.anomaly_detectors.model_memory_limit: "512mb" } - match: { defaults.anomaly_detectors.categorization_examples_limit: 4 } - match: { defaults.anomaly_detectors.model_snapshot_retention_days: 1 } @@ -29,7 +29,7 @@ xpack.ml.max_model_memory_limit: "6gb" - do: - xpack.ml.info: {} + ml.info: {} - match: { defaults.anomaly_detectors.model_memory_limit: "1gb" } - match: { defaults.anomaly_detectors.categorization_examples_limit: 4 } - match: { defaults.anomaly_detectors.model_snapshot_retention_days: 1 } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/post_data.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/post_data.yml index 34f7a4bb72fa3..c475ae6ac3f92 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/post_data.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/post_data.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: post-data-job body: > { @@ -24,7 +24,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: post-data-closed-job body: > { @@ -41,13 +41,13 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.open_job: + ml.open_job: job_id: post-data-job --- "Test POST data job api, flush, close and verify DataCounts doc": - do: - xpack.ml.post_data: + ml.post_data: job_id: post-data-job body: - airline: AAL @@ -71,18 +71,18 @@ setup: - match: { latest_record_timestamp: 1403481700000} - do: - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job - match: { flushed: true } - match: { last_finalized_bucket_end: 1403481600000 } - do: - xpack.ml.close_job: + ml.close_job: job_id: post-data-job - match: { closed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: post-data-job - match: { jobs.0.state: "closed" } @@ -106,18 +106,18 @@ setup: --- "Test flush and close job WITHOUT sending any data": - do: - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job - match: { flushed: true } - match: { last_finalized_bucket_end: 0 } - do: - xpack.ml.close_job: + ml.close_job: job_id: post-data-job - match: { closed: true } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: post-data-job - match: { jobs.0.state: "closed" } @@ -125,7 +125,7 @@ setup: "Test flush with skip_time": - do: - xpack.ml.post_data: + ml.post_data: job_id: post-data-job body: - airline: AAL @@ -139,7 +139,7 @@ setup: # Skip a bucket - do: - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job skip_time: 1403488700 - match: { flushed: true } @@ -147,7 +147,7 @@ setup: # Send some data that should be ignored - do: - xpack.ml.post_data: + ml.post_data: job_id: post-data-job body: - airline: AAL @@ -161,7 +161,7 @@ setup: # Send data that will create results for the bucket after the skipped one - do: - xpack.ml.post_data: + ml.post_data: job_id: post-data-job body: - airline: AAL @@ -174,12 +174,12 @@ setup: time: 1403492400 - do: - xpack.ml.close_job: + ml.close_job: job_id: post-data-job - match: { closed: true } - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "post-data-job" - match: { count: 2 } - match: { buckets.0.timestamp: 1403481600000 } @@ -192,7 +192,7 @@ setup: - do: catch: missing - xpack.ml.post_data: + ml.post_data: job_id: not_a_job body: - airline: AAL @@ -206,7 +206,7 @@ setup: - do: catch: /parse_exception/ - xpack.ml.post_data: + ml.post_data: job_id: post-data-job reset_start: not_a_date body: @@ -221,7 +221,7 @@ setup: - do: catch: /parse_exception/ - xpack.ml.post_data: + ml.post_data: job_id: post-data-job reset_end: end_not_a_date body: @@ -238,24 +238,24 @@ setup: "Test Flush data with invalid parameters": - do: catch: missing - xpack.ml.flush_job: + ml.flush_job: job_id: not_a_job - do: catch: /parse_exception/ - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job start: not_a_date - do: catch: /parse_exception/ - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job end: end_not_a_date - do: catch: /parse_exception/ - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-job advance_time: advance_time_not_a_date @@ -263,12 +263,12 @@ setup: "Test open and close with non-existent job id": - do: catch: missing - xpack.ml.open_job: + ml.open_job: job_id: not_a_job - do: catch: missing - xpack.ml.close_job: + ml.close_job: job_id: not_a_job --- @@ -276,12 +276,12 @@ setup: - do: catch: /status_exception/ - xpack.ml.flush_job: + ml.flush_job: job_id: post-data-closed-job - do: catch: /status_exception/ - xpack.ml.post_data: + ml.post_data: job_id: post-data-closed-job body: - airline: AAL diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml index dc7116978dc19..2de179b395cf1 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/preview_datafeed.yml @@ -75,7 +75,7 @@ setup: "Test preview scroll datafeed": - do: - xpack.ml.put_job: + ml.put_job: job_id: preview-datafeed-job body: > { @@ -89,7 +89,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: preview-datafeed-feed body: > { @@ -99,7 +99,7 @@ setup: } - do: - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: preview-datafeed-feed - length: { $body: 4 } - match: { 0.time: 1487376000000 } @@ -119,7 +119,7 @@ setup: "Test preview aggregation datafeed with doc_count": - do: - xpack.ml.put_job: + ml.put_job: job_id: aggregation-doc-count-job body: > { @@ -134,7 +134,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: aggregation-doc-count-feed body: > { @@ -172,7 +172,7 @@ setup: } - do: - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: aggregation-doc-count-feed - length: { $body: 3 } - match: { 0.time: 1487377800000 } @@ -192,7 +192,7 @@ setup: "Test preview single metric aggregation datafeed with different summary count field": - do: - xpack.ml.put_job: + ml.put_job: job_id: aggregation-custom-single-metric-summary-job body: > { @@ -207,7 +207,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: aggregation-custom-single-metric-summary-feed body: > { @@ -237,7 +237,7 @@ setup: } - do: - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: aggregation-custom-single-metric-summary-feed - length: { $body: 2 } - match: { 0.time: 1487377800000 } @@ -251,7 +251,7 @@ setup: "Test preview multi metric aggregation datafeed with different summary count field": - do: - xpack.ml.put_job: + ml.put_job: job_id: aggregation-custom-multi-metric-summary-job body: > { @@ -266,7 +266,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: aggregation-custom-multi-metric-summary-feed body: > { @@ -308,7 +308,7 @@ setup: } - do: - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: aggregation-custom-multi-metric-summary-feed - length: { $body: 3 } - match: { 0.time: 1487377800000 } @@ -332,14 +332,14 @@ setup: - do: catch: missing - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: missing-feed --- "Test preview datafeed with unavailable index": - do: - xpack.ml.put_job: + ml.put_job: job_id: unavailable-job body: > { @@ -353,7 +353,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: unavailable-feed body: > { @@ -364,14 +364,14 @@ setup: - do: catch: missing - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: unavailable-feed --- "Test preview datafeed with query that matches nothing": - do: - xpack.ml.put_job: + ml.put_job: job_id: empty-job body: > { @@ -385,7 +385,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: empty-feed body: > { @@ -398,6 +398,6 @@ setup: } - do: - xpack.ml.preview_datafeed: + ml.preview_datafeed: datafeed_id: empty-feed - length: { $body: 0 } diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/revert_model_snapshot.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/revert_model_snapshot.yml index 5c1321a04d047..f5b37afeba889 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/revert_model_snapshot.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/revert_model_snapshot.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: revert-model-snapshot body: > { @@ -24,13 +24,13 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.open_job: + ml.open_job: job_id: revert-model-snapshot - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.close_job: + ml.close_job: job_id: revert-model-snapshot - do: @@ -216,14 +216,14 @@ setup: "Test revert model with invalid snapshotId": - do: catch: /resource_not_found_exception/ - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: "revert-model-snapshot" snapshot_id: "not_exist" --- "Test revert model with valid snapshotId": - do: - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: "revert-model-snapshot" snapshot_id: "first" @@ -233,7 +233,7 @@ setup: - match: { model.snapshot_doc_count: 0 } - do: - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: "revert-model-snapshot" snapshot_id: "second" @@ -245,7 +245,7 @@ setup: --- "Test revert model with delete_intervening_results": - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "revert-model-snapshot" start: "2016-01-01T00:00:00Z" end: "2016-12-01T00:00:00Z" @@ -253,7 +253,7 @@ setup: - match: { count: 3 } - do: - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: "revert-model-snapshot" snapshot_id: "second" delete_intervening_results: true @@ -265,7 +265,7 @@ setup: index: .ml-anomalies-revert-model-snapshot - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: "revert-model-snapshot" start: "2016-01-01T00:00:00Z" end: "2016-12-01T00:00:00Z" @@ -275,7 +275,7 @@ setup: - match: { buckets.0.timestamp: 1462060800000 } - do: - xpack.ml.get_records: + ml.get_records: job_id: "revert-model-snapshot" start: "2016-01-01T00:00:00Z" end: "2016-12-01T00:00:00Z" @@ -285,7 +285,7 @@ setup: - match: { records.0.timestamp: 1462060800000 } - do: - xpack.ml.get_influencers: + ml.get_influencers: job_id: "revert-model-snapshot" start: "2016-01-01T00:00:00Z" end: "2016-12-01T01:00:00Z" @@ -295,7 +295,7 @@ setup: - match: { influencers.0.timestamp: 1462060800000 } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: revert-model-snapshot - match: { jobs.0.data_counts.latest_record_timestamp: 1464739200000 } @@ -304,6 +304,6 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.revert_model_snapshot: + ml.revert_model_snapshot: job_id: "non-existent-job" snapshot_id: "second" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml index 48607dac7d5b6..081709332dc20 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/start_stop_datafeed.yml @@ -20,7 +20,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: start-stop-datafeed-job body: > { @@ -43,7 +43,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: start-stop-datafeed-datafeed-1 body: > { @@ -55,58 +55,58 @@ setup: --- "Test start and stop datafeed happy path": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: started } - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: stopped } --- "Test force stop datafeed": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: - xpack.ml.start_datafeed: + ml.start_datafeed: "datafeed_id": "start-stop-datafeed-datafeed-1" "start": 0 - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: started } - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: "datafeed_id": "start-stop-datafeed-datafeed-1" force: true - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: stopped } --- "Test start datafeed given start is now": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: "now" - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: started } @@ -114,7 +114,7 @@ setup: "Test start non existing datafeed": - do: catch: missing - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "non-existing-datafeed" start: 0 @@ -122,45 +122,45 @@ setup: "Test start datafeed job, but not open": - do: catch: conflict - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: catch: /cannot start datafeed \[start-stop-datafeed-datafeed-1\] because job \[start-stop-datafeed-job\] is closed/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 --- "Test start already started datafeed job": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: catch: conflict - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: catch: /cannot start datafeed \[start-stop-datafeed-datafeed-1\] because it has already been started/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 --- "Test start given end earlier than start": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: catch: /.* start \[1485910800000\] must be earlier than end \[1485907200000\]/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: "2017-02-01T01:00:00Z" end: "2017-02-01T00:00:00Z" @@ -168,12 +168,12 @@ setup: --- "Test start given end same as start": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: catch: /.* start \[1485910800000\] must be earlier than end \[1485910800000\]/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: "2017-02-01T01:00:00Z" end: "2017-02-01T01:00:00Z" @@ -181,7 +181,7 @@ setup: --- "Test start given datafeed index does not exist": - do: - xpack.ml.update_datafeed: + ml.update_datafeed: datafeed_id: start-stop-datafeed-datafeed-1 body: > { @@ -189,18 +189,18 @@ setup: } - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - do: catch: /datafeed \[start-stop-datafeed-datafeed-1] cannot retrieve data because index \[utopia\] does not exist/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" --- "Test start given field without mappings": - do: - xpack.ml.put_job: + ml.put_job: job_id: start-stop-datafeed-job-field-without-mappings body: > { @@ -217,7 +217,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: start-stop-datafeed-job-field-without-mappings-feed body: > { @@ -227,26 +227,26 @@ setup: } - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job-field-without-mappings" - do: catch: /\[start-stop-datafeed-job-field-without-mappings-feed] cannot retrieve field \[airline2\] because it has no mappings/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-job-field-without-mappings-feed" --- "Test stop non existing datafeed": - do: catch: missing - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "non-existing-datafeed" --- "Test stop with expression that does not match and allow_no_datafeeds": - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "missing-*" allow_no_datafeeds: true - match: { stopped: true } @@ -256,25 +256,25 @@ setup: - do: catch: missing - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "missing-*" allow_no_datafeeds: false --- "Test stop already stopped datafeed job is not an error": - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" --- "Test stop given expression": - do: - xpack.ml.put_job: + ml.put_job: job_id: start-stop-datafeed-job-foo-1 body: > { @@ -291,7 +291,7 @@ setup: } - do: - xpack.ml.put_job: + ml.put_job: job_id: start-stop-datafeed-job-foo-2 body: > { @@ -308,7 +308,7 @@ setup: } - do: - xpack.ml.put_job: + ml.put_job: job_id: start-stop-datafeed-job-bar-1 body: > { @@ -325,7 +325,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: start-stop-datafeed-job-foo-1-feed body: > { @@ -335,7 +335,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: start-stop-datafeed-job-foo-2-feed body: > { @@ -345,7 +345,7 @@ setup: } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: start-stop-datafeed-job-bar-1-feed body: > { @@ -355,44 +355,44 @@ setup: } - do: - xpack.ml.open_job: + ml.open_job: job_id: start-stop-datafeed-job-foo-1 - match: { opened: true } - do: - xpack.ml.open_job: + ml.open_job: job_id: start-stop-datafeed-job-foo-2 - match: { opened: true } - do: - xpack.ml.open_job: + ml.open_job: job_id: start-stop-datafeed-job-bar-1 - match: { opened: true } - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-job-foo-1-feed" - match: { started: true } - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-job-foo-2-feed" - match: { started: true } - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-job-bar-1-feed" - match: { started: true } - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "start-stop-datafeed-job-foo-*" - match: { stopped: true } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-job-foo-*" - match: { datafeeds.0.state: "stopped"} - match: { datafeeds.1.state: "stopped"} - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-job-bar-1-feed" - match: { datafeeds.0.state: "started"} @@ -400,7 +400,7 @@ setup: "Test start datafeed when persistent task allocation disabled": - do: - xpack.ml.open_job: + ml.open_job: job_id: "start-stop-datafeed-job" - match: { opened: true } @@ -415,12 +415,12 @@ setup: - do: catch: /no persistent task assignments are allowed due to cluster settings/ - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: stopped } @@ -434,15 +434,15 @@ setup: - match: {transient.cluster.persistent_tasks.allocation.enable: "all"} - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" start: 0 - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: "start-stop-datafeed-datafeed-1" - match: { datafeeds.0.state: started } - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: "start-stop-datafeed-datafeed-1" diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/update_model_snapshot.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/update_model_snapshot.yml index 777738cd503e4..5d364d72f612d 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/update_model_snapshot.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/update_model_snapshot.yml @@ -4,7 +4,7 @@ setup: - do: headers: Authorization: "Basic eF9wYWNrX3Jlc3RfdXNlcjp4LXBhY2stdGVzdC1wYXNzd29yZA==" # run as x_pack_rest_user, i.e. the test setup superuser - xpack.ml.put_job: + ml.put_job: job_id: update-model-snapshot body: > { @@ -116,7 +116,7 @@ setup: --- "Test with valid description": - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" @@ -124,7 +124,7 @@ setup: - is_false: model_snapshots.0.description - do: - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" body: > @@ -137,7 +137,7 @@ setup: - match: { model.description: "new_description" } - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" @@ -149,7 +149,7 @@ setup: --- "Test duplicate descriptions are allowed": - do: - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" body: > @@ -158,7 +158,7 @@ setup: } - do: - xpack.ml.get_model_snapshots: + ml.get_model_snapshots: job_id: "update-model-snapshot" - match: { count: 2 } @@ -169,7 +169,7 @@ setup: --- "Test with retain": - do: - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" body: > @@ -181,7 +181,7 @@ setup: - match: { model.retain: true } - do: - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-2" body: > @@ -196,7 +196,7 @@ setup: --- "Test with all fields": - do: - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-1" body: > @@ -213,7 +213,7 @@ setup: "Test with unknown job id": - do: catch: missing - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "non-existent-job" snapshot_id: "san" body: > @@ -226,7 +226,7 @@ setup: "Test with unknown snapshot id": - do: catch: missing - xpack.ml.update_model_snapshot: + ml.update_model_snapshot: job_id: "update-model-snapshot" snapshot_id: "snapshot-9999" body: > diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate.yml index 1913fd0ed09f8..c3f9bcc87707e 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate.yml @@ -1,7 +1,7 @@ --- "Test valid job config": - do: - xpack.ml.validate: + ml.validate: body: > { "analysis_config": { @@ -21,7 +21,7 @@ "Test invalid job config": - do: catch: /.data_description. failed to parse field .format./ - xpack.ml.validate: + ml.validate: body: > { "analysis_config": { @@ -39,7 +39,7 @@ --- "Test valid job config with job ID": - do: - xpack.ml.validate: + ml.validate: body: > { "job_id": "validate-job-config-with-job-id", @@ -60,7 +60,7 @@ "Test job config that is invalid only because of the job ID": - do: catch: /Invalid job_id; '_' can contain lowercase alphanumeric \(a-z and 0-9\), hyphens or underscores; must start and end with alphanumeric/ - xpack.ml.validate: + ml.validate: body: > { "job_id": "_", @@ -81,7 +81,7 @@ - do: catch: /illegal_argument_exception/ - xpack.ml.validate: + ml.validate: body: > { "model_snapshot_id": "wont-create-with-this-setting", @@ -95,7 +95,7 @@ - do: catch: /The job is configured with fields \[model_snapshot_id\] that are illegal to set at job creation/ - xpack.ml.validate: + ml.validate: body: > { "model_snapshot_id": "wont-create-with-this-setting", diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate_detector.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate_detector.yml index 709e98f77d9dc..905c03addb66c 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate_detector.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/validate_detector.yml @@ -1,7 +1,7 @@ --- "Test valid detector": - do: - xpack.ml.validate_detector: + ml.validate_detector: body: > { "function":"count", @@ -13,7 +13,7 @@ "Test invalid detector": - do: catch: /field_name must be set when the 'mean' function is used/ - xpack.ml.validate_detector: + ml.validate_detector: body: > { "function":"mean", diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml index ba0f4d5091e0f..7ac23d3cc1554 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/30_ml_jobs_crud.yml @@ -1,12 +1,12 @@ --- "Test get old cluster job": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: old-cluster-job - match: { count: 1 } - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: old-cluster-job - match: { jobs.0.state: "closed" } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -14,11 +14,11 @@ - is_false: node - do: - xpack.ml.open_job: + ml.open_job: job_id: old-cluster-job - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: old-cluster-job - match: { jobs.0.state: "opened" } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -27,18 +27,18 @@ - is_true: jobs.0.open_time - do: - xpack.ml.close_job: + ml.close_job: job_id: old-cluster-job - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: old-cluster-job - match: { count: 1 } --- "Create a job in the mixed cluster and write some data": - do: - xpack.ml.put_job: + ml.put_job: job_id: mixed-cluster-job body: > { @@ -59,11 +59,11 @@ - match: { job_id: mixed-cluster-job } - do: - xpack.ml.open_job: + ml.open_job: job_id: mixed-cluster-job - do: - xpack.ml.post_data: + ml.post_data: job_id: mixed-cluster-job body: - airline: AAL @@ -77,7 +77,7 @@ - match: { processed_record_count: 2 } - do: - xpack.ml.close_job: + ml.close_job: job_id: mixed-cluster-job # Wait for indices to be fully allocated before @@ -91,6 +91,6 @@ "Test job with pre 6.4 rules": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: job-with-old-rules - match: { count: 1 } diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml index 0ec288f90973c..97a793991f4b7 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/mixed_cluster/40_ml_datafeed_crud.yml @@ -1,7 +1,7 @@ --- "Test old cluster datafeed": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.datafeed_id: "old-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } @@ -9,7 +9,7 @@ - gte: { datafeeds.0.scroll_size: 2000 } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.state: "stopped"} - is_false: datafeeds.0.node @@ -18,7 +18,7 @@ "Put job and datafeed in mixed cluster": - do: - xpack.ml.put_job: + ml.put_job: job_id: mixed-cluster-datafeed-job body: > { @@ -37,7 +37,7 @@ } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: mixed-cluster-datafeed body: > { @@ -48,7 +48,7 @@ } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: mixed-cluster-datafeed - match: { datafeeds.0.state: stopped} - is_false: datafeeds.0.node diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/30_ml_jobs_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/30_ml_jobs_crud.yml index 3a3334f6907e9..3401d6e212717 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/30_ml_jobs_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/30_ml_jobs_crud.yml @@ -2,7 +2,7 @@ "Put job on the old cluster and post some data": - do: - xpack.ml.put_job: + ml.put_job: job_id: old-cluster-job body: > { @@ -23,11 +23,11 @@ - match: { job_id: old-cluster-job } - do: - xpack.ml.open_job: + ml.open_job: job_id: old-cluster-job - do: - xpack.ml.post_data: + ml.post_data: job_id: old-cluster-job body: - airline: AAL @@ -41,11 +41,11 @@ - match: { processed_record_count: 2 } - do: - xpack.ml.close_job: + ml.close_job: job_id: old-cluster-job - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: old-cluster-job - match: { count: 1 } @@ -59,7 +59,7 @@ --- "Put job on the old cluster with the default model memory limit and post some data": - do: - xpack.ml.put_job: + ml.put_job: job_id: no-model-memory-limit-job body: > { @@ -75,11 +75,11 @@ - match: { job_id: no-model-memory-limit-job } - do: - xpack.ml.open_job: + ml.open_job: job_id: no-model-memory-limit-job - do: - xpack.ml.post_data: + ml.post_data: job_id: no-model-memory-limit-job body: - sourcetype: post-data-job @@ -95,11 +95,11 @@ - match: { processed_record_count: 5 } - do: - xpack.ml.close_job: + ml.close_job: job_id: no-model-memory-limit-job - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: no-model-memory-limit-job - match: { count: 201 } @@ -113,7 +113,7 @@ --- "Put job with empty strings in the configuration": - do: - xpack.ml.put_job: + ml.put_job: job_id: old-cluster-job-empty-fields body: > { @@ -141,7 +141,7 @@ reason: "Rules were replaced by custom_rules on 6.4.0" - do: - xpack.ml.put_job: + ml.put_job: job_id: job-with-old-rules body: > { @@ -178,7 +178,7 @@ reason: "Rules replaced by custom_rules on 6.4.0" - do: - xpack.ml.put_job: + ml.put_job: job_id: job-with-old-rules body: > { @@ -196,7 +196,7 @@ --- "Test function shortcut expansion": - do: - xpack.ml.put_job: + ml.put_job: job_id: old-cluster-function-shortcut-expansion body: > { diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/40_ml_datafeed_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/40_ml_datafeed_crud.yml index c1317bdf3d660..bbe26eb69bd20 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/40_ml_datafeed_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/old_cluster/40_ml_datafeed_crud.yml @@ -2,7 +2,7 @@ "Put job and datafeed in old cluster": - do: - xpack.ml.put_job: + ml.put_job: job_id: old-cluster-datafeed-job body: > { @@ -22,7 +22,7 @@ - match: { job_id: old-cluster-datafeed-job } - do: - xpack.ml.put_datafeed: + ml.put_datafeed: datafeed_id: old-cluster-datafeed body: > { @@ -33,7 +33,7 @@ } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.state: stopped} - is_false: datafeeds.0.node diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml index bb47524b41d87..507362507cdeb 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/30_ml_jobs_crud.yml @@ -9,11 +9,11 @@ setup: --- "Test open old jobs": - do: - xpack.ml.open_job: + ml.open_job: job_id: old-cluster-job - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: old-cluster-job - match: { jobs.0.state: "opened" } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -22,11 +22,11 @@ setup: - is_true: jobs.0.open_time - do: - xpack.ml.open_job: + ml.open_job: job_id: mixed-cluster-job - do: - xpack.ml.get_job_stats: + ml.get_job_stats: job_id: mixed-cluster-job - match: { jobs.0.state: "opened" } - match: { jobs.0.data_counts.processed_record_count: 2 } @@ -35,61 +35,61 @@ setup: - is_true: jobs.0.open_time - do: - xpack.ml.close_job: + ml.close_job: job_id: old-cluster-job - do: - xpack.ml.close_job: + ml.close_job: job_id: mixed-cluster-job - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: old-cluster-job - match: { count: 1 } - do: - xpack.ml.get_buckets: + ml.get_buckets: job_id: mixed-cluster-job - match: { count: 1 } - do: - xpack.ml.delete_job: + ml.delete_job: job_id: old-cluster-job - match: { acknowledged: true } - do: catch: missing - xpack.ml.get_jobs: + ml.get_jobs: job_id: old-cluster-job - do: - xpack.ml.delete_job: + ml.delete_job: job_id: mixed-cluster-job - match: { acknowledged: true } - do: catch: missing - xpack.ml.get_jobs: + ml.get_jobs: job_id: mixed-cluster-job --- "Test job with no model memory limit has established model memory after reopening": - do: - xpack.ml.open_job: + ml.open_job: job_id: no-model-memory-limit-job - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: no-model-memory-limit-job - is_true: jobs.0.established_model_memory - lt: { jobs.0.established_model_memory: 100000 } - do: - xpack.ml.close_job: + ml.close_job: job_id: no-model-memory-limit-job - do: - xpack.ml.delete_job: + ml.delete_job: job_id: no-model-memory-limit-job - match: { acknowledged: true } @@ -97,7 +97,7 @@ setup: "Test job with pre 6.4 rules": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: job-with-old-rules - match: { count: 1 } - is_false: jobs.0.analysis_config.detectors.0.rules @@ -107,7 +107,7 @@ setup: "Test get job with function shortcut should expand": - do: - xpack.ml.get_jobs: + ml.get_jobs: job_id: old-cluster-function-shortcut-expansion - match: { count: 1 } - match: { jobs.0.analysis_config.detectors.0.function: "non_zero_count" } diff --git a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml index 6b4c963dd533b..a1ab7dfb91435 100644 --- a/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml +++ b/x-pack/qa/rolling-upgrade/src/test/resources/rest-api-spec/test/upgraded_cluster/40_ml_datafeed_crud.yml @@ -19,7 +19,7 @@ setup: --- "Test old and mixed cluster datafeeds": - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.datafeed_id: "old-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } @@ -27,13 +27,13 @@ setup: - gte: { datafeeds.0.scroll_size: 2000 } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: old-cluster-datafeed - match: { datafeeds.0.state: "stopped"} - is_false: datafeeds.0.node - do: - xpack.ml.get_datafeeds: + ml.get_datafeeds: datafeed_id: mixed-cluster-datafeed - match: { datafeeds.0.datafeed_id: "mixed-cluster-datafeed"} - length: { datafeeds.0.indices: 1 } @@ -41,59 +41,59 @@ setup: - gte: { datafeeds.0.scroll_size: 2000 } - do: - xpack.ml.get_datafeed_stats: + ml.get_datafeed_stats: datafeed_id: mixed-cluster-datafeed - match: { datafeeds.0.state: "stopped"} - is_false: datafeeds.0.node - do: - xpack.ml.open_job: + ml.open_job: job_id: old-cluster-datafeed-job - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: old-cluster-datafeed start: 0 - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: old-cluster-datafeed - do: - xpack.ml.close_job: + ml.close_job: job_id: old-cluster-datafeed-job - do: - xpack.ml.delete_datafeed: + ml.delete_datafeed: datafeed_id: old-cluster-datafeed - do: - xpack.ml.delete_job: + ml.delete_job: job_id: old-cluster-datafeed-job - match: { acknowledged: true } - do: - xpack.ml.open_job: + ml.open_job: job_id: mixed-cluster-datafeed-job - do: - xpack.ml.start_datafeed: + ml.start_datafeed: datafeed_id: mixed-cluster-datafeed start: 0 - do: - xpack.ml.stop_datafeed: + ml.stop_datafeed: datafeed_id: mixed-cluster-datafeed - do: - xpack.ml.close_job: + ml.close_job: job_id: mixed-cluster-datafeed-job - do: - xpack.ml.delete_datafeed: + ml.delete_datafeed: datafeed_id: mixed-cluster-datafeed - do: - xpack.ml.delete_job: + ml.delete_job: job_id: mixed-cluster-datafeed-job - match: { acknowledged: true }