[ML] Return the updated calendar after removing a job (elastic/x-pack-elasticsearch#3690)

Original commit: elastic/x-pack-elasticsearch@1bf1f3228b
This commit is contained in:
David Kyle 2018-01-23 17:40:41 +00:00 committed by GitHub
parent d065b087ee
commit 97e018f1bd
2 changed files with 4 additions and 2 deletions

View File

@ -10,7 +10,7 @@ import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestController; 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.RestToXContentListener;
import org.elasticsearch.xpack.ml.MachineLearning; import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.action.UpdateCalendarJobAction; import org.elasticsearch.xpack.ml.action.UpdateCalendarJobAction;
import org.elasticsearch.xpack.ml.calendars.Calendar; import org.elasticsearch.xpack.ml.calendars.Calendar;
@ -39,6 +39,6 @@ public class RestDeleteCalendarJobAction extends BaseRestHandler {
String jobId = restRequest.param(Job.ID.getPreferredName()); String jobId = restRequest.param(Job.ID.getPreferredName());
UpdateCalendarJobAction.Request request = UpdateCalendarJobAction.Request request =
new UpdateCalendarJobAction.Request(calendarId, Collections.emptySet(), Collections.singleton(jobId)); new UpdateCalendarJobAction.Request(calendarId, Collections.emptySet(), Collections.singleton(jobId));
return channel -> client.execute(UpdateCalendarJobAction.INSTANCE, request, new AcknowledgedRestListener<>(channel)); return channel -> client.execute(UpdateCalendarJobAction.INSTANCE, request, new RestToXContentListener<>(channel));
} }
} }

View File

@ -237,6 +237,8 @@
xpack.ml.delete_calendar_job: xpack.ml.delete_calendar_job:
calendar_id: "wildlife" calendar_id: "wildlife"
job_id: "tiger" job_id: "tiger"
- match: { calendar_id: "wildlife" }
- length: { job_ids: 0 }
- do: - do:
xpack.ml.get_calendars: xpack.ml.get_calendars: