From d323f8d69831c67742853b72e634b21299e67c63 Mon Sep 17 00:00:00 2001 From: Dimitris Athanasiou Date: Thu, 9 Jul 2020 13:12:21 +0300 Subject: [PATCH] [ML] Add REST spec for the update data frame analytics endpoint (#59253) (#59281) Closes #59148 Backport of #59253 --- .../api/ml.update_data_frame_analytics.json | 29 +++++++++++ .../test/ml/data_frame_analytics_crud.yml | 50 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_data_frame_analytics.json diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_data_frame_analytics.json b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_data_frame_analytics.json new file mode 100644 index 0000000000000..9086a655833ca --- /dev/null +++ b/x-pack/plugin/src/test/resources/rest-api-spec/api/ml.update_data_frame_analytics.json @@ -0,0 +1,29 @@ +{ + "ml.update_data_frame_analytics":{ + "documentation":{ + "url":"https://www.elastic.co/guide/en/elasticsearch/reference/current/update-dfanalytics.html", + "description":"Updates certain properties of a data frame analytics job." + }, + "stability":"experimental", + "url":{ + "paths":[ + { + "path":"/_ml/data_frame/analytics/{id}/_update", + "methods":[ + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The ID of the data frame analytics to update" + } + } + } + ] + }, + "body":{ + "description":"The data frame analytics settings to update", + "required":true + } + } +} diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml index 43d20cc02b33a..9922f721255b1 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/ml/data_frame_analytics_crud.yml @@ -2100,3 +2100,53 @@ setup: "includes": ["excluded"] } } + +--- +"Test update given all updatable settings": + + - do: + ml.put_data_frame_analytics: + id: "update-test-job" + body: > + { + "source": { + "index": "index-source" + }, + "dest": { + "index": "index-dest" + }, + "analysis": {"outlier_detection":{}}, + "description": "before update", + "model_memory_limit": "20mb", + "allow_lazy_start": false + } + - match: { id: "update-test-job" } + - match: { description: "before update" } + - match: { model_memory_limit: "20mb" } + - match: { allow_lazy_start: false } + + - do: + ml.update_data_frame_analytics: + id: "update-test-job" + body: > + { + "description": "after update", + "model_memory_limit": "30mb", + "allow_lazy_start": true + } + - match: { id: "update-test-job" } + - match: { description: "after update" } + - match: { model_memory_limit: "30mb" } + - match: { allow_lazy_start: true } + +--- +"Test update given missing analytics": + + - do: + catch: missing + ml.update_data_frame_analytics: + id: "missing-analytics" + body: > + { + "description": "blah" + }