From c505e53f6a6c1b29c5df2caeeca0d7109bc1c407 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 20 Apr 2018 22:13:06 +0200 Subject: [PATCH] add forecast API to X-Pack, ML client (#772) --- elasticsearch/client/xpack/ml.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/elasticsearch/client/xpack/ml.py b/elasticsearch/client/xpack/ml.py index 609c5834..668151eb 100644 --- a/elasticsearch/client/xpack/ml.py +++ b/elasticsearch/client/xpack/ml.py @@ -307,6 +307,21 @@ class MlClient(NamespacedClient): return self.transport.perform_request('DELETE', _make_path('_xpack', 'ml', 'anomaly_detectors', job_id), params=params) + @query_params('duration', 'expires_in') + def forecast_job(self, job_id, params=None): + """ + + ``_ + + :arg job_id: The name of the job to close + :arg duration: A period of time that indicates how far into the future to forecast + :arg expires_in: The period of time that forecast results are retained. + """ + if job_id in SKIP_IN_PATH: + raise ValueError("Empty value passed for a required argument 'job_id'.") + return self.transport.perform_request('POST', _make_path('_xpack', 'ml', + 'anomaly_detectors', job_id, '_forecast'), params=params) + @query_params() def update_model_snapshot(self, job_id, snapshot_id, body, params=None): """