Convert `jobs` namespace to `anomaly_detectors` (elastic/elasticsearch#513)

This also shuffles results under /anomaly_detectors/.  Note: the cluster state still refers to
"jobs" which should probably be fixed in a separate PR

Original commit: elastic/x-pack-elasticsearch@c9e634621c
This commit is contained in:
Zachary Tong 2016-12-09 11:54:56 -05:00 committed by GitHub
parent a85dfcd91f
commit 30bbbf0f78
33 changed files with 120 additions and 110 deletions

View File

@ -22,6 +22,7 @@ import org.elasticsearch.cluster.block.ClusterBlockException;
import org.elasticsearch.cluster.block.ClusterBlockLevel; import org.elasticsearch.cluster.block.ClusterBlockLevel;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver; import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
@ -61,6 +62,8 @@ public class OpenJobAction extends Action<OpenJobAction.Request, OpenJobAction.R
public static class Request extends AcknowledgedRequest<Request> { public static class Request extends AcknowledgedRequest<Request> {
public static final ParseField OPEN_TIMEOUT = new ParseField("open_timeout");
private String jobId; private String jobId;
private boolean ignoreDowntime; private boolean ignoreDowntime;
private TimeValue openTimeout = TimeValue.timeValueMinutes(30); private TimeValue openTimeout = TimeValue.timeValueMinutes(30);

View File

@ -28,7 +28,7 @@ public class RestCloseJobAction extends BaseRestHandler {
super(settings); super(settings);
this.closeJobAction = closeJobAction; this.closeJobAction = closeJobAction;
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH
+ "jobs/{" + Job.ID.getPreferredName() + "}/_close", this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_close", this);
} }
@Override @Override

View File

@ -26,7 +26,8 @@ public class RestDeleteJobAction extends BaseRestHandler {
public RestDeleteJobAction(Settings settings, RestController controller, DeleteJobAction.TransportAction transportDeleteJobAction) { public RestDeleteJobAction(Settings settings, RestController controller, DeleteJobAction.TransportAction transportDeleteJobAction) {
super(settings); super(settings);
this.transportDeleteJobAction = transportDeleteJobAction; this.transportDeleteJobAction = transportDeleteJobAction;
controller.registerHandler(RestRequest.Method.DELETE, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}", this); controller.registerHandler(RestRequest.Method.DELETE, PrelertPlugin.BASE_PATH
+ "anomaly_detectors/{" + Job.ID.getPreferredName() + "}", this);
} }
@Override @Override

View File

@ -36,8 +36,8 @@ public class RestFlushJobAction extends BaseRestHandler {
FlushJobAction.TransportAction flushJobAction) { FlushJobAction.TransportAction flushJobAction) {
super(settings); super(settings);
this.flushJobAction = flushJobAction; this.flushJobAction = flushJobAction;
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_flush", controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH
this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_flush", this);
} }
@Override @Override

View File

@ -35,18 +35,18 @@ public class RestGetJobsAction extends BaseRestHandler {
this.transportGetJobAction = transportGetJobAction; this.transportGetJobAction = transportGetJobAction;
// GETs // GETs
controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_stats", controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH
this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", this);
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_stats/{metric}", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats/{metric}", this);
controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "jobs/_stats", this); controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats", this);
// POSTs // POSTs
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_stats", controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH
this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats", this);
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_stats/{metric}", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_stats/{metric}", this);
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "jobs/_stats", this); controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats", this);
} }
@Override @Override

View File

@ -30,8 +30,8 @@ public class RestJobDataAction extends BaseRestHandler {
public RestJobDataAction(Settings settings, RestController controller, JobDataAction.TransportAction transportPostDataAction) { public RestJobDataAction(Settings settings, RestController controller, JobDataAction.TransportAction transportPostDataAction) {
super(settings); super(settings);
this.transportPostDataAction = transportPostDataAction; this.transportPostDataAction = transportPostDataAction;
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/data", controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH
this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/data", this);
} }
@Override @Override

View File

@ -14,6 +14,7 @@ import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.action.AcknowledgedRestListener; import org.elasticsearch.rest.action.AcknowledgedRestListener;
import org.elasticsearch.xpack.prelert.PrelertPlugin; import org.elasticsearch.xpack.prelert.PrelertPlugin;
import org.elasticsearch.xpack.prelert.action.JobDataAction;
import org.elasticsearch.xpack.prelert.action.OpenJobAction; import org.elasticsearch.xpack.prelert.action.OpenJobAction;
import org.elasticsearch.xpack.prelert.job.Job; import org.elasticsearch.xpack.prelert.job.Job;
@ -27,16 +28,18 @@ public class RestOpenJobAction extends BaseRestHandler {
public RestOpenJobAction(Settings settings, RestController controller, OpenJobAction.TransportAction openJobAction) { public RestOpenJobAction(Settings settings, RestController controller, OpenJobAction.TransportAction openJobAction) {
super(settings); super(settings);
this.openJobAction = openJobAction; this.openJobAction = openJobAction;
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "jobs/{" + Job.ID.getPreferredName() + "}/_open", controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH
this); + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/_open", this);
} }
@Override @Override
protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { protected RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException {
OpenJobAction.Request request = new OpenJobAction.Request(restRequest.param(Job.ID.getPreferredName())); OpenJobAction.Request request = new OpenJobAction.Request(restRequest.param(Job.ID.getPreferredName()));
request.setIgnoreDowntime(restRequest.paramAsBoolean("ignore_downtime", false)); request.setIgnoreDowntime(restRequest.paramAsBoolean(JobDataAction.Request.IGNORE_DOWNTIME.getPreferredName(), false));
if (restRequest.hasParam("open_timeout")) { if (restRequest.hasParam(OpenJobAction.Request.OPEN_TIMEOUT.getPreferredName())) {
request.setOpenTimeout(TimeValue.parseTimeValue(restRequest.param("open_timeout"), "open_timeout")); request.setOpenTimeout(TimeValue.parseTimeValue(
restRequest.param(OpenJobAction.Request.OPEN_TIMEOUT.getPreferredName()),
OpenJobAction.Request.OPEN_TIMEOUT.getPreferredName()));
} }
return channel -> openJobAction.execute(request, new AcknowledgedRestListener<>(channel)); return channel -> openJobAction.execute(request, new AcknowledgedRestListener<>(channel));
} }

View File

@ -27,7 +27,7 @@ public class RestPutJobAction extends BaseRestHandler {
public RestPutJobAction(Settings settings, RestController controller, PutJobAction.TransportAction transportPutJobAction) { public RestPutJobAction(Settings settings, RestController controller, PutJobAction.TransportAction transportPutJobAction) {
super(settings); super(settings);
this.transportPutJobAction = transportPutJobAction; this.transportPutJobAction = transportPutJobAction;
controller.registerHandler(RestRequest.Method.PUT, PrelertPlugin.BASE_PATH + "jobs", this); controller.registerHandler(RestRequest.Method.PUT, PrelertPlugin.BASE_PATH + "anomaly_detectors", this);
} }
@Override @Override

View File

@ -28,8 +28,8 @@ public class RestDeleteModelSnapshotAction extends BaseRestHandler {
DeleteModelSnapshotAction.TransportAction transportAction) { DeleteModelSnapshotAction.TransportAction transportAction) {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler(RestRequest.Method.DELETE, PrelertPlugin.BASE_PATH + "modelsnapshots/{" controller.registerHandler(RestRequest.Method.DELETE, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
+ Job.ID.getPreferredName() + "}/{" + ModelSnapshot.SNAPSHOT_ID.getPreferredName() + "}", this); + Job.ID.getPreferredName() + "}/modelsnapshots/{" + ModelSnapshot.SNAPSHOT_ID.getPreferredName() + "}", this);
} }
@Override @Override

View File

@ -41,11 +41,11 @@ public class RestGetModelSnapshotsAction extends BaseRestHandler {
GetModelSnapshotsAction.TransportAction transportGetModelSnapshotsAction) { GetModelSnapshotsAction.TransportAction transportGetModelSnapshotsAction) {
super(settings); super(settings);
this.transportGetModelSnapshotsAction = transportGetModelSnapshotsAction; this.transportGetModelSnapshotsAction = transportGetModelSnapshotsAction;
controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "modelsnapshots/{" controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
+ Job.ID.getPreferredName() + "}", this); + Job.ID.getPreferredName() + "}/modelsnapshots/", this);
// endpoints that support body parameters must also accept POST // endpoints that support body parameters must also accept POST
controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "modelsnapshots/{" controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
+ Job.ID.getPreferredName() + "}", this); + Job.ID.getPreferredName() + "}/modelsnapshots/", this);
} }
@Override @Override

View File

@ -34,8 +34,8 @@ public class RestPutModelSnapshotDescriptionAction extends BaseRestHandler {
this.transportAction = transportAction; this.transportAction = transportAction;
// NORELEASE: should be a POST action // NORELEASE: should be a POST action
controller.registerHandler(RestRequest.Method.PUT, PrelertPlugin.BASE_PATH + "modelsnapshots/{" controller.registerHandler(RestRequest.Method.PUT, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
+ Job.ID.getPreferredName() + "}/{" + ModelSnapshot.SNAPSHOT_ID +"}/description", + Job.ID.getPreferredName() + "}/modelsnapshots/{" + ModelSnapshot.SNAPSHOT_ID +"}/description",
this); this);
} }

View File

@ -37,7 +37,7 @@ public class RestRevertModelSnapshotAction extends BaseRestHandler {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "modelsnapshots/{" + Job.ID.getPreferredName() + "}/_revert", PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/modelsnapshots/_revert",
this); this);
} }

View File

@ -32,16 +32,16 @@ public class RestGetBucketsAction extends BaseRestHandler {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName()
+ "}/buckets/{" + Bucket.TIMESTAMP.getPreferredName() + "}", this); + "}/results/buckets/{" + Bucket.TIMESTAMP.getPreferredName() + "}", this);
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName()
+ "}/buckets/{" + Bucket.TIMESTAMP.getPreferredName() + "}", this); + "}/results/buckets/{" + Bucket.TIMESTAMP.getPreferredName() + "}", this);
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/buckets", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", this);
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/buckets", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/buckets", this);
} }
@Override @Override

View File

@ -30,16 +30,16 @@ public class RestGetCategoriesAction extends BaseRestHandler {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/categorydefinitions/{" PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categorydefinitions/{"
+ Request.CATEGORY_ID.getPreferredName() + "}", this); + Request.CATEGORY_ID.getPreferredName() + "}", this);
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/categorydefinitions", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categorydefinitions", this);
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/categorydefinitions/{" PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categorydefinitions/{"
+ Request.CATEGORY_ID.getPreferredName() + "}", this); + Request.CATEGORY_ID.getPreferredName() + "}", this);
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/categorydefinitions", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/categorydefinitions", this);
} }
@Override @Override

View File

@ -32,10 +32,10 @@ public class RestGetInfluencersAction extends BaseRestHandler {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler(RestRequest.Method.GET, controller.registerHandler(RestRequest.Method.GET,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/influencers", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", this);
// endpoints that support body parameters must also accept POST // endpoints that support body parameters must also accept POST
controller.registerHandler(RestRequest.Method.POST, controller.registerHandler(RestRequest.Method.POST,
PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/influencers", this); PrelertPlugin.BASE_PATH + "anomaly_detectors/{" + Job.ID.getPreferredName() + "}/results/influencers", this);
} }
@Override @Override

View File

@ -31,10 +31,10 @@ public class RestGetRecordsAction extends BaseRestHandler {
public RestGetRecordsAction(Settings settings, RestController controller, GetRecordsAction.TransportAction transportAction) { public RestGetRecordsAction(Settings settings, RestController controller, GetRecordsAction.TransportAction transportAction) {
super(settings); super(settings);
this.transportAction = transportAction; this.transportAction = transportAction;
controller.registerHandler( controller.registerHandler(RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
RestRequest.Method.GET, PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/records", this); + Job.ID.getPreferredName() + "}/results/records", this);
controller.registerHandler( controller.registerHandler(RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "anomaly_detectors/{"
RestRequest.Method.POST, PrelertPlugin.BASE_PATH + "results/{" + Job.ID.getPreferredName() + "}/records", this); + Job.ID.getPreferredName() + "}/results/records", this);
} }
@Override @Override

View File

@ -52,7 +52,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJob_GivenNoSuchJob() throws Exception { public void testGetJob_GivenNoSuchJob() throws Exception {
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/non-existing-job/_stats")); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/non-existing-job/_stats"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
assertThat(e.getMessage(), containsString("Could not find requested jobs")); assertThat(e.getMessage(), containsString("Could not find requested jobs"));
@ -61,7 +61,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJob_GivenJobExists() throws Exception { public void testGetJob_GivenJobExists() throws Exception {
createFarequoteJob(); createFarequoteJob();
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/farequote/_stats"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/farequote/_stats");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -71,7 +71,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJobs_GivenNegativeFrom() throws Exception { public void testGetJobs_GivenNegativeFrom() throws Exception {
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?from=-1")); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?from=-1"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400));
assertThat(e.getMessage(), containsString("\"reason\":\"Parameter [from] cannot be < 0\"")); assertThat(e.getMessage(), containsString("\"reason\":\"Parameter [from] cannot be < 0\""));
@ -79,7 +79,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJobs_GivenNegativeSize() throws Exception { public void testGetJobs_GivenNegativeSize() throws Exception {
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?size=-1")); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?size=-1"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400));
assertThat(e.getMessage(), containsString("\"reason\":\"Parameter [size] cannot be < 0\"")); assertThat(e.getMessage(), containsString("\"reason\":\"Parameter [size] cannot be < 0\""));
@ -87,7 +87,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJobs_GivenFromAndSizeSumTo10001() throws Exception { public void testGetJobs_GivenFromAndSizeSumTo10001() throws Exception {
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?from=1000&size=11001")); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?from=1000&size=11001"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(400));
assertThat(e.getMessage(), containsString("\"reason\":\"The sum of parameters [from] and [size] cannot be higher than 10000.")); assertThat(e.getMessage(), containsString("\"reason\":\"The sum of parameters [from] and [size] cannot be higher than 10000."));
@ -96,7 +96,7 @@ public class PrelertJobIT extends ESRestTestCase {
public void testGetJobs_GivenSingleJob() throws Exception { public void testGetJobs_GivenSingleJob() throws Exception {
createFarequoteJob(); createFarequoteJob();
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -109,7 +109,7 @@ public class PrelertJobIT extends ESRestTestCase {
createFarequoteJob("farequote_2"); createFarequoteJob("farequote_2");
createFarequoteJob("farequote_3"); createFarequoteJob("farequote_3");
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -124,7 +124,7 @@ public class PrelertJobIT extends ESRestTestCase {
createFarequoteJob("farequote_2"); createFarequoteJob("farequote_2");
createFarequoteJob("farequote_3"); createFarequoteJob("farequote_3");
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?from=1"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?from=1");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -139,7 +139,7 @@ public class PrelertJobIT extends ESRestTestCase {
createFarequoteJob("farequote_2"); createFarequoteJob("farequote_2");
createFarequoteJob("farequote_3"); createFarequoteJob("farequote_3");
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?size=1"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?size=1");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -154,7 +154,7 @@ public class PrelertJobIT extends ESRestTestCase {
createFarequoteJob("farequote_2"); createFarequoteJob("farequote_2");
createFarequoteJob("farequote_3"); createFarequoteJob("farequote_3");
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/_stats?from=1&size=1"); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/_stats?from=1&size=1");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
@ -176,7 +176,7 @@ public class PrelertJobIT extends ESRestTestCase {
"\"time_field\":\"time\",\n" "\"time_field\":\"time\",\n"
+ " \"time_format\":\"yyyy-MM-dd HH:mm:ssX\"\n" + " }\n" + "}"; + " \"time_format\":\"yyyy-MM-dd HH:mm:ssX\"\n" + " }\n" + "}";
return client().performRequest("put", PrelertPlugin.BASE_PATH + "jobs", Collections.emptyMap(), new StringEntity(job)); return client().performRequest("put", PrelertPlugin.BASE_PATH + "anomaly_detectors", Collections.emptyMap(), new StringEntity(job));
} }
public void testGetBucketResults() throws Exception { public void testGetBucketResults() throws Exception {
@ -185,32 +185,34 @@ public class PrelertJobIT extends ESRestTestCase {
params.put("end", "1400"); // exclusive params.put("end", "1400"); // exclusive
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/buckets", params)); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/buckets", params));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
assertThat(e.getMessage(), containsString("No known job with id '1'")); assertThat(e.getMessage(), containsString("No known job with id '1'"));
addBucketResult("1", "1234", 1); addBucketResult("1", "1234", 1);
addBucketResult("1", "1235", 1); addBucketResult("1", "1235", 1);
addBucketResult("1", "1236", 1); addBucketResult("1", "1236", 1);
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/buckets", params); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/buckets", params);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
assertThat(responseAsString, containsString("\"count\":3")); assertThat(responseAsString, containsString("\"count\":3"));
params.put("end", "1235"); params.put("end", "1235");
response = client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/buckets", params); response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/buckets", params);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
responseAsString = responseEntityToString(response); responseAsString = responseEntityToString(response);
assertThat(responseAsString, containsString("\"count\":1")); assertThat(responseAsString, containsString("\"count\":1"));
e = expectThrows(ResponseException.class, () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "results/2/buckets/1234")); e = expectThrows(ResponseException.class, () -> client().performRequest("get", PrelertPlugin.BASE_PATH
+ "anomaly_detectors/2/results/buckets/1234"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
assertThat(e.getMessage(), containsString("No known job with id '2'")); assertThat(e.getMessage(), containsString("No known job with id '2'"));
e = expectThrows(ResponseException.class, () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/buckets/1")); e = expectThrows(ResponseException.class, () -> client().performRequest("get",
PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/buckets/1"));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
response = client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/buckets/1234"); response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/buckets/1234");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
responseAsString = responseEntityToString(response); responseAsString = responseEntityToString(response);
assertThat(responseAsString, not(isEmptyString())); assertThat(responseAsString, not(isEmptyString()));
@ -222,20 +224,20 @@ public class PrelertJobIT extends ESRestTestCase {
params.put("end", "1400"); // exclusive params.put("end", "1400"); // exclusive
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/records", params)); () -> client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/records", params));
assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404)); assertThat(e.getResponse().getStatusLine().getStatusCode(), equalTo(404));
assertThat(e.getMessage(), containsString("No known job with id '1'")); assertThat(e.getMessage(), containsString("No known job with id '1'"));
addRecordResult("1", "1234", 1, 1); addRecordResult("1", "1234", 1, 1);
addRecordResult("1", "1235", 1, 2); addRecordResult("1", "1235", 1, 2);
addRecordResult("1", "1236", 1, 3); addRecordResult("1", "1236", 1, 3);
Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/records", params); Response response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/records", params);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
String responseAsString = responseEntityToString(response); String responseAsString = responseEntityToString(response);
assertThat(responseAsString, containsString("\"count\":3")); assertThat(responseAsString, containsString("\"count\":3"));
params.put("end", "1235"); params.put("end", "1235");
response = client().performRequest("get", PrelertPlugin.BASE_PATH + "results/1/records", params); response = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/1/results/records", params);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
responseAsString = responseEntityToString(response); responseAsString = responseEntityToString(response);
assertThat(responseAsString, containsString("\"count\":1")); assertThat(responseAsString, containsString("\"count\":1"));

View File

@ -89,7 +89,7 @@ public class ScheduledJobIT extends ESRestTestCase {
assertThat(responseEntityToString(startSchedulerRequest), containsString("{\"task\":\"")); assertThat(responseEntityToString(startSchedulerRequest), containsString("{\"task\":\""));
assertBusy(() -> { assertBusy(() -> {
try { try {
Response getJobResponse = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_stats", Response getJobResponse = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats",
Collections.singletonMap("metric", "data_counts")); Collections.singletonMap("metric", "data_counts"));
assertThat(responseEntityToString(getJobResponse), containsString("\"input_record_count\":2")); assertThat(responseEntityToString(getJobResponse), containsString("\"input_record_count\":2"));
} catch (Exception e) { } catch (Exception e) {
@ -111,7 +111,7 @@ public class ScheduledJobIT extends ESRestTestCase {
assertThat(responseEntityToString(response), containsString("{\"task\":\"")); assertThat(responseEntityToString(response), containsString("{\"task\":\""));
assertBusy(() -> { assertBusy(() -> {
try { try {
Response getJobResponse = client().performRequest("get", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_stats", Response getJobResponse = client().performRequest("get", PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats",
Collections.singletonMap("metric", "data_counts,status")); Collections.singletonMap("metric", "data_counts,status"));
String responseAsString = responseEntityToString(getJobResponse); String responseAsString = responseEntityToString(getJobResponse);
assertThat(responseAsString, containsString("\"status\":\"OPENED\"")); assertThat(responseAsString, containsString("\"status\":\"OPENED\""));
@ -122,7 +122,7 @@ public class ScheduledJobIT extends ESRestTestCase {
}); });
ResponseException e = expectThrows(ResponseException.class, ResponseException e = expectThrows(ResponseException.class,
() -> client().performRequest("delete", PrelertPlugin.BASE_PATH + "jobs/" + jobId)); () -> client().performRequest("delete", PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId));
response = e.getResponse(); response = e.getResponse();
assertThat(response.getStatusLine().getStatusCode(), equalTo(409)); assertThat(response.getStatusLine().getStatusCode(), equalTo(409));
assertThat(responseEntityToString(response), containsString("Cannot delete job '" + jobId + "' while it is OPENED")); assertThat(responseEntityToString(response), containsString("Cannot delete job '" + jobId + "' while it is OPENED"));
@ -132,8 +132,8 @@ public class ScheduledJobIT extends ESRestTestCase {
assertThat(responseEntityToString(response), equalTo("{\"acknowledged\":true}")); assertThat(responseEntityToString(response), equalTo("{\"acknowledged\":true}"));
waitForSchedulerStoppedState(client(), jobId); waitForSchedulerStoppedState(client(), jobId);
client().performRequest("POST", "/_xpack/prelert/jobs/" + jobId + "/_close"); client().performRequest("POST", "/_xpack/prelert/anomaly_detectors/" + jobId + "/_close");
response = client().performRequest("delete", PrelertPlugin.BASE_PATH + "jobs/" + jobId); response = client().performRequest("delete", PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId);
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
assertThat(responseEntityToString(response), equalTo("{\"acknowledged\":true}")); assertThat(responseEntityToString(response), equalTo("{\"acknowledged\":true}"));
} }
@ -160,7 +160,7 @@ public class ScheduledJobIT extends ESRestTestCase {
"\"time_field\":\"time\",\n" "\"time_field\":\"time\",\n"
+ " \"time_format\":\"yyyy-MM-dd'T'HH:mm:ssX\"\n" + " }\n" + "}"; + " \"time_format\":\"yyyy-MM-dd'T'HH:mm:ssX\"\n" + " }\n" + "}";
return client().performRequest("put", PrelertPlugin.BASE_PATH + "jobs", Collections.emptyMap(), new StringEntity(job)); return client().performRequest("put", PrelertPlugin.BASE_PATH + "anomaly_detectors", Collections.emptyMap(), new StringEntity(job));
} }
private Response createScheduledJob(String id) throws Exception { private Response createScheduledJob(String id) throws Exception {
@ -174,7 +174,7 @@ public class ScheduledJobIT extends ESRestTestCase {
+ " \"scheduler_config\" : {\n" + " \"indexes\":[\"airline-data\"],\n" + " \"scheduler_config\" : {\n" + " \"indexes\":[\"airline-data\"],\n"
+ " \"types\":[\"response\"],\n" + " \"retrieve_whole_source\":true\n" + " }\n" + "}"; + " \"types\":[\"response\"],\n" + " \"retrieve_whole_source\":true\n" + " }\n" + "}";
return client().performRequest("put", PrelertPlugin.BASE_PATH + "jobs", Collections.emptyMap(), new StringEntity(job)); return client().performRequest("put", PrelertPlugin.BASE_PATH + "anomaly_detectors", Collections.emptyMap(), new StringEntity(job));
} }
private static String responseEntityToString(Response response) throws Exception { private static String responseEntityToString(Response response) throws Exception {
@ -187,7 +187,8 @@ public class ScheduledJobIT extends ESRestTestCase {
try { try {
assertBusy(() -> { assertBusy(() -> {
try { try {
Response getJobResponse = client.performRequest("get", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_stats", Response getJobResponse = client.performRequest("get",
PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId + "/_stats",
Collections.singletonMap("metric", "scheduler_status")); Collections.singletonMap("metric", "scheduler_status"));
assertThat(responseEntityToString(getJobResponse), containsString("\"status\":\"STOPPED\"")); assertThat(responseEntityToString(getJobResponse), containsString("\"status\":\"STOPPED\""));
} catch (Exception e) { } catch (Exception e) {
@ -225,17 +226,17 @@ public class ScheduledJobIT extends ESRestTestCase {
// ignore // ignore
} }
try { try {
Response response = client.performRequest("POST", "/_xpack/prelert/jobs/" + jobId + "/_close"); Response response = client.performRequest("POST", "/_xpack/prelert/anomaly_detectors/" + jobId + "/_close");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }
client.performRequest("DELETE", "/_xpack/prelert/jobs/" + jobId); client.performRequest("DELETE", "/_xpack/prelert/anomaly_detectors/" + jobId);
} }
} }
public static void openJob(RestClient client, String jobId) throws IOException { public static void openJob(RestClient client, String jobId) throws IOException {
Response response = client.performRequest("post", PrelertPlugin.BASE_PATH + "jobs/" + jobId + "/_open"); Response response = client.performRequest("post", PrelertPlugin.BASE_PATH + "anomaly_detectors/" + jobId + "/_open");
assertThat(response.getStatusLine().getStatusCode(), equalTo(200)); assertThat(response.getStatusLine().getStatusCode(), equalTo(200));
} }
} }

View File

@ -2,8 +2,8 @@
"xpack.prelert.close_job": { "xpack.prelert.close_job": {
"methods": [ "POST" ], "methods": [ "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}/_close", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/_close",
"paths": [ "/_xpack/prelert/jobs/{job_id}/_close" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/_close" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,8 +2,8 @@
"xpack.prelert.delete_job": { "xpack.prelert.delete_job": {
"methods": [ "DELETE" ], "methods": [ "DELETE" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}",
"paths": [ "/_xpack/prelert/jobs/{job_id}" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,8 +2,8 @@
"xpack.prelert.delete_model_snapshot": { "xpack.prelert.delete_model_snapshot": {
"methods": [ "DELETE" ], "methods": [ "DELETE" ],
"url": { "url": {
"path": "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/{snapshot_id}",
"paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/{snapshot_id}" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -4,9 +4,9 @@
"POST" "POST"
], ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}/_flush", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/_flush",
"paths": [ "paths": [
"/_xpack/prelert/jobs/{job_id}/_flush" "/_xpack/prelert/anomaly_detectors/{job_id}/_flush"
], ],
"parts": { "parts": {
"job_id": { "job_id": {

View File

@ -2,10 +2,10 @@
"xpack.prelert.get_buckets": { "xpack.prelert.get_buckets": {
"methods": [ "GET", "POST" ], "methods": [ "GET", "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/results/{job_id}/buckets/{timestamp}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/results/buckets/{timestamp}",
"paths": [ "paths": [
"/_xpack/prelert/results/{job_id}/buckets/{timestamp}", "/_xpack/prelert/anomaly_detectors/{job_id}/results/buckets/{timestamp}",
"/_xpack/prelert/results/{job_id}/buckets" "/_xpack/prelert/anomaly_detectors/{job_id}/results/buckets"
], ],
"parts": { "parts": {
"job_id": { "job_id": {

View File

@ -2,10 +2,10 @@
"xpack.prelert.get_categories": { "xpack.prelert.get_categories": {
"methods": [ "GET", "POST" ], "methods": [ "GET", "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/results/{job_id}/categorydefinitions/{category_id}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/results/categorydefinitions/{category_id}",
"paths": [ "paths": [
"/_xpack/prelert/results/{job_id}/categorydefinitions/{category_id}", "/_xpack/prelert/anomaly_detectors/{job_id}/results/categorydefinitions/{category_id}",
"/_xpack/prelert/results/{job_id}/categorydefinitions/" "/_xpack/prelert/anomaly_detectors/{job_id}/results/categorydefinitions/"
], ],
"parts": { "parts": {
"job_id": { "job_id": {

View File

@ -2,8 +2,8 @@
"xpack.prelert.get_influencers": { "xpack.prelert.get_influencers": {
"methods": [ "GET", "POST" ], "methods": [ "GET", "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/results/{job_id}/influencers", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/results/influencers",
"paths": [ "/_xpack/prelert/results/{job_id}/influencers" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/results/influencers" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type" : "string", "type" : "string",

View File

@ -2,11 +2,11 @@
"xpack.prelert.get_jobs": { "xpack.prelert.get_jobs": {
"methods": [ "GET", "POST" ], "methods": [ "GET", "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}",
"paths": [ "paths": [
"/_xpack/prelert/jobs/_stats", "/_xpack/prelert/anomaly_detectors/_stats",
"/_xpack/prelert/jobs/{job_id}/_stats", "/_xpack/prelert/anomaly_detectors/{job_id}/_stats",
"/_xpack/prelert/jobs/{job_id}/_stats/{metric}" "/_xpack/prelert/anomaly_detectors/{job_id}/_stats/{metric}"
], ],
"parts": { "parts": {
"job_id": { "job_id": {

View File

@ -2,8 +2,8 @@
"xpack.prelert.get_model_snapshots": { "xpack.prelert.get_model_snapshots": {
"methods": [ "GET", "POST" ], "methods": [ "GET", "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/modelsnapshots/{job_id}", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots",
"paths": [ "/_xpack/prelert/modelsnapshots/{job_id}" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,9 +2,9 @@
"xpack.prelert.get_records": { "xpack.prelert.get_records": {
"methods": ["GET", "POST"], "methods": ["GET", "POST"],
"url": { "url": {
"path": "/_xpack/prelert/results/{job_id}/records", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/results/records",
"paths": [ "paths": [
"/_xpack/prelert/results/{job_id}/records" "/_xpack/prelert/anomaly_detectors/{job_id}/results/records"
], ],
"parts": { "parts": {
"job_id": { "job_id": {

View File

@ -2,8 +2,8 @@
"xpack.prelert.job_data": { "xpack.prelert.job_data": {
"methods": [ "POST" ], "methods": [ "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}/data", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/data",
"paths": [ "/_xpack/prelert/jobs/{job_id}/data" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/data" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,8 +2,8 @@
"xpack.prelert.open_job": { "xpack.prelert.open_job": {
"methods": [ "POST" ], "methods": [ "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs/{job_id}/_open", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/_open",
"paths": [ "/_xpack/prelert/jobs/{job_id}/_open" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/_open" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,8 +2,8 @@
"xpack.prelert.put_job": { "xpack.prelert.put_job": {
"methods": [ "PUT" ], "methods": [ "PUT" ],
"url": { "url": {
"path": "/_xpack/prelert/jobs", "path": "/_xpack/prelert/anomaly_detectors",
"paths": [ "/_xpack/prelert/jobs" ], "paths": [ "/_xpack/prelert/anomaly_detectors" ],
"params": { "params": {
"overwrite": { "overwrite": {
"type": "boolean", "type": "boolean",

View File

@ -2,8 +2,8 @@
"xpack.prelert.put_model_snapshot_description": { "xpack.prelert.put_model_snapshot_description": {
"methods": [ "PUT" ], "methods": [ "PUT" ],
"url": { "url": {
"path": "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}/description", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/{snapshot_id}/description",
"paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/{snapshot_id}/description" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/{snapshot_id}/description" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",

View File

@ -2,8 +2,8 @@
"xpack.prelert.revert_model_snapshot": { "xpack.prelert.revert_model_snapshot": {
"methods": [ "POST" ], "methods": [ "POST" ],
"url": { "url": {
"path": "/_xpack/prelert/modelsnapshots/{job_id}/_revert", "path": "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/_revert",
"paths": [ "/_xpack/prelert/modelsnapshots/{job_id}/_revert" ], "paths": [ "/_xpack/prelert/anomaly_detectors/{job_id}/modelsnapshots/_revert" ],
"parts": { "parts": {
"job_id": { "job_id": {
"type": "string", "type": "string",