diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/MlMetadata.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/MlMetadata.java index d461307988a..93aee29592d 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/MlMetadata.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/MlMetadata.java @@ -362,7 +362,7 @@ public class MlMetadata implements MetaData.Custom { PersistentTask jobTask = getJobTask(jobId, tasks); if (jobTask != null) { throw ExceptionsHelper.conflictStatusException("Cannot delete job [" + jobId + "] because the job is " - + jobTask.getStatus()); + + ((JobTaskStatus) jobTask.getStatus()).getState()); } Job.Builder jobBuilder = new Job.Builder(job); jobBuilder.setDeleted(true); diff --git a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java index 455f9b690ba..7ea949f9b26 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/ml/action/OpenJobAction.java @@ -466,7 +466,7 @@ public class OpenJobAction extends Action + { + "analysis_config" : { + "bucket_span": "1h", + "detectors" :[{"function":"count"}] + }, + "data_description" : { + "time_field":"time" + } + } + - match: { job_id: "delete-opened-job" } + + - do: + xpack.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: + job_id: delete-opened-job + --- "Test close job":