Skip to content

Commit c505e53

Browse files
Hendrik Muhsfxdgear
authored andcommitted
add forecast API to X-Pack, ML client (elastic#772)
1 parent 9721e4b commit c505e53

File tree

1 file changed

+15
-0
lines changed
  • elasticsearch/client/xpack

1 file changed

+15
-0
lines changed

elasticsearch/client/xpack/ml.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,21 @@ def delete_job(self, job_id, params=None):
307307
return self.transport.perform_request('DELETE', _make_path('_xpack',
308308
'ml', 'anomaly_detectors', job_id), params=params)
309309

310+
@query_params('duration', 'expires_in')
311+
def forecast_job(self, job_id, params=None):
312+
"""
313+
314+
`<http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html>`_
315+
316+
:arg job_id: The name of the job to close
317+
:arg duration: A period of time that indicates how far into the future to forecast
318+
:arg expires_in: The period of time that forecast results are retained.
319+
"""
320+
if job_id in SKIP_IN_PATH:
321+
raise ValueError("Empty value passed for a required argument 'job_id'.")
322+
return self.transport.perform_request('POST', _make_path('_xpack', 'ml',
323+
'anomaly_detectors', job_id, '_forecast'), params=params)
324+
310325
@query_params()
311326
def update_model_snapshot(self, job_id, snapshot_id, body, params=None):
312327
"""

0 commit comments

Comments
 (0)