1<?php
2/**
3 * Elasticsearch PHP client
4 *
5 * @link      https://github.com/elastic/elasticsearch-php/
6 * @copyright Copyright (c) Elasticsearch B.V (https://www.elastic.co)
7 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
8 * @license   https://www.gnu.org/licenses/lgpl-2.1.html GNU Lesser General Public License, Version 2.1
9 *
10 * Licensed to Elasticsearch B.V under one or more agreements.
11 * Elasticsearch B.V licenses this file to you under the Apache 2.0 License or
12 * the GNU Lesser General Public License, Version 2.1, at your option.
13 * See the LICENSE file in the project root for more information.
14 */
15declare(strict_types = 1);
16
17namespace Elasticsearch\Namespaces;
18
19use Elasticsearch\Namespaces\AbstractNamespace;
20
21/**
22 * Class MlNamespace
23 *
24 * NOTE: this file is autogenerated using util/GenerateEndpoints.php
25 * and Elasticsearch 7.16.0-SNAPSHOT (dfc9a8e7563ed5f24b5210ed21ed92ae182cd0ee)
26 */
27class MlNamespace extends AbstractNamespace
28{
29
30    /**
31     * Closes one or more anomaly detection jobs. A job can be opened and closed multiple times throughout its lifecycle.
32     *
33     * $params['job_id']         = (string) The name of the job to close
34     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
35     * $params['allow_no_jobs']  = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
36     * $params['force']          = (boolean) True if the job should be forcefully closed
37     * $params['timeout']        = (time) Controls the time to wait until a job has closed. Default to 30 minutes
38     * $params['body']           = (array) The URL params optionally sent in the body
39     *
40     * @param array $params Associative array of parameters
41     * @return array
42     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html
43     */
44    public function closeJob(array $params = [])
45    {
46        $job_id = $this->extractArgument($params, 'job_id');
47        $body = $this->extractArgument($params, 'body');
48
49        $endpointBuilder = $this->endpoints;
50        $endpoint = $endpointBuilder('Ml\CloseJob');
51        $endpoint->setParams($params);
52        $endpoint->setJobId($job_id);
53        $endpoint->setBody($body);
54
55        return $this->performRequest($endpoint);
56    }
57    /**
58     * Deletes a calendar.
59     *
60     * $params['calendar_id'] = (string) The ID of the calendar to delete
61     *
62     * @param array $params Associative array of parameters
63     * @return array
64     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar.html
65     */
66    public function deleteCalendar(array $params = [])
67    {
68        $calendar_id = $this->extractArgument($params, 'calendar_id');
69
70        $endpointBuilder = $this->endpoints;
71        $endpoint = $endpointBuilder('Ml\DeleteCalendar');
72        $endpoint->setParams($params);
73        $endpoint->setCalendarId($calendar_id);
74
75        return $this->performRequest($endpoint);
76    }
77    /**
78     * Deletes scheduled events from a calendar.
79     *
80     * $params['calendar_id'] = (string) The ID of the calendar to modify
81     * $params['event_id']    = (string) The ID of the event to remove from the calendar
82     *
83     * @param array $params Associative array of parameters
84     * @return array
85     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-event.html
86     */
87    public function deleteCalendarEvent(array $params = [])
88    {
89        $calendar_id = $this->extractArgument($params, 'calendar_id');
90        $event_id = $this->extractArgument($params, 'event_id');
91
92        $endpointBuilder = $this->endpoints;
93        $endpoint = $endpointBuilder('Ml\DeleteCalendarEvent');
94        $endpoint->setParams($params);
95        $endpoint->setCalendarId($calendar_id);
96        $endpoint->setEventId($event_id);
97
98        return $this->performRequest($endpoint);
99    }
100    /**
101     * Deletes anomaly detection jobs from a calendar.
102     *
103     * $params['calendar_id'] = (string) The ID of the calendar to modify
104     * $params['job_id']      = (string) The ID of the job to remove from the calendar
105     *
106     * @param array $params Associative array of parameters
107     * @return array
108     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-calendar-job.html
109     */
110    public function deleteCalendarJob(array $params = [])
111    {
112        $calendar_id = $this->extractArgument($params, 'calendar_id');
113        $job_id = $this->extractArgument($params, 'job_id');
114
115        $endpointBuilder = $this->endpoints;
116        $endpoint = $endpointBuilder('Ml\DeleteCalendarJob');
117        $endpoint->setParams($params);
118        $endpoint->setCalendarId($calendar_id);
119        $endpoint->setJobId($job_id);
120
121        return $this->performRequest($endpoint);
122    }
123    /**
124     * Deletes an existing data frame analytics job.
125     *
126     * $params['id']      = (string) The ID of the data frame analytics to delete
127     * $params['force']   = (boolean) True if the job should be forcefully deleted (Default = false)
128     * $params['timeout'] = (time) Controls the time to wait until a job is deleted. Defaults to 1 minute
129     *
130     * @param array $params Associative array of parameters
131     * @return array
132     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-dfanalytics.html
133     */
134    public function deleteDataFrameAnalytics(array $params = [])
135    {
136        $id = $this->extractArgument($params, 'id');
137
138        $endpointBuilder = $this->endpoints;
139        $endpoint = $endpointBuilder('Ml\DeleteDataFrameAnalytics');
140        $endpoint->setParams($params);
141        $endpoint->setId($id);
142
143        return $this->performRequest($endpoint);
144    }
145    /**
146     * Deletes an existing datafeed.
147     *
148     * $params['datafeed_id'] = (string) The ID of the datafeed to delete
149     * $params['force']       = (boolean) True if the datafeed should be forcefully deleted
150     *
151     * @param array $params Associative array of parameters
152     * @return array
153     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
154     */
155    public function deleteDatafeed(array $params = [])
156    {
157        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
158
159        $endpointBuilder = $this->endpoints;
160        $endpoint = $endpointBuilder('Ml\DeleteDatafeed');
161        $endpoint->setParams($params);
162        $endpoint->setDatafeedId($datafeed_id);
163
164        return $this->performRequest($endpoint);
165    }
166    /**
167     * Deletes expired and unused machine learning data.
168     *
169     * $params['job_id']              = (string) The ID of the job(s) to perform expired data hygiene for
170     * $params['requests_per_second'] = (number) The desired requests per second for the deletion processes.
171     * $params['timeout']             = (time) How long can the underlying delete processes run until they are canceled
172     * $params['body']                = (array) deleting expired data parameters
173     *
174     * @param array $params Associative array of parameters
175     * @return array
176     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-expired-data.html
177     */
178    public function deleteExpiredData(array $params = [])
179    {
180        $job_id = $this->extractArgument($params, 'job_id');
181        $body = $this->extractArgument($params, 'body');
182
183        $endpointBuilder = $this->endpoints;
184        $endpoint = $endpointBuilder('Ml\DeleteExpiredData');
185        $endpoint->setParams($params);
186        $endpoint->setJobId($job_id);
187        $endpoint->setBody($body);
188
189        return $this->performRequest($endpoint);
190    }
191    /**
192     * Deletes a filter.
193     *
194     * $params['filter_id'] = (string) The ID of the filter to delete
195     *
196     * @param array $params Associative array of parameters
197     * @return array
198     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-filter.html
199     */
200    public function deleteFilter(array $params = [])
201    {
202        $filter_id = $this->extractArgument($params, 'filter_id');
203
204        $endpointBuilder = $this->endpoints;
205        $endpoint = $endpointBuilder('Ml\DeleteFilter');
206        $endpoint->setParams($params);
207        $endpoint->setFilterId($filter_id);
208
209        return $this->performRequest($endpoint);
210    }
211    /**
212     * Deletes forecasts from a machine learning job.
213     *
214     * $params['job_id']             = (string) The ID of the job from which to delete forecasts (Required)
215     * $params['forecast_id']        = (string) The ID of the forecast to delete, can be comma delimited list. Leaving blank implies `_all`
216     * $params['allow_no_forecasts'] = (boolean) Whether to ignore if `_all` matches no forecasts
217     * $params['timeout']            = (time) Controls the time to wait until the forecast(s) are deleted. Default to 30 seconds
218     *
219     * @param array $params Associative array of parameters
220     * @return array
221     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-forecast.html
222     */
223    public function deleteForecast(array $params = [])
224    {
225        $job_id = $this->extractArgument($params, 'job_id');
226        $forecast_id = $this->extractArgument($params, 'forecast_id');
227
228        $endpointBuilder = $this->endpoints;
229        $endpoint = $endpointBuilder('Ml\DeleteForecast');
230        $endpoint->setParams($params);
231        $endpoint->setJobId($job_id);
232        $endpoint->setForecastId($forecast_id);
233
234        return $this->performRequest($endpoint);
235    }
236    /**
237     * Deletes an existing anomaly detection job.
238     *
239     * $params['job_id']              = (string) The ID of the job to delete
240     * $params['force']               = (boolean) True if the job should be forcefully deleted (Default = false)
241     * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = true)
242     *
243     * @param array $params Associative array of parameters
244     * @return array
245     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html
246     */
247    public function deleteJob(array $params = [])
248    {
249        $job_id = $this->extractArgument($params, 'job_id');
250
251        $endpointBuilder = $this->endpoints;
252        $endpoint = $endpointBuilder('Ml\DeleteJob');
253        $endpoint->setParams($params);
254        $endpoint->setJobId($job_id);
255
256        return $this->performRequest($endpoint);
257    }
258    /**
259     * Deletes an existing model snapshot.
260     *
261     * $params['job_id']      = (string) The ID of the job to fetch
262     * $params['snapshot_id'] = (string) The ID of the snapshot to delete
263     *
264     * @param array $params Associative array of parameters
265     * @return array
266     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html
267     */
268    public function deleteModelSnapshot(array $params = [])
269    {
270        $job_id = $this->extractArgument($params, 'job_id');
271        $snapshot_id = $this->extractArgument($params, 'snapshot_id');
272
273        $endpointBuilder = $this->endpoints;
274        $endpoint = $endpointBuilder('Ml\DeleteModelSnapshot');
275        $endpoint->setParams($params);
276        $endpoint->setJobId($job_id);
277        $endpoint->setSnapshotId($snapshot_id);
278
279        return $this->performRequest($endpoint);
280    }
281    /**
282     * Deletes an existing trained inference model that is currently not referenced by an ingest pipeline.
283     *
284     * $params['model_id'] = (string) The ID of the trained model to delete
285     *
286     * @param array $params Associative array of parameters
287     * @return array
288     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-trained-models.html
289     */
290    public function deleteTrainedModel(array $params = [])
291    {
292        $model_id = $this->extractArgument($params, 'model_id');
293
294        $endpointBuilder = $this->endpoints;
295        $endpoint = $endpointBuilder('Ml\DeleteTrainedModel');
296        $endpoint->setParams($params);
297        $endpoint->setModelId($model_id);
298
299        return $this->performRequest($endpoint);
300    }
301    /**
302     * Deletes a model alias that refers to the trained model
303     *
304     * $params['model_alias'] = (string) The trained model alias to delete
305     * $params['model_id']    = (string) The trained model where the model alias is assigned
306     *
307     * @param array $params Associative array of parameters
308     * @return array
309     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/delete-trained-models-aliases.html
310     */
311    public function deleteTrainedModelAlias(array $params = [])
312    {
313        $model_alias = $this->extractArgument($params, 'model_alias');
314        $model_id = $this->extractArgument($params, 'model_id');
315
316        $endpointBuilder = $this->endpoints;
317        $endpoint = $endpointBuilder('Ml\DeleteTrainedModelAlias');
318        $endpoint->setParams($params);
319        $endpoint->setModelAlias($model_alias);
320        $endpoint->setModelId($model_id);
321
322        return $this->performRequest($endpoint);
323    }
324    /**
325     * Estimates the model memory
326     *
327     * $params['body'] = (array) The analysis config, plus cardinality estimates for fields it references (Required)
328     *
329     * @param array $params Associative array of parameters
330     * @return array
331     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-apis.html
332     */
333    public function estimateModelMemory(array $params = [])
334    {
335        $body = $this->extractArgument($params, 'body');
336
337        $endpointBuilder = $this->endpoints;
338        $endpoint = $endpointBuilder('Ml\EstimateModelMemory');
339        $endpoint->setParams($params);
340        $endpoint->setBody($body);
341
342        return $this->performRequest($endpoint);
343    }
344    /**
345     * Evaluates the data frame analytics for an annotated index.
346     *
347     * $params['body'] = (array) The evaluation definition (Required)
348     *
349     * @param array $params Associative array of parameters
350     * @return array
351     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/evaluate-dfanalytics.html
352     */
353    public function evaluateDataFrame(array $params = [])
354    {
355        $body = $this->extractArgument($params, 'body');
356
357        $endpointBuilder = $this->endpoints;
358        $endpoint = $endpointBuilder('Ml\EvaluateDataFrame');
359        $endpoint->setParams($params);
360        $endpoint->setBody($body);
361
362        return $this->performRequest($endpoint);
363    }
364    /**
365     * Explains a data frame analytics config.
366     *
367     * $params['id']   = (string) The ID of the data frame analytics to explain
368     * $params['body'] = (array) The data frame analytics config to explain
369     *
370     * @param array $params Associative array of parameters
371     * @return array
372     * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/explain-dfanalytics.html
373     */
374    public function explainDataFrameAnalytics(array $params = [])
375    {
376        $id = $this->extractArgument($params, 'id');
377        $body = $this->extractArgument($params, 'body');
378
379        $endpointBuilder = $this->endpoints;
380        $endpoint = $endpointBuilder('Ml\ExplainDataFrameAnalytics');
381        $endpoint->setParams($params);
382        $endpoint->setId($id);
383        $endpoint->setBody($body);
384
385        return $this->performRequest($endpoint);
386    }
387    /**
388     * Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.
389     *
390     * $params['lines_to_sample']       = (int) How many lines of the file should be included in the analysis (Default = 1000)
391     * $params['line_merge_size_limit'] = (int) Maximum number of characters permitted in a single message when lines are merged to create messages. (Default = 10000)
392     * $params['timeout']               = (time) Timeout after which the analysis will be aborted (Default = 25s)
393     * $params['charset']               = (string) Optional parameter to specify the character set of the file
394     * $params['format']                = (enum) Optional parameter to specify the high level file format (Options = ndjson,xml,delimited,semi_structured_text)
395     * $params['has_header_row']        = (boolean) Optional parameter to specify whether a delimited file includes the column names in its first row
396     * $params['column_names']          = (list) Optional parameter containing a comma separated list of the column names for a delimited file
397     * $params['delimiter']             = (string) Optional parameter to specify the delimiter character for a delimited file - must be a single character
398     * $params['quote']                 = (string) Optional parameter to specify the quote character for a delimited file - must be a single character
399     * $params['should_trim_fields']    = (boolean) Optional parameter to specify whether the values between delimiters in a delimited file should have whitespace trimmed from them
400     * $params['grok_pattern']          = (string) Optional parameter to specify the Grok pattern that should be used to extract fields from messages in a semi-structured text file
401     * $params['timestamp_field']       = (string) Optional parameter to specify the timestamp field in the file
402     * $params['timestamp_format']      = (string) Optional parameter to specify the timestamp format in the file - may be either a Joda or Java time format
403     * $params['explain']               = (boolean) Whether to include a commentary on how the structure was derived (Default = false)
404     * $params['body']                  = (array) The contents of the file to be analyzed (Required)
405     *
406     * @param array $params Associative array of parameters
407     * @return array
408     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/find-structure.html
409     *
410     * @note This API is EXPERIMENTAL and may be changed or removed completely in a future release
411     *
412     */
413    public function findFileStructure(array $params = [])
414    {
415        $body = $this->extractArgument($params, 'body');
416
417        $endpointBuilder = $this->endpoints;
418        $endpoint = $endpointBuilder('Ml\FindFileStructure');
419        $endpoint->setParams($params);
420        $endpoint->setBody($body);
421
422        return $this->performRequest($endpoint);
423    }
424    /**
425     * Forces any buffered data to be processed by the job.
426     *
427     * $params['job_id']       = (string) The name of the job to flush
428     * $params['calc_interim'] = (boolean) Calculates interim results for the most recent bucket or all buckets within the latency period
429     * $params['start']        = (string) When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results
430     * $params['end']          = (string) When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results
431     * $params['advance_time'] = (string) Advances time to the given value generating results and updating the model for the advanced interval
432     * $params['skip_time']    = (string) Skips time to the given value without generating results or updating the model for the skipped interval
433     * $params['body']         = (array) Flush parameters
434     *
435     * @param array $params Associative array of parameters
436     * @return array
437     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html
438     */
439    public function flushJob(array $params = [])
440    {
441        $job_id = $this->extractArgument($params, 'job_id');
442        $body = $this->extractArgument($params, 'body');
443
444        $endpointBuilder = $this->endpoints;
445        $endpoint = $endpointBuilder('Ml\FlushJob');
446        $endpoint->setParams($params);
447        $endpoint->setJobId($job_id);
448        $endpoint->setBody($body);
449
450        return $this->performRequest($endpoint);
451    }
452    /**
453     * Predicts the future behavior of a time series by using its historical behavior.
454     *
455     * $params['job_id']           = (string) The ID of the job to forecast for
456     * $params['duration']         = (time) The duration of the forecast
457     * $params['expires_in']       = (time) The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity.
458     * $params['max_model_memory'] = (string) The max memory able to be used by the forecast. Default is 20mb.
459     *
460     * @param array $params Associative array of parameters
461     * @return array
462     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html
463     */
464    public function forecast(array $params = [])
465    {
466        $job_id = $this->extractArgument($params, 'job_id');
467
468        $endpointBuilder = $this->endpoints;
469        $endpoint = $endpointBuilder('Ml\Forecast');
470        $endpoint->setParams($params);
471        $endpoint->setJobId($job_id);
472
473        return $this->performRequest($endpoint);
474    }
475    /**
476     * Retrieves anomaly detection job results for one or more buckets.
477     *
478     * $params['job_id']          = (string) ID of the job to get bucket results from (Required)
479     * $params['timestamp']       = (string) The timestamp of the desired single bucket result
480     * $params['expand']          = (boolean) Include anomaly records
481     * $params['exclude_interim'] = (boolean) Exclude interim results
482     * $params['from']            = (int) skips a number of buckets
483     * $params['size']            = (int) specifies a max number of buckets to get
484     * $params['start']           = (string) Start time filter for buckets
485     * $params['end']             = (string) End time filter for buckets
486     * $params['anomaly_score']   = (double) Filter for the most anomalous buckets
487     * $params['sort']            = (string) Sort buckets by a particular field
488     * $params['desc']            = (boolean) Set the sort direction
489     * $params['body']            = (array) Bucket selection details if not provided in URI
490     *
491     * @param array $params Associative array of parameters
492     * @return array
493     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html
494     */
495    public function getBuckets(array $params = [])
496    {
497        $job_id = $this->extractArgument($params, 'job_id');
498        $timestamp = $this->extractArgument($params, 'timestamp');
499        $body = $this->extractArgument($params, 'body');
500
501        $endpointBuilder = $this->endpoints;
502        $endpoint = $endpointBuilder('Ml\GetBuckets');
503        $endpoint->setParams($params);
504        $endpoint->setJobId($job_id);
505        $endpoint->setTimestamp($timestamp);
506        $endpoint->setBody($body);
507
508        return $this->performRequest($endpoint);
509    }
510    /**
511     * Retrieves information about the scheduled events in calendars.
512     *
513     * $params['calendar_id'] = (string) The ID of the calendar containing the events
514     * $params['job_id']      = (string) Get events for the job. When this option is used calendar_id must be '_all'
515     * $params['start']       = (string) Get events after this time
516     * $params['end']         = (date) Get events before this time
517     * $params['from']        = (int) Skips a number of events
518     * $params['size']        = (int) Specifies a max number of events to get
519     *
520     * @param array $params Associative array of parameters
521     * @return array
522     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar-event.html
523     */
524    public function getCalendarEvents(array $params = [])
525    {
526        $calendar_id = $this->extractArgument($params, 'calendar_id');
527
528        $endpointBuilder = $this->endpoints;
529        $endpoint = $endpointBuilder('Ml\GetCalendarEvents');
530        $endpoint->setParams($params);
531        $endpoint->setCalendarId($calendar_id);
532
533        return $this->performRequest($endpoint);
534    }
535    /**
536     * Retrieves configuration information for calendars.
537     *
538     * $params['calendar_id'] = (string) The ID of the calendar to fetch
539     * $params['from']        = (int) skips a number of calendars
540     * $params['size']        = (int) specifies a max number of calendars to get
541     * $params['body']        = (array) The from and size parameters optionally sent in the body
542     *
543     * @param array $params Associative array of parameters
544     * @return array
545     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-calendar.html
546     */
547    public function getCalendars(array $params = [])
548    {
549        $calendar_id = $this->extractArgument($params, 'calendar_id');
550        $body = $this->extractArgument($params, 'body');
551
552        $endpointBuilder = $this->endpoints;
553        $endpoint = $endpointBuilder('Ml\GetCalendars');
554        $endpoint->setParams($params);
555        $endpoint->setCalendarId($calendar_id);
556        $endpoint->setBody($body);
557
558        return $this->performRequest($endpoint);
559    }
560    /**
561     * Retrieves anomaly detection job results for one or more categories.
562     *
563     * $params['job_id']                = (string) The name of the job (Required)
564     * $params['category_id']           = (long) The identifier of the category definition of interest
565     * $params['from']                  = (int) skips a number of categories
566     * $params['size']                  = (int) specifies a max number of categories to get
567     * $params['partition_field_value'] = (string) Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled.
568     * $params['body']                  = (array) Category selection details if not provided in URI
569     *
570     * @param array $params Associative array of parameters
571     * @return array
572     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
573     */
574    public function getCategories(array $params = [])
575    {
576        $job_id = $this->extractArgument($params, 'job_id');
577        $category_id = $this->extractArgument($params, 'category_id');
578        $body = $this->extractArgument($params, 'body');
579
580        $endpointBuilder = $this->endpoints;
581        $endpoint = $endpointBuilder('Ml\GetCategories');
582        $endpoint->setParams($params);
583        $endpoint->setJobId($job_id);
584        $endpoint->setCategoryId($category_id);
585        $endpoint->setBody($body);
586
587        return $this->performRequest($endpoint);
588    }
589    /**
590     * Retrieves configuration information for data frame analytics jobs.
591     *
592     * $params['id']                = (string) The ID of the data frame analytics to fetch
593     * $params['allow_no_match']    = (boolean) Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) (Default = true)
594     * $params['from']              = (int) skips a number of analytics (Default = 0)
595     * $params['size']              = (int) specifies a max number of analytics to get (Default = 100)
596     * $params['exclude_generated'] = (boolean) Omits fields that are illegal to set on data frame analytics PUT (Default = false)
597     *
598     * @param array $params Associative array of parameters
599     * @return array
600     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics.html
601     */
602    public function getDataFrameAnalytics(array $params = [])
603    {
604        $id = $this->extractArgument($params, 'id');
605
606        $endpointBuilder = $this->endpoints;
607        $endpoint = $endpointBuilder('Ml\GetDataFrameAnalytics');
608        $endpoint->setParams($params);
609        $endpoint->setId($id);
610
611        return $this->performRequest($endpoint);
612    }
613    /**
614     * Retrieves usage information for data frame analytics jobs.
615     *
616     * $params['id']             = (string) The ID of the data frame analytics stats to fetch
617     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified) (Default = true)
618     * $params['from']           = (int) skips a number of analytics (Default = 0)
619     * $params['size']           = (int) specifies a max number of analytics to get (Default = 100)
620     * $params['verbose']        = (boolean) whether the stats response should be verbose (Default = false)
621     *
622     * @param array $params Associative array of parameters
623     * @return array
624     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-dfanalytics-stats.html
625     */
626    public function getDataFrameAnalyticsStats(array $params = [])
627    {
628        $id = $this->extractArgument($params, 'id');
629
630        $endpointBuilder = $this->endpoints;
631        $endpoint = $endpointBuilder('Ml\GetDataFrameAnalyticsStats');
632        $endpoint->setParams($params);
633        $endpoint->setId($id);
634
635        return $this->performRequest($endpoint);
636    }
637    /**
638     * Retrieves usage information for datafeeds.
639     *
640     * $params['datafeed_id']        = (string) The ID of the datafeeds stats to fetch
641     * $params['allow_no_match']     = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
642     * $params['allow_no_datafeeds'] = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
643     *
644     * @param array $params Associative array of parameters
645     * @return array
646     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html
647     */
648    public function getDatafeedStats(array $params = [])
649    {
650        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
651
652        $endpointBuilder = $this->endpoints;
653        $endpoint = $endpointBuilder('Ml\GetDatafeedStats');
654        $endpoint->setParams($params);
655        $endpoint->setDatafeedId($datafeed_id);
656
657        return $this->performRequest($endpoint);
658    }
659    /**
660     * Retrieves configuration information for datafeeds.
661     *
662     * $params['datafeed_id']        = (string) The ID of the datafeeds to fetch
663     * $params['allow_no_match']     = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
664     * $params['allow_no_datafeeds'] = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
665     * $params['exclude_generated']  = (boolean) Omits fields that are illegal to set on datafeed PUT (Default = false)
666     *
667     * @param array $params Associative array of parameters
668     * @return array
669     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed.html
670     */
671    public function getDatafeeds(array $params = [])
672    {
673        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
674
675        $endpointBuilder = $this->endpoints;
676        $endpoint = $endpointBuilder('Ml\GetDatafeeds');
677        $endpoint->setParams($params);
678        $endpoint->setDatafeedId($datafeed_id);
679
680        return $this->performRequest($endpoint);
681    }
682    /**
683     * Retrieves filters.
684     *
685     * $params['filter_id'] = (string) The ID of the filter to fetch
686     * $params['from']      = (int) skips a number of filters
687     * $params['size']      = (int) specifies a max number of filters to get
688     *
689     * @param array $params Associative array of parameters
690     * @return array
691     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-filter.html
692     */
693    public function getFilters(array $params = [])
694    {
695        $filter_id = $this->extractArgument($params, 'filter_id');
696
697        $endpointBuilder = $this->endpoints;
698        $endpoint = $endpointBuilder('Ml\GetFilters');
699        $endpoint->setParams($params);
700        $endpoint->setFilterId($filter_id);
701
702        return $this->performRequest($endpoint);
703    }
704    /**
705     * Retrieves anomaly detection job results for one or more influencers.
706     *
707     * $params['job_id']           = (string) Identifier for the anomaly detection job
708     * $params['exclude_interim']  = (boolean) Exclude interim results
709     * $params['from']             = (int) skips a number of influencers
710     * $params['size']             = (int) specifies a max number of influencers to get
711     * $params['start']            = (string) start timestamp for the requested influencers
712     * $params['end']              = (string) end timestamp for the requested influencers
713     * $params['influencer_score'] = (double) influencer score threshold for the requested influencers
714     * $params['sort']             = (string) sort field for the requested influencers
715     * $params['desc']             = (boolean) whether the results should be sorted in decending order
716     * $params['body']             = (array) Influencer selection criteria
717     *
718     * @param array $params Associative array of parameters
719     * @return array
720     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-influencer.html
721     */
722    public function getInfluencers(array $params = [])
723    {
724        $job_id = $this->extractArgument($params, 'job_id');
725        $body = $this->extractArgument($params, 'body');
726
727        $endpointBuilder = $this->endpoints;
728        $endpoint = $endpointBuilder('Ml\GetInfluencers');
729        $endpoint->setParams($params);
730        $endpoint->setJobId($job_id);
731        $endpoint->setBody($body);
732
733        return $this->performRequest($endpoint);
734    }
735    /**
736     * Retrieves usage information for anomaly detection jobs.
737     *
738     * $params['job_id']         = (string) The ID of the jobs stats to fetch
739     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
740     * $params['allow_no_jobs']  = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
741     *
742     * @param array $params Associative array of parameters
743     * @return array
744     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-stats.html
745     */
746    public function getJobStats(array $params = [])
747    {
748        $job_id = $this->extractArgument($params, 'job_id');
749
750        $endpointBuilder = $this->endpoints;
751        $endpoint = $endpointBuilder('Ml\GetJobStats');
752        $endpoint->setParams($params);
753        $endpoint->setJobId($job_id);
754
755        return $this->performRequest($endpoint);
756    }
757    /**
758     * Retrieves configuration information for anomaly detection jobs.
759     *
760     * $params['job_id']            = (string) The ID of the jobs to fetch
761     * $params['allow_no_match']    = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
762     * $params['allow_no_jobs']     = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
763     * $params['exclude_generated'] = (boolean) Omits fields that are illegal to set on job PUT (Default = false)
764     *
765     * @param array $params Associative array of parameters
766     * @return array
767     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job.html
768     */
769    public function getJobs(array $params = [])
770    {
771        $job_id = $this->extractArgument($params, 'job_id');
772
773        $endpointBuilder = $this->endpoints;
774        $endpoint = $endpointBuilder('Ml\GetJobs');
775        $endpoint->setParams($params);
776        $endpoint->setJobId($job_id);
777
778        return $this->performRequest($endpoint);
779    }
780    /**
781     * Retrieves information about model snapshots.
782     *
783     * $params['job_id']      = (string) The ID of the job to fetch (Required)
784     * $params['snapshot_id'] = (string) The ID of the snapshot to fetch
785     * $params['from']        = (int) Skips a number of documents
786     * $params['size']        = (int) The default number of documents returned in queries as a string.
787     * $params['start']       = (date) The filter 'start' query parameter
788     * $params['end']         = (date) The filter 'end' query parameter
789     * $params['sort']        = (string) Name of the field to sort on
790     * $params['desc']        = (boolean) True if the results should be sorted in descending order
791     * $params['body']        = (array) Model snapshot selection criteria
792     *
793     * @param array $params Associative array of parameters
794     * @return array
795     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-snapshot.html
796     */
797    public function getModelSnapshots(array $params = [])
798    {
799        $job_id = $this->extractArgument($params, 'job_id');
800        $snapshot_id = $this->extractArgument($params, 'snapshot_id');
801        $body = $this->extractArgument($params, 'body');
802
803        $endpointBuilder = $this->endpoints;
804        $endpoint = $endpointBuilder('Ml\GetModelSnapshots');
805        $endpoint->setParams($params);
806        $endpoint->setJobId($job_id);
807        $endpoint->setSnapshotId($snapshot_id);
808        $endpoint->setBody($body);
809
810        return $this->performRequest($endpoint);
811    }
812    /**
813     * Retrieves overall bucket results that summarize the bucket results of multiple anomaly detection jobs.
814     *
815     * $params['job_id']          = (string) The job IDs for which to calculate overall bucket results
816     * $params['top_n']           = (int) The number of top job bucket scores to be used in the overall_score calculation
817     * $params['bucket_span']     = (string) The span of the overall buckets. Defaults to the longest job bucket_span
818     * $params['overall_score']   = (double) Returns overall buckets with overall scores higher than this value
819     * $params['exclude_interim'] = (boolean) If true overall buckets that include interim buckets will be excluded
820     * $params['start']           = (string) Returns overall buckets with timestamps after this time
821     * $params['end']             = (string) Returns overall buckets with timestamps earlier than this time
822     * $params['allow_no_match']  = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
823     * $params['allow_no_jobs']   = (boolean) Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
824     * $params['body']            = (array) Overall bucket selection details if not provided in URI
825     *
826     * @param array $params Associative array of parameters
827     * @return array
828     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-overall-buckets.html
829     */
830    public function getOverallBuckets(array $params = [])
831    {
832        $job_id = $this->extractArgument($params, 'job_id');
833        $body = $this->extractArgument($params, 'body');
834
835        $endpointBuilder = $this->endpoints;
836        $endpoint = $endpointBuilder('Ml\GetOverallBuckets');
837        $endpoint->setParams($params);
838        $endpoint->setJobId($job_id);
839        $endpoint->setBody($body);
840
841        return $this->performRequest($endpoint);
842    }
843    /**
844     * Retrieves anomaly records for an anomaly detection job.
845     *
846     * $params['job_id']          = (string) The ID of the job
847     * $params['exclude_interim'] = (boolean) Exclude interim results
848     * $params['from']            = (int) skips a number of records
849     * $params['size']            = (int) specifies a max number of records to get
850     * $params['start']           = (string) Start time filter for records
851     * $params['end']             = (string) End time filter for records
852     * $params['record_score']    = (double) Returns records with anomaly scores greater or equal than this value
853     * $params['sort']            = (string) Sort records by a particular field
854     * $params['desc']            = (boolean) Set the sort direction
855     * $params['body']            = (array) Record selection criteria
856     *
857     * @param array $params Associative array of parameters
858     * @return array
859     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-record.html
860     */
861    public function getRecords(array $params = [])
862    {
863        $job_id = $this->extractArgument($params, 'job_id');
864        $body = $this->extractArgument($params, 'body');
865
866        $endpointBuilder = $this->endpoints;
867        $endpoint = $endpointBuilder('Ml\GetRecords');
868        $endpoint->setParams($params);
869        $endpoint->setJobId($job_id);
870        $endpoint->setBody($body);
871
872        return $this->performRequest($endpoint);
873    }
874    /**
875     * Retrieves configuration information for a trained inference model.
876     *
877     * $params['model_id']                 = (string) The ID of the trained models to fetch
878     * $params['allow_no_match']           = (boolean) Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) (Default = true)
879     * $params['include']                  = (string) A comma-separate list of fields to optionally include. Valid options are 'definition' and 'total_feature_importance'. Default is none.
880     * $params['include_model_definition'] = (boolean) Should the full model definition be included in the results. These definitions can be large. So be cautious when including them. Defaults to false. (Default = false)
881     * $params['decompress_definition']    = (boolean) Should the model definition be decompressed into valid JSON or returned in a custom compressed format. Defaults to true. (Default = true)
882     * $params['from']                     = (int) skips a number of trained models (Default = 0)
883     * $params['size']                     = (int) specifies a max number of trained models to get (Default = 100)
884     * $params['tags']                     = (list) A comma-separated list of tags that the model must have.
885     * $params['exclude_generated']        = (boolean) Omits fields that are illegal to set on model PUT (Default = false)
886     *
887     * @param array $params Associative array of parameters
888     * @return array
889     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models.html
890     */
891    public function getTrainedModels(array $params = [])
892    {
893        $model_id = $this->extractArgument($params, 'model_id');
894
895        $endpointBuilder = $this->endpoints;
896        $endpoint = $endpointBuilder('Ml\GetTrainedModels');
897        $endpoint->setParams($params);
898        $endpoint->setModelId($model_id);
899
900        return $this->performRequest($endpoint);
901    }
902    /**
903     * Retrieves usage information for trained inference models.
904     *
905     * $params['model_id']       = (string) The ID of the trained models stats to fetch
906     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no trained models. (This includes `_all` string or when no trained models have been specified) (Default = true)
907     * $params['from']           = (int) skips a number of trained models (Default = 0)
908     * $params['size']           = (int) specifies a max number of trained models to get (Default = 100)
909     *
910     * @param array $params Associative array of parameters
911     * @return array
912     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-trained-models-stats.html
913     */
914    public function getTrainedModelsStats(array $params = [])
915    {
916        $model_id = $this->extractArgument($params, 'model_id');
917
918        $endpointBuilder = $this->endpoints;
919        $endpoint = $endpointBuilder('Ml\GetTrainedModelsStats');
920        $endpoint->setParams($params);
921        $endpoint->setModelId($model_id);
922
923        return $this->performRequest($endpoint);
924    }
925    /**
926     * Returns defaults and limits used by machine learning.
927     *
928     *
929     * @param array $params Associative array of parameters
930     * @return array
931     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/get-ml-info.html
932     */
933    public function info(array $params = [])
934    {
935
936        $endpointBuilder = $this->endpoints;
937        $endpoint = $endpointBuilder('Ml\Info');
938        $endpoint->setParams($params);
939
940        return $this->performRequest($endpoint);
941    }
942    /**
943     * Opens one or more anomaly detection jobs.
944     *
945     * $params['job_id'] = (string) The ID of the job to open
946     *
947     * @param array $params Associative array of parameters
948     * @return array
949     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-open-job.html
950     */
951    public function openJob(array $params = [])
952    {
953        $job_id = $this->extractArgument($params, 'job_id');
954
955        $endpointBuilder = $this->endpoints;
956        $endpoint = $endpointBuilder('Ml\OpenJob');
957        $endpoint->setParams($params);
958        $endpoint->setJobId($job_id);
959
960        return $this->performRequest($endpoint);
961    }
962    /**
963     * Posts scheduled events in a calendar.
964     *
965     * $params['calendar_id'] = (string) The ID of the calendar to modify
966     * $params['body']        = (array) A list of events (Required)
967     *
968     * @param array $params Associative array of parameters
969     * @return array
970     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-calendar-event.html
971     */
972    public function postCalendarEvents(array $params = [])
973    {
974        $calendar_id = $this->extractArgument($params, 'calendar_id');
975        $body = $this->extractArgument($params, 'body');
976
977        $endpointBuilder = $this->endpoints;
978        $endpoint = $endpointBuilder('Ml\PostCalendarEvents');
979        $endpoint->setParams($params);
980        $endpoint->setCalendarId($calendar_id);
981        $endpoint->setBody($body);
982
983        return $this->performRequest($endpoint);
984    }
985    /**
986     * Sends data to an anomaly detection job for analysis.
987     *
988     * $params['job_id']      = (string) The name of the job receiving the data
989     * $params['reset_start'] = (string) Optional parameter to specify the start of the bucket resetting range
990     * $params['reset_end']   = (string) Optional parameter to specify the end of the bucket resetting range
991     * $params['body']        = (array) The data to process (Required)
992     *
993     * @param array $params Associative array of parameters
994     * @return array
995     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-post-data.html
996     */
997    public function postData(array $params = [])
998    {
999        $job_id = $this->extractArgument($params, 'job_id');
1000        $body = $this->extractArgument($params, 'body');
1001
1002        $endpointBuilder = $this->endpoints;
1003        $endpoint = $endpointBuilder('Ml\PostData');
1004        $endpoint->setParams($params);
1005        $endpoint->setJobId($job_id);
1006        $endpoint->setBody($body);
1007
1008        return $this->performRequest($endpoint);
1009    }
1010    /**
1011     * Previews that will be analyzed given a data frame analytics config.
1012     *
1013     * $params['id']   = (string) The ID of the data frame analytics to preview
1014     * $params['body'] = (array) The data frame analytics config to preview
1015     *
1016     * @param array $params Associative array of parameters
1017     * @return array
1018     * @see http://www.elastic.co/guide/en/elasticsearch/reference/current/preview-dfanalytics.html
1019     */
1020    public function previewDataFrameAnalytics(array $params = [])
1021    {
1022        $id = $this->extractArgument($params, 'id');
1023        $body = $this->extractArgument($params, 'body');
1024
1025        $endpointBuilder = $this->endpoints;
1026        $endpoint = $endpointBuilder('Ml\PreviewDataFrameAnalytics');
1027        $endpoint->setParams($params);
1028        $endpoint->setId($id);
1029        $endpoint->setBody($body);
1030
1031        return $this->performRequest($endpoint);
1032    }
1033    /**
1034     * Previews a datafeed.
1035     *
1036     * $params['datafeed_id'] = (string) The ID of the datafeed to preview
1037     * $params['body']        = (array) The datafeed config and job config with which to execute the preview
1038     *
1039     * @param array $params Associative array of parameters
1040     * @return array
1041     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-preview-datafeed.html
1042     */
1043    public function previewDatafeed(array $params = [])
1044    {
1045        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
1046        $body = $this->extractArgument($params, 'body');
1047
1048        $endpointBuilder = $this->endpoints;
1049        $endpoint = $endpointBuilder('Ml\PreviewDatafeed');
1050        $endpoint->setParams($params);
1051        $endpoint->setDatafeedId($datafeed_id);
1052        $endpoint->setBody($body);
1053
1054        return $this->performRequest($endpoint);
1055    }
1056    /**
1057     * Instantiates a calendar.
1058     *
1059     * $params['calendar_id'] = (string) The ID of the calendar to create
1060     * $params['body']        = (array) The calendar details
1061     *
1062     * @param array $params Associative array of parameters
1063     * @return array
1064     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar.html
1065     */
1066    public function putCalendar(array $params = [])
1067    {
1068        $calendar_id = $this->extractArgument($params, 'calendar_id');
1069        $body = $this->extractArgument($params, 'body');
1070
1071        $endpointBuilder = $this->endpoints;
1072        $endpoint = $endpointBuilder('Ml\PutCalendar');
1073        $endpoint->setParams($params);
1074        $endpoint->setCalendarId($calendar_id);
1075        $endpoint->setBody($body);
1076
1077        return $this->performRequest($endpoint);
1078    }
1079    /**
1080     * Adds an anomaly detection job to a calendar.
1081     *
1082     * $params['calendar_id'] = (string) The ID of the calendar to modify
1083     * $params['job_id']      = (string) The ID of the job to add to the calendar
1084     *
1085     * @param array $params Associative array of parameters
1086     * @return array
1087     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-calendar-job.html
1088     */
1089    public function putCalendarJob(array $params = [])
1090    {
1091        $calendar_id = $this->extractArgument($params, 'calendar_id');
1092        $job_id = $this->extractArgument($params, 'job_id');
1093
1094        $endpointBuilder = $this->endpoints;
1095        $endpoint = $endpointBuilder('Ml\PutCalendarJob');
1096        $endpoint->setParams($params);
1097        $endpoint->setCalendarId($calendar_id);
1098        $endpoint->setJobId($job_id);
1099
1100        return $this->performRequest($endpoint);
1101    }
1102    /**
1103     * Instantiates a data frame analytics job.
1104     *
1105     * $params['id']   = (string) The ID of the data frame analytics to create
1106     * $params['body'] = (array) The data frame analytics configuration (Required)
1107     *
1108     * @param array $params Associative array of parameters
1109     * @return array
1110     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-dfanalytics.html
1111     */
1112    public function putDataFrameAnalytics(array $params = [])
1113    {
1114        $id = $this->extractArgument($params, 'id');
1115        $body = $this->extractArgument($params, 'body');
1116
1117        $endpointBuilder = $this->endpoints;
1118        $endpoint = $endpointBuilder('Ml\PutDataFrameAnalytics');
1119        $endpoint->setParams($params);
1120        $endpoint->setId($id);
1121        $endpoint->setBody($body);
1122
1123        return $this->performRequest($endpoint);
1124    }
1125    /**
1126     * Instantiates a datafeed.
1127     *
1128     * $params['datafeed_id']        = (string) The ID of the datafeed to create
1129     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false)
1130     * $params['allow_no_indices']   = (boolean) Ignore if the source indices expressions resolves to no concrete indices (default: true)
1131     * $params['ignore_throttled']   = (boolean) Ignore indices that are marked as throttled (default: true)
1132     * $params['expand_wildcards']   = (enum) Whether source index expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all)
1133     * $params['body']               = (array) The datafeed config (Required)
1134     *
1135     * @param array $params Associative array of parameters
1136     * @return array
1137     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-datafeed.html
1138     */
1139    public function putDatafeed(array $params = [])
1140    {
1141        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
1142        $body = $this->extractArgument($params, 'body');
1143
1144        $endpointBuilder = $this->endpoints;
1145        $endpoint = $endpointBuilder('Ml\PutDatafeed');
1146        $endpoint->setParams($params);
1147        $endpoint->setDatafeedId($datafeed_id);
1148        $endpoint->setBody($body);
1149
1150        return $this->performRequest($endpoint);
1151    }
1152    /**
1153     * Instantiates a filter.
1154     *
1155     * $params['filter_id'] = (string) The ID of the filter to create
1156     * $params['body']      = (array) The filter details (Required)
1157     *
1158     * @param array $params Associative array of parameters
1159     * @return array
1160     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-filter.html
1161     */
1162    public function putFilter(array $params = [])
1163    {
1164        $filter_id = $this->extractArgument($params, 'filter_id');
1165        $body = $this->extractArgument($params, 'body');
1166
1167        $endpointBuilder = $this->endpoints;
1168        $endpoint = $endpointBuilder('Ml\PutFilter');
1169        $endpoint->setParams($params);
1170        $endpoint->setFilterId($filter_id);
1171        $endpoint->setBody($body);
1172
1173        return $this->performRequest($endpoint);
1174    }
1175    /**
1176     * Instantiates an anomaly detection job.
1177     *
1178     * $params['job_id']             = (string) The ID of the job to create
1179     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false). Only set if datafeed_config is provided.
1180     * $params['allow_no_indices']   = (boolean) Ignore if the source indices expressions resolves to no concrete indices (default: true). Only set if datafeed_config is provided.
1181     * $params['ignore_throttled']   = (boolean) Ignore indices that are marked as throttled (default: true). Only set if datafeed_config is provided.
1182     * $params['expand_wildcards']   = (enum) Whether source index expressions should get expanded to open or closed indices (default: open). Only set if datafeed_config is provided. (Options = open,closed,hidden,none,all)
1183     * $params['body']               = (array) The job (Required)
1184     *
1185     * @param array $params Associative array of parameters
1186     * @return array
1187     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-put-job.html
1188     */
1189    public function putJob(array $params = [])
1190    {
1191        $job_id = $this->extractArgument($params, 'job_id');
1192        $body = $this->extractArgument($params, 'body');
1193
1194        $endpointBuilder = $this->endpoints;
1195        $endpoint = $endpointBuilder('Ml\PutJob');
1196        $endpoint->setParams($params);
1197        $endpoint->setJobId($job_id);
1198        $endpoint->setBody($body);
1199
1200        return $this->performRequest($endpoint);
1201    }
1202    /**
1203     * Creates an inference trained model.
1204     *
1205     * $params['model_id']                       = (string) The ID of the trained models to store
1206     * $params['defer_definition_decompression'] = (boolean) If set to `true` and a `compressed_definition` is provided, the request defers definition decompression and skips relevant validations. (Default = false)
1207     * $params['body']                           = (array) The trained model configuration (Required)
1208     *
1209     * @param array $params Associative array of parameters
1210     * @return array
1211     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models.html
1212     */
1213    public function putTrainedModel(array $params = [])
1214    {
1215        $model_id = $this->extractArgument($params, 'model_id');
1216        $body = $this->extractArgument($params, 'body');
1217
1218        $endpointBuilder = $this->endpoints;
1219        $endpoint = $endpointBuilder('Ml\PutTrainedModel');
1220        $endpoint->setParams($params);
1221        $endpoint->setModelId($model_id);
1222        $endpoint->setBody($body);
1223
1224        return $this->performRequest($endpoint);
1225    }
1226    /**
1227     * Creates a new model alias (or reassigns an existing one) to refer to the trained model
1228     *
1229     * $params['model_alias'] = (string) The trained model alias to update
1230     * $params['model_id']    = (string) The trained model where the model alias should be assigned
1231     * $params['reassign']    = (boolean) If the model_alias already exists and points to a separate model_id, this parameter must be true. Defaults to false.
1232     *
1233     * @param array $params Associative array of parameters
1234     * @return array
1235     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/put-trained-models-aliases.html
1236     */
1237    public function putTrainedModelAlias(array $params = [])
1238    {
1239        $model_alias = $this->extractArgument($params, 'model_alias');
1240        $model_id = $this->extractArgument($params, 'model_id');
1241
1242        $endpointBuilder = $this->endpoints;
1243        $endpoint = $endpointBuilder('Ml\PutTrainedModelAlias');
1244        $endpoint->setParams($params);
1245        $endpoint->setModelAlias($model_alias);
1246        $endpoint->setModelId($model_id);
1247
1248        return $this->performRequest($endpoint);
1249    }
1250    /**
1251     * Resets an existing anomaly detection job.
1252     *
1253     * $params['job_id']              = (string) The ID of the job to reset
1254     * $params['wait_for_completion'] = (boolean) Should this request wait until the operation has completed before returning (Default = true)
1255     *
1256     * @param array $params Associative array of parameters
1257     * @return array
1258     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-reset-job.html
1259     */
1260    public function resetJob(array $params = [])
1261    {
1262        $job_id = $this->extractArgument($params, 'job_id');
1263
1264        $endpointBuilder = $this->endpoints;
1265        $endpoint = $endpointBuilder('Ml\ResetJob');
1266        $endpoint->setParams($params);
1267        $endpoint->setJobId($job_id);
1268
1269        return $this->performRequest($endpoint);
1270    }
1271    /**
1272     * Reverts to a specific snapshot.
1273     *
1274     * $params['job_id']                     = (string) The ID of the job to fetch
1275     * $params['snapshot_id']                = (string) The ID of the snapshot to revert to
1276     * $params['delete_intervening_results'] = (boolean) Should we reset the results back to the time of the snapshot?
1277     * $params['body']                       = (array) Reversion options
1278     *
1279     * @param array $params Associative array of parameters
1280     * @return array
1281     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-revert-snapshot.html
1282     */
1283    public function revertModelSnapshot(array $params = [])
1284    {
1285        $job_id = $this->extractArgument($params, 'job_id');
1286        $snapshot_id = $this->extractArgument($params, 'snapshot_id');
1287        $body = $this->extractArgument($params, 'body');
1288
1289        $endpointBuilder = $this->endpoints;
1290        $endpoint = $endpointBuilder('Ml\RevertModelSnapshot');
1291        $endpoint->setParams($params);
1292        $endpoint->setJobId($job_id);
1293        $endpoint->setSnapshotId($snapshot_id);
1294        $endpoint->setBody($body);
1295
1296        return $this->performRequest($endpoint);
1297    }
1298    /**
1299     * Sets a cluster wide upgrade_mode setting that prepares machine learning indices for an upgrade.
1300     *
1301     * $params['enabled'] = (boolean) Whether to enable upgrade_mode ML setting or not. Defaults to false.
1302     * $params['timeout'] = (time) Controls the time to wait before action times out. Defaults to 30 seconds
1303     *
1304     * @param array $params Associative array of parameters
1305     * @return array
1306     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-set-upgrade-mode.html
1307     */
1308    public function setUpgradeMode(array $params = [])
1309    {
1310
1311        $endpointBuilder = $this->endpoints;
1312        $endpoint = $endpointBuilder('Ml\SetUpgradeMode');
1313        $endpoint->setParams($params);
1314
1315        return $this->performRequest($endpoint);
1316    }
1317    /**
1318     * Starts a data frame analytics job.
1319     *
1320     * $params['id']      = (string) The ID of the data frame analytics to start
1321     * $params['timeout'] = (time) Controls the time to wait until the task has started. Defaults to 20 seconds
1322     * $params['body']    = (array) The start data frame analytics parameters
1323     *
1324     * @param array $params Associative array of parameters
1325     * @return array
1326     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/start-dfanalytics.html
1327     */
1328    public function startDataFrameAnalytics(array $params = [])
1329    {
1330        $id = $this->extractArgument($params, 'id');
1331        $body = $this->extractArgument($params, 'body');
1332
1333        $endpointBuilder = $this->endpoints;
1334        $endpoint = $endpointBuilder('Ml\StartDataFrameAnalytics');
1335        $endpoint->setParams($params);
1336        $endpoint->setId($id);
1337        $endpoint->setBody($body);
1338
1339        return $this->performRequest($endpoint);
1340    }
1341    /**
1342     * Starts one or more datafeeds.
1343     *
1344     * $params['datafeed_id'] = (string) The ID of the datafeed to start
1345     * $params['start']       = (string) The start time from where the datafeed should begin
1346     * $params['end']         = (string) The end time when the datafeed should stop. When not set, the datafeed continues in real time
1347     * $params['timeout']     = (time) Controls the time to wait until a datafeed has started. Default to 20 seconds
1348     * $params['body']        = (array) The start datafeed parameters
1349     *
1350     * @param array $params Associative array of parameters
1351     * @return array
1352     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-start-datafeed.html
1353     */
1354    public function startDatafeed(array $params = [])
1355    {
1356        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
1357        $body = $this->extractArgument($params, 'body');
1358
1359        $endpointBuilder = $this->endpoints;
1360        $endpoint = $endpointBuilder('Ml\StartDatafeed');
1361        $endpoint->setParams($params);
1362        $endpoint->setDatafeedId($datafeed_id);
1363        $endpoint->setBody($body);
1364
1365        return $this->performRequest($endpoint);
1366    }
1367    /**
1368     * Stops one or more data frame analytics jobs.
1369     *
1370     * $params['id']             = (string) The ID of the data frame analytics to stop
1371     * $params['allow_no_match'] = (boolean) Whether to ignore if a wildcard expression matches no data frame analytics. (This includes `_all` string or when no data frame analytics have been specified)
1372     * $params['force']          = (boolean) True if the data frame analytics should be forcefully stopped
1373     * $params['timeout']        = (time) Controls the time to wait until the task has stopped. Defaults to 20 seconds
1374     * $params['body']           = (array) The stop data frame analytics parameters
1375     *
1376     * @param array $params Associative array of parameters
1377     * @return array
1378     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/stop-dfanalytics.html
1379     */
1380    public function stopDataFrameAnalytics(array $params = [])
1381    {
1382        $id = $this->extractArgument($params, 'id');
1383        $body = $this->extractArgument($params, 'body');
1384
1385        $endpointBuilder = $this->endpoints;
1386        $endpoint = $endpointBuilder('Ml\StopDataFrameAnalytics');
1387        $endpoint->setParams($params);
1388        $endpoint->setId($id);
1389        $endpoint->setBody($body);
1390
1391        return $this->performRequest($endpoint);
1392    }
1393    /**
1394     * Stops one or more datafeeds.
1395     *
1396     * $params['datafeed_id']        = (string) The ID of the datafeed to stop
1397     * $params['allow_no_match']     = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
1398     * $params['allow_no_datafeeds'] = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
1399     * $params['force']              = (boolean) True if the datafeed should be forcefully stopped.
1400     * $params['timeout']            = (time) Controls the time to wait until a datafeed has stopped. Default to 20 seconds
1401     * $params['body']               = (array) The URL params optionally sent in the body
1402     *
1403     * @param array $params Associative array of parameters
1404     * @return array
1405     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-stop-datafeed.html
1406     */
1407    public function stopDatafeed(array $params = [])
1408    {
1409        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
1410        $body = $this->extractArgument($params, 'body');
1411
1412        $endpointBuilder = $this->endpoints;
1413        $endpoint = $endpointBuilder('Ml\StopDatafeed');
1414        $endpoint->setParams($params);
1415        $endpoint->setDatafeedId($datafeed_id);
1416        $endpoint->setBody($body);
1417
1418        return $this->performRequest($endpoint);
1419    }
1420    /**
1421     * Updates certain properties of a data frame analytics job.
1422     *
1423     * $params['id']   = (string) The ID of the data frame analytics to update
1424     * $params['body'] = (array) The data frame analytics settings to update (Required)
1425     *
1426     * @param array $params Associative array of parameters
1427     * @return array
1428     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/update-dfanalytics.html
1429     */
1430    public function updateDataFrameAnalytics(array $params = [])
1431    {
1432        $id = $this->extractArgument($params, 'id');
1433        $body = $this->extractArgument($params, 'body');
1434
1435        $endpointBuilder = $this->endpoints;
1436        $endpoint = $endpointBuilder('Ml\UpdateDataFrameAnalytics');
1437        $endpoint->setParams($params);
1438        $endpoint->setId($id);
1439        $endpoint->setBody($body);
1440
1441        return $this->performRequest($endpoint);
1442    }
1443    /**
1444     * Updates certain properties of a datafeed.
1445     *
1446     * $params['datafeed_id']        = (string) The ID of the datafeed to update
1447     * $params['ignore_unavailable'] = (boolean) Ignore unavailable indexes (default: false)
1448     * $params['allow_no_indices']   = (boolean) Ignore if the source indices expressions resolves to no concrete indices (default: true)
1449     * $params['ignore_throttled']   = (boolean) Ignore indices that are marked as throttled (default: true)
1450     * $params['expand_wildcards']   = (enum) Whether source index expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all)
1451     * $params['body']               = (array) The datafeed update settings (Required)
1452     *
1453     * @param array $params Associative array of parameters
1454     * @return array
1455     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html
1456     */
1457    public function updateDatafeed(array $params = [])
1458    {
1459        $datafeed_id = $this->extractArgument($params, 'datafeed_id');
1460        $body = $this->extractArgument($params, 'body');
1461
1462        $endpointBuilder = $this->endpoints;
1463        $endpoint = $endpointBuilder('Ml\UpdateDatafeed');
1464        $endpoint->setParams($params);
1465        $endpoint->setDatafeedId($datafeed_id);
1466        $endpoint->setBody($body);
1467
1468        return $this->performRequest($endpoint);
1469    }
1470    /**
1471     * Updates the description of a filter, adds items, or removes items.
1472     *
1473     * $params['filter_id'] = (string) The ID of the filter to update
1474     * $params['body']      = (array) The filter update (Required)
1475     *
1476     * @param array $params Associative array of parameters
1477     * @return array
1478     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-filter.html
1479     */
1480    public function updateFilter(array $params = [])
1481    {
1482        $filter_id = $this->extractArgument($params, 'filter_id');
1483        $body = $this->extractArgument($params, 'body');
1484
1485        $endpointBuilder = $this->endpoints;
1486        $endpoint = $endpointBuilder('Ml\UpdateFilter');
1487        $endpoint->setParams($params);
1488        $endpoint->setFilterId($filter_id);
1489        $endpoint->setBody($body);
1490
1491        return $this->performRequest($endpoint);
1492    }
1493    /**
1494     * Updates certain properties of an anomaly detection job.
1495     *
1496     * $params['job_id'] = (string) The ID of the job to create
1497     * $params['body']   = (array) The job update settings (Required)
1498     *
1499     * @param array $params Associative array of parameters
1500     * @return array
1501     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-job.html
1502     */
1503    public function updateJob(array $params = [])
1504    {
1505        $job_id = $this->extractArgument($params, 'job_id');
1506        $body = $this->extractArgument($params, 'body');
1507
1508        $endpointBuilder = $this->endpoints;
1509        $endpoint = $endpointBuilder('Ml\UpdateJob');
1510        $endpoint->setParams($params);
1511        $endpoint->setJobId($job_id);
1512        $endpoint->setBody($body);
1513
1514        return $this->performRequest($endpoint);
1515    }
1516    /**
1517     * Updates certain properties of a snapshot.
1518     *
1519     * $params['job_id']      = (string) The ID of the job to fetch
1520     * $params['snapshot_id'] = (string) The ID of the snapshot to update
1521     * $params['body']        = (array) The model snapshot properties to update (Required)
1522     *
1523     * @param array $params Associative array of parameters
1524     * @return array
1525     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-snapshot.html
1526     */
1527    public function updateModelSnapshot(array $params = [])
1528    {
1529        $job_id = $this->extractArgument($params, 'job_id');
1530        $snapshot_id = $this->extractArgument($params, 'snapshot_id');
1531        $body = $this->extractArgument($params, 'body');
1532
1533        $endpointBuilder = $this->endpoints;
1534        $endpoint = $endpointBuilder('Ml\UpdateModelSnapshot');
1535        $endpoint->setParams($params);
1536        $endpoint->setJobId($job_id);
1537        $endpoint->setSnapshotId($snapshot_id);
1538        $endpoint->setBody($body);
1539
1540        return $this->performRequest($endpoint);
1541    }
1542    /**
1543     * Upgrades a given job snapshot to the current major version.
1544     *
1545     * $params['job_id']              = (string) The ID of the job
1546     * $params['snapshot_id']         = (string) The ID of the snapshot
1547     * $params['timeout']             = (time) How long should the API wait for the job to be opened and the old snapshot to be loaded.
1548     * $params['wait_for_completion'] = (boolean) Should the request wait until the task is complete before responding to the caller. Default is false.
1549     *
1550     * @param array $params Associative array of parameters
1551     * @return array
1552     * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-upgrade-job-model-snapshot.html
1553     */
1554    public function upgradeJobSnapshot(array $params = [])
1555    {
1556        $job_id = $this->extractArgument($params, 'job_id');
1557        $snapshot_id = $this->extractArgument($params, 'snapshot_id');
1558
1559        $endpointBuilder = $this->endpoints;
1560        $endpoint = $endpointBuilder('Ml\UpgradeJobSnapshot');
1561        $endpoint->setParams($params);
1562        $endpoint->setJobId($job_id);
1563        $endpoint->setSnapshotId($snapshot_id);
1564
1565        return $this->performRequest($endpoint);
1566    }
1567    /**
1568     * Validates an anomaly detection job.
1569     *
1570     * $params['body'] = (array) The job config (Required)
1571     *
1572     * @param array $params Associative array of parameters
1573     * @return array
1574     * @see https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html
1575     */
1576    public function validate(array $params = [])
1577    {
1578        $body = $this->extractArgument($params, 'body');
1579
1580        $endpointBuilder = $this->endpoints;
1581        $endpoint = $endpointBuilder('Ml\Validate');
1582        $endpoint->setParams($params);
1583        $endpoint->setBody($body);
1584
1585        return $this->performRequest($endpoint);
1586    }
1587    /**
1588     * Validates an anomaly detection detector.
1589     *
1590     * $params['body'] = (array) The detector (Required)
1591     *
1592     * @param array $params Associative array of parameters
1593     * @return array
1594     * @see https://www.elastic.co/guide/en/machine-learning/current/ml-jobs.html
1595     */
1596    public function validateDetector(array $params = [])
1597    {
1598        $body = $this->extractArgument($params, 'body');
1599
1600        $endpointBuilder = $this->endpoints;
1601        $endpoint = $endpointBuilder('Ml\ValidateDetector');
1602        $endpoint->setParams($params);
1603        $endpoint->setBody($body);
1604
1605        return $this->performRequest($endpoint);
1606    }
1607}
1608