From 0b6ac175daf3f1c4965cf9b7a0502ce6b800f002 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Mon, 10 Apr 2017 18:19:46 +0100 Subject: [PATCH] [ML] Check datafeed can be assigned before creating task (elastic/x-pack-elasticsearch#1027) When a datafeed task is created but it cannot be assigned the task has a null status. This means _stats report it as stopped, however deleting it fails. In addition, it's a better experience to error the start datafeed request all together and give the user the chance to fix his data indices. This change fails a datafeed-start if it cannot be assigned. relates elastic/x-pack-elasticsearch#1018 Original commit: elastic/x-pack-elasticsearch@532288fda0632fe914b75cfc71c4d491dede159a --- .../xpack/ml/action/OpenJobAction.java | 7 +++++++ .../xpack/ml/action/StartDatafeedAction.java | 17 ++++++++++++++++- .../test/ml/start_stop_datafeed.yaml | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) 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 bfef115bb1e..00c7e0d9562 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 @@ -6,6 +6,7 @@ package org.elasticsearch.xpack.ml.action; import org.apache.logging.log4j.Logger; +import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchStatusException; import org.elasticsearch.action.Action; import org.elasticsearch.action.ActionListener; @@ -336,6 +337,12 @@ public class OpenJobAction extends Action + { + "indexes":["utopia"] + } + + - do: + xpack.ml.open_job: + job_id: "datafeed-job" + + - do: + catch: /No node found to start datafeed \[datafeed-1\].*\[utopia\] does not exist.*/ + xpack.ml.start_datafeed: + datafeed_id: "datafeed-1"