elasticsearch 8.11.0__py3-none-any.whl → 8.12.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- elasticsearch/_async/client/__init__.py +493 -347
- elasticsearch/_async/client/async_search.py +108 -72
- elasticsearch/_async/client/autoscaling.py +13 -8
- elasticsearch/_async/client/cat.py +26 -26
- elasticsearch/_async/client/ccr.py +178 -117
- elasticsearch/_async/client/cluster.py +56 -48
- elasticsearch/_async/client/dangling_indices.py +3 -3
- elasticsearch/_async/client/enrich.py +15 -13
- elasticsearch/_async/client/eql.py +53 -36
- elasticsearch/_async/client/esql.py +99 -0
- elasticsearch/_async/client/features.py +2 -2
- elasticsearch/_async/client/fleet.py +111 -71
- elasticsearch/_async/client/graph.py +13 -11
- elasticsearch/_async/client/ilm.py +33 -27
- elasticsearch/_async/client/indices.py +326 -227
- elasticsearch/_async/client/inference.py +212 -0
- elasticsearch/_async/client/ingest.py +28 -24
- elasticsearch/_async/client/license.py +15 -13
- elasticsearch/_async/client/logstash.py +13 -10
- elasticsearch/_async/client/migration.py +3 -3
- elasticsearch/_async/client/ml.py +762 -538
- elasticsearch/_async/client/monitoring.py +10 -5
- elasticsearch/_async/client/nodes.py +13 -11
- elasticsearch/_async/client/query_ruleset.py +12 -10
- elasticsearch/_async/client/rollup.py +59 -46
- elasticsearch/_async/client/search_application.py +23 -16
- elasticsearch/_async/client/searchable_snapshots.py +23 -16
- elasticsearch/_async/client/security.py +393 -287
- elasticsearch/_async/client/shutdown.py +18 -14
- elasticsearch/_async/client/slm.py +23 -21
- elasticsearch/_async/client/snapshot.py +91 -65
- elasticsearch/_async/client/sql.py +81 -58
- elasticsearch/_async/client/ssl.py +1 -1
- elasticsearch/_async/client/synonyms.py +23 -19
- elasticsearch/_async/client/tasks.py +3 -3
- elasticsearch/_async/client/text_structure.py +10 -5
- elasticsearch/_async/client/transform.py +111 -75
- elasticsearch/_async/client/watcher.py +77 -55
- elasticsearch/_async/client/xpack.py +2 -2
- elasticsearch/_async/helpers.py +1 -1
- elasticsearch/_sync/client/__init__.py +493 -347
- elasticsearch/_sync/client/async_search.py +108 -72
- elasticsearch/_sync/client/autoscaling.py +13 -8
- elasticsearch/_sync/client/cat.py +26 -26
- elasticsearch/_sync/client/ccr.py +178 -117
- elasticsearch/_sync/client/cluster.py +56 -48
- elasticsearch/_sync/client/dangling_indices.py +3 -3
- elasticsearch/_sync/client/enrich.py +15 -13
- elasticsearch/_sync/client/eql.py +53 -36
- elasticsearch/_sync/client/esql.py +99 -0
- elasticsearch/_sync/client/features.py +2 -2
- elasticsearch/_sync/client/fleet.py +111 -71
- elasticsearch/_sync/client/graph.py +13 -11
- elasticsearch/_sync/client/ilm.py +33 -27
- elasticsearch/_sync/client/indices.py +326 -227
- elasticsearch/_sync/client/inference.py +212 -0
- elasticsearch/_sync/client/ingest.py +28 -24
- elasticsearch/_sync/client/license.py +15 -13
- elasticsearch/_sync/client/logstash.py +13 -10
- elasticsearch/_sync/client/migration.py +3 -3
- elasticsearch/_sync/client/ml.py +762 -538
- elasticsearch/_sync/client/monitoring.py +10 -5
- elasticsearch/_sync/client/nodes.py +13 -11
- elasticsearch/_sync/client/query_ruleset.py +12 -10
- elasticsearch/_sync/client/rollup.py +59 -46
- elasticsearch/_sync/client/search_application.py +23 -16
- elasticsearch/_sync/client/searchable_snapshots.py +23 -16
- elasticsearch/_sync/client/security.py +393 -287
- elasticsearch/_sync/client/shutdown.py +18 -14
- elasticsearch/_sync/client/slm.py +23 -21
- elasticsearch/_sync/client/snapshot.py +91 -65
- elasticsearch/_sync/client/sql.py +81 -58
- elasticsearch/_sync/client/ssl.py +1 -1
- elasticsearch/_sync/client/synonyms.py +23 -19
- elasticsearch/_sync/client/tasks.py +3 -3
- elasticsearch/_sync/client/text_structure.py +10 -5
- elasticsearch/_sync/client/transform.py +111 -75
- elasticsearch/_sync/client/utils.py +34 -10
- elasticsearch/_sync/client/watcher.py +77 -55
- elasticsearch/_sync/client/xpack.py +2 -2
- elasticsearch/_version.py +1 -1
- elasticsearch/client.py +2 -0
- elasticsearch/helpers/actions.py +1 -1
- {elasticsearch-8.11.0.dist-info → elasticsearch-8.12.0.dist-info}/METADATA +7 -4
- elasticsearch-8.12.0.dist-info/RECORD +103 -0
- {elasticsearch-8.11.0.dist-info → elasticsearch-8.12.0.dist-info}/WHEEL +1 -1
- elasticsearch-8.11.0.dist-info/RECORD +0 -99
- {elasticsearch-8.11.0.dist-info → elasticsearch-8.12.0.dist-info}/LICENSE +0 -0
- {elasticsearch-8.11.0.dist-info → elasticsearch-8.12.0.dist-info}/NOTICE +0 -0
- {elasticsearch-8.11.0.dist-info → elasticsearch-8.12.0.dist-info}/top_level.txt +0 -0
|
@@ -37,7 +37,7 @@ class MlClient(NamespacedClient):
|
|
|
37
37
|
"""
|
|
38
38
|
Clear the cached results from a trained model deployment
|
|
39
39
|
|
|
40
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
40
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/clear-trained-model-deployment-cache.html>`_
|
|
41
41
|
|
|
42
42
|
:param model_id: The unique identifier of the trained model.
|
|
43
43
|
"""
|
|
@@ -59,7 +59,7 @@ class MlClient(NamespacedClient):
|
|
|
59
59
|
)
|
|
60
60
|
|
|
61
61
|
@_rewrite_parameters(
|
|
62
|
-
body_fields=
|
|
62
|
+
body_fields=("allow_no_match", "force", "timeout"),
|
|
63
63
|
)
|
|
64
64
|
async def close_job(
|
|
65
65
|
self,
|
|
@@ -72,12 +72,13 @@ class MlClient(NamespacedClient):
|
|
|
72
72
|
human: t.Optional[bool] = None,
|
|
73
73
|
pretty: t.Optional[bool] = None,
|
|
74
74
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
75
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
75
76
|
) -> ObjectApiResponse[t.Any]:
|
|
76
77
|
"""
|
|
77
78
|
Closes one or more anomaly detection jobs. A job can be opened and closed multiple
|
|
78
79
|
times throughout its lifecycle.
|
|
79
80
|
|
|
80
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
81
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-close-job.html>`_
|
|
81
82
|
|
|
82
83
|
:param job_id: Identifier for the anomaly detection job. It can be a job identifier,
|
|
83
84
|
a group name, or a wildcard expression. You can close multiple anomaly detection
|
|
@@ -92,22 +93,23 @@ class MlClient(NamespacedClient):
|
|
|
92
93
|
if job_id in SKIP_IN_PATH:
|
|
93
94
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
94
95
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_close"
|
|
95
|
-
__body: t.Dict[str, t.Any] = {}
|
|
96
96
|
__query: t.Dict[str, t.Any] = {}
|
|
97
|
-
if
|
|
98
|
-
__body["allow_no_match"] = allow_no_match
|
|
97
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
99
98
|
if error_trace is not None:
|
|
100
99
|
__query["error_trace"] = error_trace
|
|
101
100
|
if filter_path is not None:
|
|
102
101
|
__query["filter_path"] = filter_path
|
|
103
|
-
if force is not None:
|
|
104
|
-
__body["force"] = force
|
|
105
102
|
if human is not None:
|
|
106
103
|
__query["human"] = human
|
|
107
104
|
if pretty is not None:
|
|
108
105
|
__query["pretty"] = pretty
|
|
109
|
-
if
|
|
110
|
-
|
|
106
|
+
if not __body:
|
|
107
|
+
if allow_no_match is not None:
|
|
108
|
+
__body["allow_no_match"] = allow_no_match
|
|
109
|
+
if force is not None:
|
|
110
|
+
__body["force"] = force
|
|
111
|
+
if timeout is not None:
|
|
112
|
+
__body["timeout"] = timeout
|
|
111
113
|
if not __body:
|
|
112
114
|
__body = None # type: ignore[assignment]
|
|
113
115
|
__headers = {"accept": "application/json"}
|
|
@@ -130,7 +132,7 @@ class MlClient(NamespacedClient):
|
|
|
130
132
|
"""
|
|
131
133
|
Deletes a calendar.
|
|
132
134
|
|
|
133
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
135
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-calendar.html>`_
|
|
134
136
|
|
|
135
137
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
136
138
|
"""
|
|
@@ -165,7 +167,7 @@ class MlClient(NamespacedClient):
|
|
|
165
167
|
"""
|
|
166
168
|
Deletes scheduled events from a calendar.
|
|
167
169
|
|
|
168
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
170
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-calendar-event.html>`_
|
|
169
171
|
|
|
170
172
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
171
173
|
:param event_id: Identifier for the scheduled event. You can obtain this identifier
|
|
@@ -204,7 +206,7 @@ class MlClient(NamespacedClient):
|
|
|
204
206
|
"""
|
|
205
207
|
Deletes anomaly detection jobs from a calendar.
|
|
206
208
|
|
|
207
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
209
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-calendar-job.html>`_
|
|
208
210
|
|
|
209
211
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
210
212
|
:param job_id: An identifier for the anomaly detection jobs. It can be a job
|
|
@@ -244,7 +246,7 @@ class MlClient(NamespacedClient):
|
|
|
244
246
|
"""
|
|
245
247
|
Deletes an existing data frame analytics job.
|
|
246
248
|
|
|
247
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
249
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-dfanalytics.html>`_
|
|
248
250
|
|
|
249
251
|
:param id: Identifier for the data frame analytics job.
|
|
250
252
|
:param force: If `true`, it deletes a job that is not stopped; this method is
|
|
@@ -286,7 +288,7 @@ class MlClient(NamespacedClient):
|
|
|
286
288
|
"""
|
|
287
289
|
Deletes an existing datafeed.
|
|
288
290
|
|
|
289
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
291
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-datafeed.html>`_
|
|
290
292
|
|
|
291
293
|
:param datafeed_id: A numerical character string that uniquely identifies the
|
|
292
294
|
datafeed. This identifier can contain lowercase alphanumeric characters (a-z
|
|
@@ -315,7 +317,7 @@ class MlClient(NamespacedClient):
|
|
|
315
317
|
)
|
|
316
318
|
|
|
317
319
|
@_rewrite_parameters(
|
|
318
|
-
body_fields=
|
|
320
|
+
body_fields=("requests_per_second", "timeout"),
|
|
319
321
|
)
|
|
320
322
|
async def delete_expired_data(
|
|
321
323
|
self,
|
|
@@ -327,11 +329,12 @@ class MlClient(NamespacedClient):
|
|
|
327
329
|
pretty: t.Optional[bool] = None,
|
|
328
330
|
requests_per_second: t.Optional[float] = None,
|
|
329
331
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
332
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
330
333
|
) -> ObjectApiResponse[t.Any]:
|
|
331
334
|
"""
|
|
332
335
|
Deletes expired and unused machine learning data.
|
|
333
336
|
|
|
334
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
337
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-expired-data.html>`_
|
|
335
338
|
|
|
336
339
|
:param job_id: Identifier for an anomaly detection job. It can be a job identifier,
|
|
337
340
|
a group name, or a wildcard expression.
|
|
@@ -345,7 +348,7 @@ class MlClient(NamespacedClient):
|
|
|
345
348
|
else:
|
|
346
349
|
__path = "/_ml/_delete_expired_data"
|
|
347
350
|
__query: t.Dict[str, t.Any] = {}
|
|
348
|
-
__body: t.Dict[str, t.Any] = {}
|
|
351
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
349
352
|
if error_trace is not None:
|
|
350
353
|
__query["error_trace"] = error_trace
|
|
351
354
|
if filter_path is not None:
|
|
@@ -354,10 +357,11 @@ class MlClient(NamespacedClient):
|
|
|
354
357
|
__query["human"] = human
|
|
355
358
|
if pretty is not None:
|
|
356
359
|
__query["pretty"] = pretty
|
|
357
|
-
if
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
360
|
+
if not __body:
|
|
361
|
+
if requests_per_second is not None:
|
|
362
|
+
__body["requests_per_second"] = requests_per_second
|
|
363
|
+
if timeout is not None:
|
|
364
|
+
__body["timeout"] = timeout
|
|
361
365
|
if not __body:
|
|
362
366
|
__body = None # type: ignore[assignment]
|
|
363
367
|
__headers = {"accept": "application/json"}
|
|
@@ -380,7 +384,7 @@ class MlClient(NamespacedClient):
|
|
|
380
384
|
"""
|
|
381
385
|
Deletes a filter.
|
|
382
386
|
|
|
383
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
387
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-filter.html>`_
|
|
384
388
|
|
|
385
389
|
:param filter_id: A string that uniquely identifies a filter.
|
|
386
390
|
"""
|
|
@@ -417,7 +421,7 @@ class MlClient(NamespacedClient):
|
|
|
417
421
|
"""
|
|
418
422
|
Deletes forecasts from a machine learning job.
|
|
419
423
|
|
|
420
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
424
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-forecast.html>`_
|
|
421
425
|
|
|
422
426
|
:param job_id: Identifier for the anomaly detection job.
|
|
423
427
|
:param forecast_id: A comma-separated list of forecast identifiers. If you do
|
|
@@ -473,7 +477,7 @@ class MlClient(NamespacedClient):
|
|
|
473
477
|
"""
|
|
474
478
|
Deletes an existing anomaly detection job.
|
|
475
479
|
|
|
476
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
480
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-job.html>`_
|
|
477
481
|
|
|
478
482
|
:param job_id: Identifier for the anomaly detection job.
|
|
479
483
|
:param delete_user_annotations: Specifies whether annotations that have been
|
|
@@ -521,7 +525,7 @@ class MlClient(NamespacedClient):
|
|
|
521
525
|
"""
|
|
522
526
|
Deletes an existing model snapshot.
|
|
523
527
|
|
|
524
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
528
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-delete-snapshot.html>`_
|
|
525
529
|
|
|
526
530
|
:param job_id: Identifier for the anomaly detection job.
|
|
527
531
|
:param snapshot_id: Identifier for the model snapshot.
|
|
@@ -560,7 +564,7 @@ class MlClient(NamespacedClient):
|
|
|
560
564
|
Deletes an existing trained inference model that is currently not referenced
|
|
561
565
|
by an ingest pipeline.
|
|
562
566
|
|
|
563
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
567
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-trained-models.html>`_
|
|
564
568
|
|
|
565
569
|
:param model_id: The unique identifier of the trained model.
|
|
566
570
|
:param force: Forcefully deletes a trained model that is referenced by ingest
|
|
@@ -599,7 +603,7 @@ class MlClient(NamespacedClient):
|
|
|
599
603
|
"""
|
|
600
604
|
Deletes a model alias that refers to the trained model
|
|
601
605
|
|
|
602
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
606
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-trained-models-aliases.html>`_
|
|
603
607
|
|
|
604
608
|
:param model_id: The trained model ID to which the model alias refers.
|
|
605
609
|
:param model_alias: The model alias to delete.
|
|
@@ -624,7 +628,11 @@ class MlClient(NamespacedClient):
|
|
|
624
628
|
)
|
|
625
629
|
|
|
626
630
|
@_rewrite_parameters(
|
|
627
|
-
body_fields=
|
|
631
|
+
body_fields=(
|
|
632
|
+
"analysis_config",
|
|
633
|
+
"max_bucket_cardinality",
|
|
634
|
+
"overall_cardinality",
|
|
635
|
+
),
|
|
628
636
|
)
|
|
629
637
|
async def estimate_model_memory(
|
|
630
638
|
self,
|
|
@@ -636,11 +644,12 @@ class MlClient(NamespacedClient):
|
|
|
636
644
|
max_bucket_cardinality: t.Optional[t.Mapping[str, int]] = None,
|
|
637
645
|
overall_cardinality: t.Optional[t.Mapping[str, int]] = None,
|
|
638
646
|
pretty: t.Optional[bool] = None,
|
|
647
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
639
648
|
) -> ObjectApiResponse[t.Any]:
|
|
640
649
|
"""
|
|
641
650
|
Estimates the model memory
|
|
642
651
|
|
|
643
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
652
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-apis.html>`_
|
|
644
653
|
|
|
645
654
|
:param analysis_config: For a list of the properties that you can specify in
|
|
646
655
|
the `analysis_config` component of the body of this API.
|
|
@@ -658,62 +667,60 @@ class MlClient(NamespacedClient):
|
|
|
658
667
|
or `partition_field_name`.
|
|
659
668
|
"""
|
|
660
669
|
__path = "/_ml/anomaly_detectors/_estimate_model_memory"
|
|
661
|
-
__body: t.Dict[str, t.Any] = {}
|
|
662
670
|
__query: t.Dict[str, t.Any] = {}
|
|
663
|
-
if
|
|
664
|
-
__body["analysis_config"] = analysis_config
|
|
671
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
665
672
|
if error_trace is not None:
|
|
666
673
|
__query["error_trace"] = error_trace
|
|
667
674
|
if filter_path is not None:
|
|
668
675
|
__query["filter_path"] = filter_path
|
|
669
676
|
if human is not None:
|
|
670
677
|
__query["human"] = human
|
|
671
|
-
if max_bucket_cardinality is not None:
|
|
672
|
-
__body["max_bucket_cardinality"] = max_bucket_cardinality
|
|
673
|
-
if overall_cardinality is not None:
|
|
674
|
-
__body["overall_cardinality"] = overall_cardinality
|
|
675
678
|
if pretty is not None:
|
|
676
679
|
__query["pretty"] = pretty
|
|
680
|
+
if not __body:
|
|
681
|
+
if analysis_config is not None:
|
|
682
|
+
__body["analysis_config"] = analysis_config
|
|
683
|
+
if max_bucket_cardinality is not None:
|
|
684
|
+
__body["max_bucket_cardinality"] = max_bucket_cardinality
|
|
685
|
+
if overall_cardinality is not None:
|
|
686
|
+
__body["overall_cardinality"] = overall_cardinality
|
|
677
687
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
678
688
|
return await self.perform_request( # type: ignore[return-value]
|
|
679
689
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
680
690
|
)
|
|
681
691
|
|
|
682
692
|
@_rewrite_parameters(
|
|
683
|
-
body_fields=
|
|
693
|
+
body_fields=("evaluation", "index", "query"),
|
|
684
694
|
)
|
|
685
695
|
async def evaluate_data_frame(
|
|
686
696
|
self,
|
|
687
697
|
*,
|
|
688
|
-
evaluation: t.Mapping[str, t.Any],
|
|
689
|
-
index: str,
|
|
698
|
+
evaluation: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
699
|
+
index: t.Optional[str] = None,
|
|
690
700
|
error_trace: t.Optional[bool] = None,
|
|
691
701
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
692
702
|
human: t.Optional[bool] = None,
|
|
693
703
|
pretty: t.Optional[bool] = None,
|
|
694
704
|
query: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
705
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
695
706
|
) -> ObjectApiResponse[t.Any]:
|
|
696
707
|
"""
|
|
697
708
|
Evaluates the data frame analytics for an annotated index.
|
|
698
709
|
|
|
699
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
710
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/evaluate-dfanalytics.html>`_
|
|
700
711
|
|
|
701
712
|
:param evaluation: Defines the type of evaluation you want to perform.
|
|
702
713
|
:param index: Defines the `index` in which the evaluation will be performed.
|
|
703
714
|
:param query: A query clause that retrieves a subset of data from the source
|
|
704
715
|
index.
|
|
705
716
|
"""
|
|
706
|
-
if evaluation is None:
|
|
717
|
+
if evaluation is None and body is None:
|
|
707
718
|
raise ValueError("Empty value passed for parameter 'evaluation'")
|
|
708
|
-
if index is None:
|
|
719
|
+
if index is None and body is None:
|
|
709
720
|
raise ValueError("Empty value passed for parameter 'index'")
|
|
710
721
|
__path = "/_ml/data_frame/_evaluate"
|
|
711
|
-
__body: t.Dict[str, t.Any] = {}
|
|
712
722
|
__query: t.Dict[str, t.Any] = {}
|
|
713
|
-
if
|
|
714
|
-
__body["evaluation"] = evaluation
|
|
715
|
-
if index is not None:
|
|
716
|
-
__body["index"] = index
|
|
723
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
717
724
|
if error_trace is not None:
|
|
718
725
|
__query["error_trace"] = error_trace
|
|
719
726
|
if filter_path is not None:
|
|
@@ -722,15 +729,29 @@ class MlClient(NamespacedClient):
|
|
|
722
729
|
__query["human"] = human
|
|
723
730
|
if pretty is not None:
|
|
724
731
|
__query["pretty"] = pretty
|
|
725
|
-
if
|
|
726
|
-
|
|
732
|
+
if not __body:
|
|
733
|
+
if evaluation is not None:
|
|
734
|
+
__body["evaluation"] = evaluation
|
|
735
|
+
if index is not None:
|
|
736
|
+
__body["index"] = index
|
|
737
|
+
if query is not None:
|
|
738
|
+
__body["query"] = query
|
|
727
739
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
728
740
|
return await self.perform_request( # type: ignore[return-value]
|
|
729
741
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
730
742
|
)
|
|
731
743
|
|
|
732
744
|
@_rewrite_parameters(
|
|
733
|
-
body_fields=
|
|
745
|
+
body_fields=(
|
|
746
|
+
"allow_lazy_start",
|
|
747
|
+
"analysis",
|
|
748
|
+
"analyzed_fields",
|
|
749
|
+
"description",
|
|
750
|
+
"dest",
|
|
751
|
+
"max_num_threads",
|
|
752
|
+
"model_memory_limit",
|
|
753
|
+
"source",
|
|
754
|
+
),
|
|
734
755
|
)
|
|
735
756
|
async def explain_data_frame_analytics(
|
|
736
757
|
self,
|
|
@@ -748,11 +769,12 @@ class MlClient(NamespacedClient):
|
|
|
748
769
|
model_memory_limit: t.Optional[str] = None,
|
|
749
770
|
pretty: t.Optional[bool] = None,
|
|
750
771
|
source: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
772
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
751
773
|
) -> ObjectApiResponse[t.Any]:
|
|
752
774
|
"""
|
|
753
775
|
Explains a data frame analytics config.
|
|
754
776
|
|
|
755
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
777
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/explain-dfanalytics.html>`_
|
|
756
778
|
|
|
757
779
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
758
780
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -786,32 +808,33 @@ class MlClient(NamespacedClient):
|
|
|
786
808
|
__path = f"/_ml/data_frame/analytics/{_quote(id)}/_explain"
|
|
787
809
|
else:
|
|
788
810
|
__path = "/_ml/data_frame/analytics/_explain"
|
|
789
|
-
__body: t.Dict[str, t.Any] = {}
|
|
790
811
|
__query: t.Dict[str, t.Any] = {}
|
|
791
|
-
if
|
|
792
|
-
__body["allow_lazy_start"] = allow_lazy_start
|
|
793
|
-
if analysis is not None:
|
|
794
|
-
__body["analysis"] = analysis
|
|
795
|
-
if analyzed_fields is not None:
|
|
796
|
-
__body["analyzed_fields"] = analyzed_fields
|
|
797
|
-
if description is not None:
|
|
798
|
-
__body["description"] = description
|
|
799
|
-
if dest is not None:
|
|
800
|
-
__body["dest"] = dest
|
|
812
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
801
813
|
if error_trace is not None:
|
|
802
814
|
__query["error_trace"] = error_trace
|
|
803
815
|
if filter_path is not None:
|
|
804
816
|
__query["filter_path"] = filter_path
|
|
805
817
|
if human is not None:
|
|
806
818
|
__query["human"] = human
|
|
807
|
-
if max_num_threads is not None:
|
|
808
|
-
__body["max_num_threads"] = max_num_threads
|
|
809
|
-
if model_memory_limit is not None:
|
|
810
|
-
__body["model_memory_limit"] = model_memory_limit
|
|
811
819
|
if pretty is not None:
|
|
812
820
|
__query["pretty"] = pretty
|
|
813
|
-
if
|
|
814
|
-
|
|
821
|
+
if not __body:
|
|
822
|
+
if allow_lazy_start is not None:
|
|
823
|
+
__body["allow_lazy_start"] = allow_lazy_start
|
|
824
|
+
if analysis is not None:
|
|
825
|
+
__body["analysis"] = analysis
|
|
826
|
+
if analyzed_fields is not None:
|
|
827
|
+
__body["analyzed_fields"] = analyzed_fields
|
|
828
|
+
if description is not None:
|
|
829
|
+
__body["description"] = description
|
|
830
|
+
if dest is not None:
|
|
831
|
+
__body["dest"] = dest
|
|
832
|
+
if max_num_threads is not None:
|
|
833
|
+
__body["max_num_threads"] = max_num_threads
|
|
834
|
+
if model_memory_limit is not None:
|
|
835
|
+
__body["model_memory_limit"] = model_memory_limit
|
|
836
|
+
if source is not None:
|
|
837
|
+
__body["source"] = source
|
|
815
838
|
if not __body:
|
|
816
839
|
__body = None # type: ignore[assignment]
|
|
817
840
|
__headers = {"accept": "application/json"}
|
|
@@ -822,7 +845,7 @@ class MlClient(NamespacedClient):
|
|
|
822
845
|
)
|
|
823
846
|
|
|
824
847
|
@_rewrite_parameters(
|
|
825
|
-
body_fields=
|
|
848
|
+
body_fields=("advance_time", "calc_interim", "end", "skip_time", "start"),
|
|
826
849
|
)
|
|
827
850
|
async def flush_job(
|
|
828
851
|
self,
|
|
@@ -837,11 +860,12 @@ class MlClient(NamespacedClient):
|
|
|
837
860
|
pretty: t.Optional[bool] = None,
|
|
838
861
|
skip_time: t.Optional[t.Union[str, t.Any]] = None,
|
|
839
862
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
863
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
840
864
|
) -> ObjectApiResponse[t.Any]:
|
|
841
865
|
"""
|
|
842
866
|
Forces any buffered data to be processed by the job.
|
|
843
867
|
|
|
844
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
868
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-flush-job.html>`_
|
|
845
869
|
|
|
846
870
|
:param job_id: Identifier for the anomaly detection job.
|
|
847
871
|
:param advance_time: Refer to the description for the `advance_time` query parameter.
|
|
@@ -853,14 +877,8 @@ class MlClient(NamespacedClient):
|
|
|
853
877
|
if job_id in SKIP_IN_PATH:
|
|
854
878
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
855
879
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_flush"
|
|
856
|
-
__body: t.Dict[str, t.Any] = {}
|
|
857
880
|
__query: t.Dict[str, t.Any] = {}
|
|
858
|
-
if
|
|
859
|
-
__body["advance_time"] = advance_time
|
|
860
|
-
if calc_interim is not None:
|
|
861
|
-
__body["calc_interim"] = calc_interim
|
|
862
|
-
if end is not None:
|
|
863
|
-
__body["end"] = end
|
|
881
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
864
882
|
if error_trace is not None:
|
|
865
883
|
__query["error_trace"] = error_trace
|
|
866
884
|
if filter_path is not None:
|
|
@@ -869,10 +887,17 @@ class MlClient(NamespacedClient):
|
|
|
869
887
|
__query["human"] = human
|
|
870
888
|
if pretty is not None:
|
|
871
889
|
__query["pretty"] = pretty
|
|
872
|
-
if
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
890
|
+
if not __body:
|
|
891
|
+
if advance_time is not None:
|
|
892
|
+
__body["advance_time"] = advance_time
|
|
893
|
+
if calc_interim is not None:
|
|
894
|
+
__body["calc_interim"] = calc_interim
|
|
895
|
+
if end is not None:
|
|
896
|
+
__body["end"] = end
|
|
897
|
+
if skip_time is not None:
|
|
898
|
+
__body["skip_time"] = skip_time
|
|
899
|
+
if start is not None:
|
|
900
|
+
__body["start"] = start
|
|
876
901
|
if not __body:
|
|
877
902
|
__body = None # type: ignore[assignment]
|
|
878
903
|
__headers = {"accept": "application/json"}
|
|
@@ -883,7 +908,7 @@ class MlClient(NamespacedClient):
|
|
|
883
908
|
)
|
|
884
909
|
|
|
885
910
|
@_rewrite_parameters(
|
|
886
|
-
body_fields=
|
|
911
|
+
body_fields=("duration", "expires_in", "max_model_memory"),
|
|
887
912
|
)
|
|
888
913
|
async def forecast(
|
|
889
914
|
self,
|
|
@@ -896,11 +921,12 @@ class MlClient(NamespacedClient):
|
|
|
896
921
|
human: t.Optional[bool] = None,
|
|
897
922
|
max_model_memory: t.Optional[str] = None,
|
|
898
923
|
pretty: t.Optional[bool] = None,
|
|
924
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
899
925
|
) -> ObjectApiResponse[t.Any]:
|
|
900
926
|
"""
|
|
901
927
|
Predicts the future behavior of a time series by using its historical behavior.
|
|
902
928
|
|
|
903
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
929
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-forecast.html>`_
|
|
904
930
|
|
|
905
931
|
:param job_id: Identifier for the anomaly detection job. The job must be open
|
|
906
932
|
when you create a forecast; otherwise, an error occurs.
|
|
@@ -912,22 +938,23 @@ class MlClient(NamespacedClient):
|
|
|
912
938
|
if job_id in SKIP_IN_PATH:
|
|
913
939
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
914
940
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_forecast"
|
|
915
|
-
__body: t.Dict[str, t.Any] = {}
|
|
916
941
|
__query: t.Dict[str, t.Any] = {}
|
|
917
|
-
if
|
|
918
|
-
__body["duration"] = duration
|
|
942
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
919
943
|
if error_trace is not None:
|
|
920
944
|
__query["error_trace"] = error_trace
|
|
921
|
-
if expires_in is not None:
|
|
922
|
-
__body["expires_in"] = expires_in
|
|
923
945
|
if filter_path is not None:
|
|
924
946
|
__query["filter_path"] = filter_path
|
|
925
947
|
if human is not None:
|
|
926
948
|
__query["human"] = human
|
|
927
|
-
if max_model_memory is not None:
|
|
928
|
-
__body["max_model_memory"] = max_model_memory
|
|
929
949
|
if pretty is not None:
|
|
930
950
|
__query["pretty"] = pretty
|
|
951
|
+
if not __body:
|
|
952
|
+
if duration is not None:
|
|
953
|
+
__body["duration"] = duration
|
|
954
|
+
if expires_in is not None:
|
|
955
|
+
__body["expires_in"] = expires_in
|
|
956
|
+
if max_model_memory is not None:
|
|
957
|
+
__body["max_model_memory"] = max_model_memory
|
|
931
958
|
if not __body:
|
|
932
959
|
__body = None # type: ignore[assignment]
|
|
933
960
|
__headers = {"accept": "application/json"}
|
|
@@ -938,7 +965,16 @@ class MlClient(NamespacedClient):
|
|
|
938
965
|
)
|
|
939
966
|
|
|
940
967
|
@_rewrite_parameters(
|
|
941
|
-
body_fields=
|
|
968
|
+
body_fields=(
|
|
969
|
+
"anomaly_score",
|
|
970
|
+
"desc",
|
|
971
|
+
"end",
|
|
972
|
+
"exclude_interim",
|
|
973
|
+
"expand",
|
|
974
|
+
"page",
|
|
975
|
+
"sort",
|
|
976
|
+
"start",
|
|
977
|
+
),
|
|
942
978
|
parameter_aliases={"from": "from_"},
|
|
943
979
|
)
|
|
944
980
|
async def get_buckets(
|
|
@@ -960,11 +996,12 @@ class MlClient(NamespacedClient):
|
|
|
960
996
|
size: t.Optional[int] = None,
|
|
961
997
|
sort: t.Optional[str] = None,
|
|
962
998
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
999
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
963
1000
|
) -> ObjectApiResponse[t.Any]:
|
|
964
1001
|
"""
|
|
965
1002
|
Retrieves anomaly detection job results for one or more buckets.
|
|
966
1003
|
|
|
967
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1004
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-bucket.html>`_
|
|
968
1005
|
|
|
969
1006
|
:param job_id: Identifier for the anomaly detection job.
|
|
970
1007
|
:param timestamp: The timestamp of a single bucket result. If you do not specify
|
|
@@ -990,36 +1027,37 @@ class MlClient(NamespacedClient):
|
|
|
990
1027
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/buckets"
|
|
991
1028
|
else:
|
|
992
1029
|
raise ValueError("Couldn't find a path for the given parameters")
|
|
993
|
-
__body: t.Dict[str, t.Any] = {}
|
|
994
1030
|
__query: t.Dict[str, t.Any] = {}
|
|
995
|
-
if
|
|
996
|
-
__body["anomaly_score"] = anomaly_score
|
|
997
|
-
if desc is not None:
|
|
998
|
-
__body["desc"] = desc
|
|
999
|
-
if end is not None:
|
|
1000
|
-
__body["end"] = end
|
|
1031
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1001
1032
|
if error_trace is not None:
|
|
1002
1033
|
__query["error_trace"] = error_trace
|
|
1003
|
-
if exclude_interim is not None:
|
|
1004
|
-
__body["exclude_interim"] = exclude_interim
|
|
1005
|
-
if expand is not None:
|
|
1006
|
-
__body["expand"] = expand
|
|
1007
1034
|
if filter_path is not None:
|
|
1008
1035
|
__query["filter_path"] = filter_path
|
|
1009
1036
|
if from_ is not None:
|
|
1010
1037
|
__query["from"] = from_
|
|
1011
1038
|
if human is not None:
|
|
1012
1039
|
__query["human"] = human
|
|
1013
|
-
if page is not None:
|
|
1014
|
-
__body["page"] = page
|
|
1015
1040
|
if pretty is not None:
|
|
1016
1041
|
__query["pretty"] = pretty
|
|
1017
1042
|
if size is not None:
|
|
1018
1043
|
__query["size"] = size
|
|
1019
|
-
if
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1044
|
+
if not __body:
|
|
1045
|
+
if anomaly_score is not None:
|
|
1046
|
+
__body["anomaly_score"] = anomaly_score
|
|
1047
|
+
if desc is not None:
|
|
1048
|
+
__body["desc"] = desc
|
|
1049
|
+
if end is not None:
|
|
1050
|
+
__body["end"] = end
|
|
1051
|
+
if exclude_interim is not None:
|
|
1052
|
+
__body["exclude_interim"] = exclude_interim
|
|
1053
|
+
if expand is not None:
|
|
1054
|
+
__body["expand"] = expand
|
|
1055
|
+
if page is not None:
|
|
1056
|
+
__body["page"] = page
|
|
1057
|
+
if sort is not None:
|
|
1058
|
+
__body["sort"] = sort
|
|
1059
|
+
if start is not None:
|
|
1060
|
+
__body["start"] = start
|
|
1023
1061
|
if not __body:
|
|
1024
1062
|
__body = None # type: ignore[assignment]
|
|
1025
1063
|
__headers = {"accept": "application/json"}
|
|
@@ -1049,7 +1087,7 @@ class MlClient(NamespacedClient):
|
|
|
1049
1087
|
"""
|
|
1050
1088
|
Retrieves information about the scheduled events in calendars.
|
|
1051
1089
|
|
|
1052
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1090
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-calendar-event.html>`_
|
|
1053
1091
|
|
|
1054
1092
|
:param calendar_id: A string that uniquely identifies a calendar. You can get
|
|
1055
1093
|
information for multiple calendars by using a comma-separated list of ids
|
|
@@ -1090,7 +1128,7 @@ class MlClient(NamespacedClient):
|
|
|
1090
1128
|
)
|
|
1091
1129
|
|
|
1092
1130
|
@_rewrite_parameters(
|
|
1093
|
-
body_fields=
|
|
1131
|
+
body_fields=("page",),
|
|
1094
1132
|
parameter_aliases={"from": "from_"},
|
|
1095
1133
|
)
|
|
1096
1134
|
async def get_calendars(
|
|
@@ -1104,11 +1142,12 @@ class MlClient(NamespacedClient):
|
|
|
1104
1142
|
page: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
1105
1143
|
pretty: t.Optional[bool] = None,
|
|
1106
1144
|
size: t.Optional[int] = None,
|
|
1145
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1107
1146
|
) -> ObjectApiResponse[t.Any]:
|
|
1108
1147
|
"""
|
|
1109
1148
|
Retrieves configuration information for calendars.
|
|
1110
1149
|
|
|
1111
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1150
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-calendar.html>`_
|
|
1112
1151
|
|
|
1113
1152
|
:param calendar_id: A string that uniquely identifies a calendar. You can get
|
|
1114
1153
|
information for multiple calendars by using a comma-separated list of ids
|
|
@@ -1125,7 +1164,7 @@ class MlClient(NamespacedClient):
|
|
|
1125
1164
|
else:
|
|
1126
1165
|
__path = "/_ml/calendars"
|
|
1127
1166
|
__query: t.Dict[str, t.Any] = {}
|
|
1128
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1167
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1129
1168
|
if error_trace is not None:
|
|
1130
1169
|
__query["error_trace"] = error_trace
|
|
1131
1170
|
if filter_path is not None:
|
|
@@ -1134,12 +1173,13 @@ class MlClient(NamespacedClient):
|
|
|
1134
1173
|
__query["from"] = from_
|
|
1135
1174
|
if human is not None:
|
|
1136
1175
|
__query["human"] = human
|
|
1137
|
-
if page is not None:
|
|
1138
|
-
__body["page"] = page
|
|
1139
1176
|
if pretty is not None:
|
|
1140
1177
|
__query["pretty"] = pretty
|
|
1141
1178
|
if size is not None:
|
|
1142
1179
|
__query["size"] = size
|
|
1180
|
+
if not __body:
|
|
1181
|
+
if page is not None:
|
|
1182
|
+
__body["page"] = page
|
|
1143
1183
|
if not __body:
|
|
1144
1184
|
__body = None # type: ignore[assignment]
|
|
1145
1185
|
__headers = {"accept": "application/json"}
|
|
@@ -1150,7 +1190,7 @@ class MlClient(NamespacedClient):
|
|
|
1150
1190
|
)
|
|
1151
1191
|
|
|
1152
1192
|
@_rewrite_parameters(
|
|
1153
|
-
body_fields=
|
|
1193
|
+
body_fields=("page",),
|
|
1154
1194
|
parameter_aliases={"from": "from_"},
|
|
1155
1195
|
)
|
|
1156
1196
|
async def get_categories(
|
|
@@ -1166,11 +1206,12 @@ class MlClient(NamespacedClient):
|
|
|
1166
1206
|
partition_field_value: t.Optional[str] = None,
|
|
1167
1207
|
pretty: t.Optional[bool] = None,
|
|
1168
1208
|
size: t.Optional[int] = None,
|
|
1209
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1169
1210
|
) -> ObjectApiResponse[t.Any]:
|
|
1170
1211
|
"""
|
|
1171
1212
|
Retrieves anomaly detection job results for one or more categories.
|
|
1172
1213
|
|
|
1173
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1214
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-category.html>`_
|
|
1174
1215
|
|
|
1175
1216
|
:param job_id: Identifier for the anomaly detection job.
|
|
1176
1217
|
:param category_id: Identifier for the category, which is unique in the job.
|
|
@@ -1192,7 +1233,7 @@ class MlClient(NamespacedClient):
|
|
|
1192
1233
|
else:
|
|
1193
1234
|
raise ValueError("Couldn't find a path for the given parameters")
|
|
1194
1235
|
__query: t.Dict[str, t.Any] = {}
|
|
1195
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1236
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1196
1237
|
if error_trace is not None:
|
|
1197
1238
|
__query["error_trace"] = error_trace
|
|
1198
1239
|
if filter_path is not None:
|
|
@@ -1201,14 +1242,15 @@ class MlClient(NamespacedClient):
|
|
|
1201
1242
|
__query["from"] = from_
|
|
1202
1243
|
if human is not None:
|
|
1203
1244
|
__query["human"] = human
|
|
1204
|
-
if page is not None:
|
|
1205
|
-
__body["page"] = page
|
|
1206
1245
|
if partition_field_value is not None:
|
|
1207
1246
|
__query["partition_field_value"] = partition_field_value
|
|
1208
1247
|
if pretty is not None:
|
|
1209
1248
|
__query["pretty"] = pretty
|
|
1210
1249
|
if size is not None:
|
|
1211
1250
|
__query["size"] = size
|
|
1251
|
+
if not __body:
|
|
1252
|
+
if page is not None:
|
|
1253
|
+
__body["page"] = page
|
|
1212
1254
|
if not __body:
|
|
1213
1255
|
__body = None # type: ignore[assignment]
|
|
1214
1256
|
__headers = {"accept": "application/json"}
|
|
@@ -1237,7 +1279,7 @@ class MlClient(NamespacedClient):
|
|
|
1237
1279
|
"""
|
|
1238
1280
|
Retrieves configuration information for data frame analytics jobs.
|
|
1239
1281
|
|
|
1240
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1282
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-dfanalytics.html>`_
|
|
1241
1283
|
|
|
1242
1284
|
:param id: Identifier for the data frame analytics job. If you do not specify
|
|
1243
1285
|
this option, the API returns information for the first hundred data frame
|
|
@@ -1301,7 +1343,7 @@ class MlClient(NamespacedClient):
|
|
|
1301
1343
|
"""
|
|
1302
1344
|
Retrieves usage information for data frame analytics jobs.
|
|
1303
1345
|
|
|
1304
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1346
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-dfanalytics-stats.html>`_
|
|
1305
1347
|
|
|
1306
1348
|
:param id: Identifier for the data frame analytics job. If you do not specify
|
|
1307
1349
|
this option, the API returns information for the first hundred data frame
|
|
@@ -1358,7 +1400,7 @@ class MlClient(NamespacedClient):
|
|
|
1358
1400
|
"""
|
|
1359
1401
|
Retrieves usage information for datafeeds.
|
|
1360
1402
|
|
|
1361
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1403
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-datafeed-stats.html>`_
|
|
1362
1404
|
|
|
1363
1405
|
:param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier
|
|
1364
1406
|
or a wildcard expression. If you do not specify one of these options, the
|
|
@@ -1406,7 +1448,7 @@ class MlClient(NamespacedClient):
|
|
|
1406
1448
|
"""
|
|
1407
1449
|
Retrieves configuration information for datafeeds.
|
|
1408
1450
|
|
|
1409
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1451
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-datafeed.html>`_
|
|
1410
1452
|
|
|
1411
1453
|
:param datafeed_id: Identifier for the datafeed. It can be a datafeed identifier
|
|
1412
1454
|
or a wildcard expression. If you do not specify one of these options, the
|
|
@@ -1461,7 +1503,7 @@ class MlClient(NamespacedClient):
|
|
|
1461
1503
|
"""
|
|
1462
1504
|
Retrieves filters.
|
|
1463
1505
|
|
|
1464
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1506
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-filter.html>`_
|
|
1465
1507
|
|
|
1466
1508
|
:param filter_id: A string that uniquely identifies a filter.
|
|
1467
1509
|
:param from_: Skips the specified number of filters.
|
|
@@ -1490,7 +1532,7 @@ class MlClient(NamespacedClient):
|
|
|
1490
1532
|
)
|
|
1491
1533
|
|
|
1492
1534
|
@_rewrite_parameters(
|
|
1493
|
-
body_fields=
|
|
1535
|
+
body_fields=("page",),
|
|
1494
1536
|
parameter_aliases={"from": "from_"},
|
|
1495
1537
|
)
|
|
1496
1538
|
async def get_influencers(
|
|
@@ -1510,11 +1552,12 @@ class MlClient(NamespacedClient):
|
|
|
1510
1552
|
size: t.Optional[int] = None,
|
|
1511
1553
|
sort: t.Optional[str] = None,
|
|
1512
1554
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
1555
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1513
1556
|
) -> ObjectApiResponse[t.Any]:
|
|
1514
1557
|
"""
|
|
1515
1558
|
Retrieves anomaly detection job results for one or more influencers.
|
|
1516
1559
|
|
|
1517
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1560
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-influencer.html>`_
|
|
1518
1561
|
|
|
1519
1562
|
:param job_id: Identifier for the anomaly detection job.
|
|
1520
1563
|
:param desc: If true, the results are sorted in descending order.
|
|
@@ -1537,7 +1580,7 @@ class MlClient(NamespacedClient):
|
|
|
1537
1580
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
1538
1581
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/influencers"
|
|
1539
1582
|
__query: t.Dict[str, t.Any] = {}
|
|
1540
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1583
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1541
1584
|
if desc is not None:
|
|
1542
1585
|
__query["desc"] = desc
|
|
1543
1586
|
if end is not None:
|
|
@@ -1554,8 +1597,6 @@ class MlClient(NamespacedClient):
|
|
|
1554
1597
|
__query["human"] = human
|
|
1555
1598
|
if influencer_score is not None:
|
|
1556
1599
|
__query["influencer_score"] = influencer_score
|
|
1557
|
-
if page is not None:
|
|
1558
|
-
__body["page"] = page
|
|
1559
1600
|
if pretty is not None:
|
|
1560
1601
|
__query["pretty"] = pretty
|
|
1561
1602
|
if size is not None:
|
|
@@ -1564,6 +1605,9 @@ class MlClient(NamespacedClient):
|
|
|
1564
1605
|
__query["sort"] = sort
|
|
1565
1606
|
if start is not None:
|
|
1566
1607
|
__query["start"] = start
|
|
1608
|
+
if not __body:
|
|
1609
|
+
if page is not None:
|
|
1610
|
+
__body["page"] = page
|
|
1567
1611
|
if not __body:
|
|
1568
1612
|
__body = None # type: ignore[assignment]
|
|
1569
1613
|
__headers = {"accept": "application/json"}
|
|
@@ -1587,7 +1631,7 @@ class MlClient(NamespacedClient):
|
|
|
1587
1631
|
"""
|
|
1588
1632
|
Retrieves usage information for anomaly detection jobs.
|
|
1589
1633
|
|
|
1590
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1634
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-job-stats.html>`_
|
|
1591
1635
|
|
|
1592
1636
|
:param job_id: Identifier for the anomaly detection job. It can be a job identifier,
|
|
1593
1637
|
a group name, a comma-separated list of jobs, or a wildcard expression. If
|
|
@@ -1636,7 +1680,7 @@ class MlClient(NamespacedClient):
|
|
|
1636
1680
|
"""
|
|
1637
1681
|
Retrieves configuration information for anomaly detection jobs.
|
|
1638
1682
|
|
|
1639
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1683
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-job.html>`_
|
|
1640
1684
|
|
|
1641
1685
|
:param job_id: Identifier for the anomaly detection job. It can be a job identifier,
|
|
1642
1686
|
a group name, or a wildcard expression. If you do not specify one of these
|
|
@@ -1691,7 +1735,7 @@ class MlClient(NamespacedClient):
|
|
|
1691
1735
|
"""
|
|
1692
1736
|
Returns information on how ML is using memory.
|
|
1693
1737
|
|
|
1694
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1738
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-ml-memory.html>`_
|
|
1695
1739
|
|
|
1696
1740
|
:param node_id: The names of particular nodes in the cluster to target. For example,
|
|
1697
1741
|
`nodeId1,nodeId2` or `ml:true`
|
|
@@ -1738,7 +1782,7 @@ class MlClient(NamespacedClient):
|
|
|
1738
1782
|
"""
|
|
1739
1783
|
Gets stats for anomaly detection job model snapshot upgrades that are in progress.
|
|
1740
1784
|
|
|
1741
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1785
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-job-model-snapshot-upgrade-stats.html>`_
|
|
1742
1786
|
|
|
1743
1787
|
:param job_id: Identifier for the anomaly detection job.
|
|
1744
1788
|
:param snapshot_id: A numerical character string that uniquely identifies the
|
|
@@ -1776,7 +1820,7 @@ class MlClient(NamespacedClient):
|
|
|
1776
1820
|
)
|
|
1777
1821
|
|
|
1778
1822
|
@_rewrite_parameters(
|
|
1779
|
-
body_fields=
|
|
1823
|
+
body_fields=("desc", "end", "page", "sort", "start"),
|
|
1780
1824
|
parameter_aliases={"from": "from_"},
|
|
1781
1825
|
)
|
|
1782
1826
|
async def get_model_snapshots(
|
|
@@ -1795,11 +1839,12 @@ class MlClient(NamespacedClient):
|
|
|
1795
1839
|
size: t.Optional[int] = None,
|
|
1796
1840
|
sort: t.Optional[str] = None,
|
|
1797
1841
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
1842
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1798
1843
|
) -> ObjectApiResponse[t.Any]:
|
|
1799
1844
|
"""
|
|
1800
1845
|
Retrieves information about model snapshots.
|
|
1801
1846
|
|
|
1802
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1847
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-snapshot.html>`_
|
|
1803
1848
|
|
|
1804
1849
|
:param job_id: Identifier for the anomaly detection job.
|
|
1805
1850
|
:param snapshot_id: A numerical character string that uniquely identifies the
|
|
@@ -1823,12 +1868,8 @@ class MlClient(NamespacedClient):
|
|
|
1823
1868
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots"
|
|
1824
1869
|
else:
|
|
1825
1870
|
raise ValueError("Couldn't find a path for the given parameters")
|
|
1826
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1827
1871
|
__query: t.Dict[str, t.Any] = {}
|
|
1828
|
-
if
|
|
1829
|
-
__body["desc"] = desc
|
|
1830
|
-
if end is not None:
|
|
1831
|
-
__body["end"] = end
|
|
1872
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1832
1873
|
if error_trace is not None:
|
|
1833
1874
|
__query["error_trace"] = error_trace
|
|
1834
1875
|
if filter_path is not None:
|
|
@@ -1837,16 +1878,21 @@ class MlClient(NamespacedClient):
|
|
|
1837
1878
|
__query["from"] = from_
|
|
1838
1879
|
if human is not None:
|
|
1839
1880
|
__query["human"] = human
|
|
1840
|
-
if page is not None:
|
|
1841
|
-
__body["page"] = page
|
|
1842
1881
|
if pretty is not None:
|
|
1843
1882
|
__query["pretty"] = pretty
|
|
1844
1883
|
if size is not None:
|
|
1845
1884
|
__query["size"] = size
|
|
1846
|
-
if
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1885
|
+
if not __body:
|
|
1886
|
+
if desc is not None:
|
|
1887
|
+
__body["desc"] = desc
|
|
1888
|
+
if end is not None:
|
|
1889
|
+
__body["end"] = end
|
|
1890
|
+
if page is not None:
|
|
1891
|
+
__body["page"] = page
|
|
1892
|
+
if sort is not None:
|
|
1893
|
+
__body["sort"] = sort
|
|
1894
|
+
if start is not None:
|
|
1895
|
+
__body["start"] = start
|
|
1850
1896
|
if not __body:
|
|
1851
1897
|
__body = None # type: ignore[assignment]
|
|
1852
1898
|
__headers = {"accept": "application/json"}
|
|
@@ -1857,7 +1903,15 @@ class MlClient(NamespacedClient):
|
|
|
1857
1903
|
)
|
|
1858
1904
|
|
|
1859
1905
|
@_rewrite_parameters(
|
|
1860
|
-
body_fields=
|
|
1906
|
+
body_fields=(
|
|
1907
|
+
"allow_no_match",
|
|
1908
|
+
"bucket_span",
|
|
1909
|
+
"end",
|
|
1910
|
+
"exclude_interim",
|
|
1911
|
+
"overall_score",
|
|
1912
|
+
"start",
|
|
1913
|
+
"top_n",
|
|
1914
|
+
),
|
|
1861
1915
|
)
|
|
1862
1916
|
async def get_overall_buckets(
|
|
1863
1917
|
self,
|
|
@@ -1874,12 +1928,13 @@ class MlClient(NamespacedClient):
|
|
|
1874
1928
|
pretty: t.Optional[bool] = None,
|
|
1875
1929
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
1876
1930
|
top_n: t.Optional[int] = None,
|
|
1931
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1877
1932
|
) -> ObjectApiResponse[t.Any]:
|
|
1878
1933
|
"""
|
|
1879
1934
|
Retrieves overall bucket results that summarize the bucket results of multiple
|
|
1880
1935
|
anomaly detection jobs.
|
|
1881
1936
|
|
|
1882
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
1937
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-overall-buckets.html>`_
|
|
1883
1938
|
|
|
1884
1939
|
:param job_id: Identifier for the anomaly detection job. It can be a job identifier,
|
|
1885
1940
|
a group name, a comma-separated list of jobs or groups, or a wildcard expression.
|
|
@@ -1899,30 +1954,31 @@ class MlClient(NamespacedClient):
|
|
|
1899
1954
|
if job_id in SKIP_IN_PATH:
|
|
1900
1955
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
1901
1956
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/overall_buckets"
|
|
1902
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1903
1957
|
__query: t.Dict[str, t.Any] = {}
|
|
1904
|
-
if
|
|
1905
|
-
__body["allow_no_match"] = allow_no_match
|
|
1906
|
-
if bucket_span is not None:
|
|
1907
|
-
__body["bucket_span"] = bucket_span
|
|
1908
|
-
if end is not None:
|
|
1909
|
-
__body["end"] = end
|
|
1958
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1910
1959
|
if error_trace is not None:
|
|
1911
1960
|
__query["error_trace"] = error_trace
|
|
1912
|
-
if exclude_interim is not None:
|
|
1913
|
-
__body["exclude_interim"] = exclude_interim
|
|
1914
1961
|
if filter_path is not None:
|
|
1915
1962
|
__query["filter_path"] = filter_path
|
|
1916
1963
|
if human is not None:
|
|
1917
1964
|
__query["human"] = human
|
|
1918
|
-
if overall_score is not None:
|
|
1919
|
-
__body["overall_score"] = overall_score
|
|
1920
1965
|
if pretty is not None:
|
|
1921
1966
|
__query["pretty"] = pretty
|
|
1922
|
-
if
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1967
|
+
if not __body:
|
|
1968
|
+
if allow_no_match is not None:
|
|
1969
|
+
__body["allow_no_match"] = allow_no_match
|
|
1970
|
+
if bucket_span is not None:
|
|
1971
|
+
__body["bucket_span"] = bucket_span
|
|
1972
|
+
if end is not None:
|
|
1973
|
+
__body["end"] = end
|
|
1974
|
+
if exclude_interim is not None:
|
|
1975
|
+
__body["exclude_interim"] = exclude_interim
|
|
1976
|
+
if overall_score is not None:
|
|
1977
|
+
__body["overall_score"] = overall_score
|
|
1978
|
+
if start is not None:
|
|
1979
|
+
__body["start"] = start
|
|
1980
|
+
if top_n is not None:
|
|
1981
|
+
__body["top_n"] = top_n
|
|
1926
1982
|
if not __body:
|
|
1927
1983
|
__body = None # type: ignore[assignment]
|
|
1928
1984
|
__headers = {"accept": "application/json"}
|
|
@@ -1933,7 +1989,15 @@ class MlClient(NamespacedClient):
|
|
|
1933
1989
|
)
|
|
1934
1990
|
|
|
1935
1991
|
@_rewrite_parameters(
|
|
1936
|
-
body_fields=
|
|
1992
|
+
body_fields=(
|
|
1993
|
+
"desc",
|
|
1994
|
+
"end",
|
|
1995
|
+
"exclude_interim",
|
|
1996
|
+
"page",
|
|
1997
|
+
"record_score",
|
|
1998
|
+
"sort",
|
|
1999
|
+
"start",
|
|
2000
|
+
),
|
|
1937
2001
|
parameter_aliases={"from": "from_"},
|
|
1938
2002
|
)
|
|
1939
2003
|
async def get_records(
|
|
@@ -1953,11 +2017,12 @@ class MlClient(NamespacedClient):
|
|
|
1953
2017
|
size: t.Optional[int] = None,
|
|
1954
2018
|
sort: t.Optional[str] = None,
|
|
1955
2019
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
2020
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
1956
2021
|
) -> ObjectApiResponse[t.Any]:
|
|
1957
2022
|
"""
|
|
1958
2023
|
Retrieves anomaly records for an anomaly detection job.
|
|
1959
2024
|
|
|
1960
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2025
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-get-record.html>`_
|
|
1961
2026
|
|
|
1962
2027
|
:param job_id: Identifier for the anomaly detection job.
|
|
1963
2028
|
:param desc: Refer to the description for the `desc` query parameter.
|
|
@@ -1974,34 +2039,35 @@ class MlClient(NamespacedClient):
|
|
|
1974
2039
|
if job_id in SKIP_IN_PATH:
|
|
1975
2040
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
1976
2041
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/results/records"
|
|
1977
|
-
__body: t.Dict[str, t.Any] = {}
|
|
1978
2042
|
__query: t.Dict[str, t.Any] = {}
|
|
1979
|
-
if
|
|
1980
|
-
__body["desc"] = desc
|
|
1981
|
-
if end is not None:
|
|
1982
|
-
__body["end"] = end
|
|
2043
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
1983
2044
|
if error_trace is not None:
|
|
1984
2045
|
__query["error_trace"] = error_trace
|
|
1985
|
-
if exclude_interim is not None:
|
|
1986
|
-
__body["exclude_interim"] = exclude_interim
|
|
1987
2046
|
if filter_path is not None:
|
|
1988
2047
|
__query["filter_path"] = filter_path
|
|
1989
2048
|
if from_ is not None:
|
|
1990
2049
|
__query["from"] = from_
|
|
1991
2050
|
if human is not None:
|
|
1992
2051
|
__query["human"] = human
|
|
1993
|
-
if page is not None:
|
|
1994
|
-
__body["page"] = page
|
|
1995
2052
|
if pretty is not None:
|
|
1996
2053
|
__query["pretty"] = pretty
|
|
1997
|
-
if record_score is not None:
|
|
1998
|
-
__body["record_score"] = record_score
|
|
1999
2054
|
if size is not None:
|
|
2000
2055
|
__query["size"] = size
|
|
2001
|
-
if
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2056
|
+
if not __body:
|
|
2057
|
+
if desc is not None:
|
|
2058
|
+
__body["desc"] = desc
|
|
2059
|
+
if end is not None:
|
|
2060
|
+
__body["end"] = end
|
|
2061
|
+
if exclude_interim is not None:
|
|
2062
|
+
__body["exclude_interim"] = exclude_interim
|
|
2063
|
+
if page is not None:
|
|
2064
|
+
__body["page"] = page
|
|
2065
|
+
if record_score is not None:
|
|
2066
|
+
__body["record_score"] = record_score
|
|
2067
|
+
if sort is not None:
|
|
2068
|
+
__body["sort"] = sort
|
|
2069
|
+
if start is not None:
|
|
2070
|
+
__body["start"] = start
|
|
2005
2071
|
if not __body:
|
|
2006
2072
|
__body = None # type: ignore[assignment]
|
|
2007
2073
|
__headers = {"accept": "application/json"}
|
|
@@ -2038,7 +2104,7 @@ class MlClient(NamespacedClient):
|
|
|
2038
2104
|
"""
|
|
2039
2105
|
Retrieves configuration information for a trained inference model.
|
|
2040
2106
|
|
|
2041
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2107
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-trained-models.html>`_
|
|
2042
2108
|
|
|
2043
2109
|
:param model_id: The unique identifier of the trained model.
|
|
2044
2110
|
:param allow_no_match: Specifies what to do when the request: - Contains wildcard
|
|
@@ -2110,7 +2176,7 @@ class MlClient(NamespacedClient):
|
|
|
2110
2176
|
"""
|
|
2111
2177
|
Retrieves usage information for trained inference models.
|
|
2112
2178
|
|
|
2113
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2179
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-trained-models-stats.html>`_
|
|
2114
2180
|
|
|
2115
2181
|
:param model_id: The unique identifier of the trained model or a model alias.
|
|
2116
2182
|
It can be a comma-separated list or a wildcard expression.
|
|
@@ -2147,24 +2213,25 @@ class MlClient(NamespacedClient):
|
|
|
2147
2213
|
)
|
|
2148
2214
|
|
|
2149
2215
|
@_rewrite_parameters(
|
|
2150
|
-
body_fields=
|
|
2216
|
+
body_fields=("docs", "inference_config"),
|
|
2151
2217
|
)
|
|
2152
2218
|
async def infer_trained_model(
|
|
2153
2219
|
self,
|
|
2154
2220
|
*,
|
|
2155
2221
|
model_id: str,
|
|
2156
|
-
docs: t.Sequence[t.Mapping[str, t.Any]],
|
|
2222
|
+
docs: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
|
|
2157
2223
|
error_trace: t.Optional[bool] = None,
|
|
2158
2224
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2159
2225
|
human: t.Optional[bool] = None,
|
|
2160
2226
|
inference_config: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2161
2227
|
pretty: t.Optional[bool] = None,
|
|
2162
2228
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
2229
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2163
2230
|
) -> ObjectApiResponse[t.Any]:
|
|
2164
2231
|
"""
|
|
2165
2232
|
Evaluate a trained model.
|
|
2166
2233
|
|
|
2167
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2234
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/infer-trained-model.html>`_
|
|
2168
2235
|
|
|
2169
2236
|
:param model_id: The unique identifier of the trained model.
|
|
2170
2237
|
:param docs: An array of objects to pass to the model for inference. The objects
|
|
@@ -2177,25 +2244,26 @@ class MlClient(NamespacedClient):
|
|
|
2177
2244
|
"""
|
|
2178
2245
|
if model_id in SKIP_IN_PATH:
|
|
2179
2246
|
raise ValueError("Empty value passed for parameter 'model_id'")
|
|
2180
|
-
if docs is None:
|
|
2247
|
+
if docs is None and body is None:
|
|
2181
2248
|
raise ValueError("Empty value passed for parameter 'docs'")
|
|
2182
2249
|
__path = f"/_ml/trained_models/{_quote(model_id)}/_infer"
|
|
2183
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2184
2250
|
__query: t.Dict[str, t.Any] = {}
|
|
2185
|
-
if
|
|
2186
|
-
__body["docs"] = docs
|
|
2251
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2187
2252
|
if error_trace is not None:
|
|
2188
2253
|
__query["error_trace"] = error_trace
|
|
2189
2254
|
if filter_path is not None:
|
|
2190
2255
|
__query["filter_path"] = filter_path
|
|
2191
2256
|
if human is not None:
|
|
2192
2257
|
__query["human"] = human
|
|
2193
|
-
if inference_config is not None:
|
|
2194
|
-
__body["inference_config"] = inference_config
|
|
2195
2258
|
if pretty is not None:
|
|
2196
2259
|
__query["pretty"] = pretty
|
|
2197
2260
|
if timeout is not None:
|
|
2198
2261
|
__query["timeout"] = timeout
|
|
2262
|
+
if not __body:
|
|
2263
|
+
if docs is not None:
|
|
2264
|
+
__body["docs"] = docs
|
|
2265
|
+
if inference_config is not None:
|
|
2266
|
+
__body["inference_config"] = inference_config
|
|
2199
2267
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2200
2268
|
return await self.perform_request( # type: ignore[return-value]
|
|
2201
2269
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -2213,7 +2281,7 @@ class MlClient(NamespacedClient):
|
|
|
2213
2281
|
"""
|
|
2214
2282
|
Returns defaults and limits used by machine learning.
|
|
2215
2283
|
|
|
2216
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2284
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-ml-info.html>`_
|
|
2217
2285
|
"""
|
|
2218
2286
|
__path = "/_ml/info"
|
|
2219
2287
|
__query: t.Dict[str, t.Any] = {}
|
|
@@ -2231,7 +2299,7 @@ class MlClient(NamespacedClient):
|
|
|
2231
2299
|
)
|
|
2232
2300
|
|
|
2233
2301
|
@_rewrite_parameters(
|
|
2234
|
-
body_fields=
|
|
2302
|
+
body_fields=("timeout",),
|
|
2235
2303
|
)
|
|
2236
2304
|
async def open_job(
|
|
2237
2305
|
self,
|
|
@@ -2242,11 +2310,12 @@ class MlClient(NamespacedClient):
|
|
|
2242
2310
|
human: t.Optional[bool] = None,
|
|
2243
2311
|
pretty: t.Optional[bool] = None,
|
|
2244
2312
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
2313
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2245
2314
|
) -> ObjectApiResponse[t.Any]:
|
|
2246
2315
|
"""
|
|
2247
2316
|
Opens one or more anomaly detection jobs.
|
|
2248
2317
|
|
|
2249
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2318
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-open-job.html>`_
|
|
2250
2319
|
|
|
2251
2320
|
:param job_id: Identifier for the anomaly detection job.
|
|
2252
2321
|
:param timeout: Refer to the description for the `timeout` query parameter.
|
|
@@ -2255,7 +2324,7 @@ class MlClient(NamespacedClient):
|
|
|
2255
2324
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
2256
2325
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_open"
|
|
2257
2326
|
__query: t.Dict[str, t.Any] = {}
|
|
2258
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2327
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2259
2328
|
if error_trace is not None:
|
|
2260
2329
|
__query["error_trace"] = error_trace
|
|
2261
2330
|
if filter_path is not None:
|
|
@@ -2264,8 +2333,9 @@ class MlClient(NamespacedClient):
|
|
|
2264
2333
|
__query["human"] = human
|
|
2265
2334
|
if pretty is not None:
|
|
2266
2335
|
__query["pretty"] = pretty
|
|
2267
|
-
if
|
|
2268
|
-
|
|
2336
|
+
if not __body:
|
|
2337
|
+
if timeout is not None:
|
|
2338
|
+
__body["timeout"] = timeout
|
|
2269
2339
|
if not __body:
|
|
2270
2340
|
__body = None # type: ignore[assignment]
|
|
2271
2341
|
__headers = {"accept": "application/json"}
|
|
@@ -2276,22 +2346,23 @@ class MlClient(NamespacedClient):
|
|
|
2276
2346
|
)
|
|
2277
2347
|
|
|
2278
2348
|
@_rewrite_parameters(
|
|
2279
|
-
body_fields=
|
|
2349
|
+
body_fields=("events",),
|
|
2280
2350
|
)
|
|
2281
2351
|
async def post_calendar_events(
|
|
2282
2352
|
self,
|
|
2283
2353
|
*,
|
|
2284
2354
|
calendar_id: str,
|
|
2285
|
-
events: t.Sequence[t.Mapping[str, t.Any]],
|
|
2355
|
+
events: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
|
|
2286
2356
|
error_trace: t.Optional[bool] = None,
|
|
2287
2357
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2288
2358
|
human: t.Optional[bool] = None,
|
|
2289
2359
|
pretty: t.Optional[bool] = None,
|
|
2360
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2290
2361
|
) -> ObjectApiResponse[t.Any]:
|
|
2291
2362
|
"""
|
|
2292
2363
|
Posts scheduled events in a calendar.
|
|
2293
2364
|
|
|
2294
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2365
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-post-calendar-event.html>`_
|
|
2295
2366
|
|
|
2296
2367
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
2297
2368
|
:param events: A list of one of more scheduled events. The event’s start and
|
|
@@ -2300,13 +2371,11 @@ class MlClient(NamespacedClient):
|
|
|
2300
2371
|
"""
|
|
2301
2372
|
if calendar_id in SKIP_IN_PATH:
|
|
2302
2373
|
raise ValueError("Empty value passed for parameter 'calendar_id'")
|
|
2303
|
-
if events is None:
|
|
2374
|
+
if events is None and body is None:
|
|
2304
2375
|
raise ValueError("Empty value passed for parameter 'events'")
|
|
2305
2376
|
__path = f"/_ml/calendars/{_quote(calendar_id)}/events"
|
|
2306
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2307
2377
|
__query: t.Dict[str, t.Any] = {}
|
|
2308
|
-
if
|
|
2309
|
-
__body["events"] = events
|
|
2378
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2310
2379
|
if error_trace is not None:
|
|
2311
2380
|
__query["error_trace"] = error_trace
|
|
2312
2381
|
if filter_path is not None:
|
|
@@ -2315,6 +2384,9 @@ class MlClient(NamespacedClient):
|
|
|
2315
2384
|
__query["human"] = human
|
|
2316
2385
|
if pretty is not None:
|
|
2317
2386
|
__query["pretty"] = pretty
|
|
2387
|
+
if not __body:
|
|
2388
|
+
if events is not None:
|
|
2389
|
+
__body["events"] = events
|
|
2318
2390
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2319
2391
|
return await self.perform_request( # type: ignore[return-value]
|
|
2320
2392
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -2327,7 +2399,8 @@ class MlClient(NamespacedClient):
|
|
|
2327
2399
|
self,
|
|
2328
2400
|
*,
|
|
2329
2401
|
job_id: str,
|
|
2330
|
-
data: t.Sequence[t.Any],
|
|
2402
|
+
data: t.Optional[t.Sequence[t.Any]] = None,
|
|
2403
|
+
body: t.Optional[t.Sequence[t.Any]] = None,
|
|
2331
2404
|
error_trace: t.Optional[bool] = None,
|
|
2332
2405
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2333
2406
|
human: t.Optional[bool] = None,
|
|
@@ -2338,7 +2411,7 @@ class MlClient(NamespacedClient):
|
|
|
2338
2411
|
"""
|
|
2339
2412
|
Sends data to an anomaly detection job for analysis.
|
|
2340
2413
|
|
|
2341
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2414
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-post-data.html>`_
|
|
2342
2415
|
|
|
2343
2416
|
:param job_id: Identifier for the anomaly detection job. The job must have a
|
|
2344
2417
|
state of open to receive and process the data.
|
|
@@ -2348,8 +2421,12 @@ class MlClient(NamespacedClient):
|
|
|
2348
2421
|
"""
|
|
2349
2422
|
if job_id in SKIP_IN_PATH:
|
|
2350
2423
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
2351
|
-
if data is None:
|
|
2352
|
-
raise ValueError(
|
|
2424
|
+
if data is None and body is None:
|
|
2425
|
+
raise ValueError(
|
|
2426
|
+
"Empty value passed for parameters 'data' and 'body', one of them should be set."
|
|
2427
|
+
)
|
|
2428
|
+
elif data is not None and body is not None:
|
|
2429
|
+
raise ValueError("Cannot set both 'data' and 'body'")
|
|
2353
2430
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_data"
|
|
2354
2431
|
__query: t.Dict[str, t.Any] = {}
|
|
2355
2432
|
if error_trace is not None:
|
|
@@ -2364,7 +2441,7 @@ class MlClient(NamespacedClient):
|
|
|
2364
2441
|
__query["reset_end"] = reset_end
|
|
2365
2442
|
if reset_start is not None:
|
|
2366
2443
|
__query["reset_start"] = reset_start
|
|
2367
|
-
__body = data
|
|
2444
|
+
__body = data if data is not None else body
|
|
2368
2445
|
__headers = {
|
|
2369
2446
|
"accept": "application/json",
|
|
2370
2447
|
"content-type": "application/x-ndjson",
|
|
@@ -2374,7 +2451,7 @@ class MlClient(NamespacedClient):
|
|
|
2374
2451
|
)
|
|
2375
2452
|
|
|
2376
2453
|
@_rewrite_parameters(
|
|
2377
|
-
body_fields=
|
|
2454
|
+
body_fields=("config",),
|
|
2378
2455
|
)
|
|
2379
2456
|
async def preview_data_frame_analytics(
|
|
2380
2457
|
self,
|
|
@@ -2385,11 +2462,12 @@ class MlClient(NamespacedClient):
|
|
|
2385
2462
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
2386
2463
|
human: t.Optional[bool] = None,
|
|
2387
2464
|
pretty: t.Optional[bool] = None,
|
|
2465
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2388
2466
|
) -> ObjectApiResponse[t.Any]:
|
|
2389
2467
|
"""
|
|
2390
2468
|
Previews that will be analyzed given a data frame analytics config.
|
|
2391
2469
|
|
|
2392
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2470
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/preview-dfanalytics.html>`_
|
|
2393
2471
|
|
|
2394
2472
|
:param id: Identifier for the data frame analytics job.
|
|
2395
2473
|
:param config: A data frame analytics config as described in create data frame
|
|
@@ -2400,10 +2478,8 @@ class MlClient(NamespacedClient):
|
|
|
2400
2478
|
__path = f"/_ml/data_frame/analytics/{_quote(id)}/_preview"
|
|
2401
2479
|
else:
|
|
2402
2480
|
__path = "/_ml/data_frame/analytics/_preview"
|
|
2403
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2404
2481
|
__query: t.Dict[str, t.Any] = {}
|
|
2405
|
-
if
|
|
2406
|
-
__body["config"] = config
|
|
2482
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2407
2483
|
if error_trace is not None:
|
|
2408
2484
|
__query["error_trace"] = error_trace
|
|
2409
2485
|
if filter_path is not None:
|
|
@@ -2412,6 +2488,9 @@ class MlClient(NamespacedClient):
|
|
|
2412
2488
|
__query["human"] = human
|
|
2413
2489
|
if pretty is not None:
|
|
2414
2490
|
__query["pretty"] = pretty
|
|
2491
|
+
if not __body:
|
|
2492
|
+
if config is not None:
|
|
2493
|
+
__body["config"] = config
|
|
2415
2494
|
if not __body:
|
|
2416
2495
|
__body = None # type: ignore[assignment]
|
|
2417
2496
|
__headers = {"accept": "application/json"}
|
|
@@ -2422,7 +2501,7 @@ class MlClient(NamespacedClient):
|
|
|
2422
2501
|
)
|
|
2423
2502
|
|
|
2424
2503
|
@_rewrite_parameters(
|
|
2425
|
-
body_fields=
|
|
2504
|
+
body_fields=("datafeed_config", "job_config"),
|
|
2426
2505
|
)
|
|
2427
2506
|
async def preview_datafeed(
|
|
2428
2507
|
self,
|
|
@@ -2436,11 +2515,12 @@ class MlClient(NamespacedClient):
|
|
|
2436
2515
|
job_config: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2437
2516
|
pretty: t.Optional[bool] = None,
|
|
2438
2517
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
2518
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2439
2519
|
) -> ObjectApiResponse[t.Any]:
|
|
2440
2520
|
"""
|
|
2441
2521
|
Previews a datafeed.
|
|
2442
2522
|
|
|
2443
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2523
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-preview-datafeed.html>`_
|
|
2444
2524
|
|
|
2445
2525
|
:param datafeed_id: A numerical character string that uniquely identifies the
|
|
2446
2526
|
datafeed. This identifier can contain lowercase alphanumeric characters (a-z
|
|
@@ -2461,10 +2541,8 @@ class MlClient(NamespacedClient):
|
|
|
2461
2541
|
__path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_preview"
|
|
2462
2542
|
else:
|
|
2463
2543
|
__path = "/_ml/datafeeds/_preview"
|
|
2464
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2465
2544
|
__query: t.Dict[str, t.Any] = {}
|
|
2466
|
-
if
|
|
2467
|
-
__body["datafeed_config"] = datafeed_config
|
|
2545
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2468
2546
|
if end is not None:
|
|
2469
2547
|
__query["end"] = end
|
|
2470
2548
|
if error_trace is not None:
|
|
@@ -2473,12 +2551,15 @@ class MlClient(NamespacedClient):
|
|
|
2473
2551
|
__query["filter_path"] = filter_path
|
|
2474
2552
|
if human is not None:
|
|
2475
2553
|
__query["human"] = human
|
|
2476
|
-
if job_config is not None:
|
|
2477
|
-
__body["job_config"] = job_config
|
|
2478
2554
|
if pretty is not None:
|
|
2479
2555
|
__query["pretty"] = pretty
|
|
2480
2556
|
if start is not None:
|
|
2481
2557
|
__query["start"] = start
|
|
2558
|
+
if not __body:
|
|
2559
|
+
if datafeed_config is not None:
|
|
2560
|
+
__body["datafeed_config"] = datafeed_config
|
|
2561
|
+
if job_config is not None:
|
|
2562
|
+
__body["job_config"] = job_config
|
|
2482
2563
|
if not __body:
|
|
2483
2564
|
__body = None # type: ignore[assignment]
|
|
2484
2565
|
__headers = {"accept": "application/json"}
|
|
@@ -2489,7 +2570,7 @@ class MlClient(NamespacedClient):
|
|
|
2489
2570
|
)
|
|
2490
2571
|
|
|
2491
2572
|
@_rewrite_parameters(
|
|
2492
|
-
body_fields=
|
|
2573
|
+
body_fields=("description", "job_ids"),
|
|
2493
2574
|
)
|
|
2494
2575
|
async def put_calendar(
|
|
2495
2576
|
self,
|
|
@@ -2501,11 +2582,12 @@ class MlClient(NamespacedClient):
|
|
|
2501
2582
|
human: t.Optional[bool] = None,
|
|
2502
2583
|
job_ids: t.Optional[t.Sequence[str]] = None,
|
|
2503
2584
|
pretty: t.Optional[bool] = None,
|
|
2585
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2504
2586
|
) -> ObjectApiResponse[t.Any]:
|
|
2505
2587
|
"""
|
|
2506
2588
|
Instantiates a calendar.
|
|
2507
2589
|
|
|
2508
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2590
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-put-calendar.html>`_
|
|
2509
2591
|
|
|
2510
2592
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
2511
2593
|
:param description: A description of the calendar.
|
|
@@ -2514,20 +2596,21 @@ class MlClient(NamespacedClient):
|
|
|
2514
2596
|
if calendar_id in SKIP_IN_PATH:
|
|
2515
2597
|
raise ValueError("Empty value passed for parameter 'calendar_id'")
|
|
2516
2598
|
__path = f"/_ml/calendars/{_quote(calendar_id)}"
|
|
2517
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2518
2599
|
__query: t.Dict[str, t.Any] = {}
|
|
2519
|
-
if
|
|
2520
|
-
__body["description"] = description
|
|
2600
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2521
2601
|
if error_trace is not None:
|
|
2522
2602
|
__query["error_trace"] = error_trace
|
|
2523
2603
|
if filter_path is not None:
|
|
2524
2604
|
__query["filter_path"] = filter_path
|
|
2525
2605
|
if human is not None:
|
|
2526
2606
|
__query["human"] = human
|
|
2527
|
-
if job_ids is not None:
|
|
2528
|
-
__body["job_ids"] = job_ids
|
|
2529
2607
|
if pretty is not None:
|
|
2530
2608
|
__query["pretty"] = pretty
|
|
2609
|
+
if not __body:
|
|
2610
|
+
if description is not None:
|
|
2611
|
+
__body["description"] = description
|
|
2612
|
+
if job_ids is not None:
|
|
2613
|
+
__body["job_ids"] = job_ids
|
|
2531
2614
|
if not __body:
|
|
2532
2615
|
__body = None # type: ignore[assignment]
|
|
2533
2616
|
__headers = {"accept": "application/json"}
|
|
@@ -2551,7 +2634,7 @@ class MlClient(NamespacedClient):
|
|
|
2551
2634
|
"""
|
|
2552
2635
|
Adds an anomaly detection job to a calendar.
|
|
2553
2636
|
|
|
2554
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2637
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-put-calendar-job.html>`_
|
|
2555
2638
|
|
|
2556
2639
|
:param calendar_id: A string that uniquely identifies a calendar.
|
|
2557
2640
|
:param job_id: An identifier for the anomaly detection jobs. It can be a job
|
|
@@ -2577,16 +2660,27 @@ class MlClient(NamespacedClient):
|
|
|
2577
2660
|
)
|
|
2578
2661
|
|
|
2579
2662
|
@_rewrite_parameters(
|
|
2580
|
-
body_fields=
|
|
2663
|
+
body_fields=(
|
|
2664
|
+
"analysis",
|
|
2665
|
+
"dest",
|
|
2666
|
+
"source",
|
|
2667
|
+
"allow_lazy_start",
|
|
2668
|
+
"analyzed_fields",
|
|
2669
|
+
"description",
|
|
2670
|
+
"headers",
|
|
2671
|
+
"max_num_threads",
|
|
2672
|
+
"model_memory_limit",
|
|
2673
|
+
"version",
|
|
2674
|
+
),
|
|
2581
2675
|
ignore_deprecated_options={"headers"},
|
|
2582
2676
|
)
|
|
2583
2677
|
async def put_data_frame_analytics(
|
|
2584
2678
|
self,
|
|
2585
2679
|
*,
|
|
2586
2680
|
id: str,
|
|
2587
|
-
analysis: t.Mapping[str, t.Any],
|
|
2588
|
-
dest: t.Mapping[str, t.Any],
|
|
2589
|
-
source: t.Mapping[str, t.Any],
|
|
2681
|
+
analysis: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2682
|
+
dest: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2683
|
+
source: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2590
2684
|
allow_lazy_start: t.Optional[bool] = None,
|
|
2591
2685
|
analyzed_fields: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2592
2686
|
description: t.Optional[str] = None,
|
|
@@ -2598,11 +2692,12 @@ class MlClient(NamespacedClient):
|
|
|
2598
2692
|
model_memory_limit: t.Optional[str] = None,
|
|
2599
2693
|
pretty: t.Optional[bool] = None,
|
|
2600
2694
|
version: t.Optional[str] = None,
|
|
2695
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2601
2696
|
) -> ObjectApiResponse[t.Any]:
|
|
2602
2697
|
"""
|
|
2603
2698
|
Instantiates a data frame analytics job.
|
|
2604
2699
|
|
|
2605
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2700
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-dfanalytics.html>`_
|
|
2606
2701
|
|
|
2607
2702
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
2608
2703
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -2661,50 +2756,67 @@ class MlClient(NamespacedClient):
|
|
|
2661
2756
|
"""
|
|
2662
2757
|
if id in SKIP_IN_PATH:
|
|
2663
2758
|
raise ValueError("Empty value passed for parameter 'id'")
|
|
2664
|
-
if analysis is None:
|
|
2759
|
+
if analysis is None and body is None:
|
|
2665
2760
|
raise ValueError("Empty value passed for parameter 'analysis'")
|
|
2666
|
-
if dest is None:
|
|
2761
|
+
if dest is None and body is None:
|
|
2667
2762
|
raise ValueError("Empty value passed for parameter 'dest'")
|
|
2668
|
-
if source is None:
|
|
2763
|
+
if source is None and body is None:
|
|
2669
2764
|
raise ValueError("Empty value passed for parameter 'source'")
|
|
2670
2765
|
__path = f"/_ml/data_frame/analytics/{_quote(id)}"
|
|
2671
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2672
2766
|
__query: t.Dict[str, t.Any] = {}
|
|
2673
|
-
if
|
|
2674
|
-
__body["analysis"] = analysis
|
|
2675
|
-
if dest is not None:
|
|
2676
|
-
__body["dest"] = dest
|
|
2677
|
-
if source is not None:
|
|
2678
|
-
__body["source"] = source
|
|
2679
|
-
if allow_lazy_start is not None:
|
|
2680
|
-
__body["allow_lazy_start"] = allow_lazy_start
|
|
2681
|
-
if analyzed_fields is not None:
|
|
2682
|
-
__body["analyzed_fields"] = analyzed_fields
|
|
2683
|
-
if description is not None:
|
|
2684
|
-
__body["description"] = description
|
|
2767
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2685
2768
|
if error_trace is not None:
|
|
2686
2769
|
__query["error_trace"] = error_trace
|
|
2687
2770
|
if filter_path is not None:
|
|
2688
2771
|
__query["filter_path"] = filter_path
|
|
2689
|
-
if headers is not None:
|
|
2690
|
-
__body["headers"] = headers
|
|
2691
2772
|
if human is not None:
|
|
2692
2773
|
__query["human"] = human
|
|
2693
|
-
if max_num_threads is not None:
|
|
2694
|
-
__body["max_num_threads"] = max_num_threads
|
|
2695
|
-
if model_memory_limit is not None:
|
|
2696
|
-
__body["model_memory_limit"] = model_memory_limit
|
|
2697
2774
|
if pretty is not None:
|
|
2698
2775
|
__query["pretty"] = pretty
|
|
2699
|
-
if
|
|
2700
|
-
|
|
2776
|
+
if not __body:
|
|
2777
|
+
if analysis is not None:
|
|
2778
|
+
__body["analysis"] = analysis
|
|
2779
|
+
if dest is not None:
|
|
2780
|
+
__body["dest"] = dest
|
|
2781
|
+
if source is not None:
|
|
2782
|
+
__body["source"] = source
|
|
2783
|
+
if allow_lazy_start is not None:
|
|
2784
|
+
__body["allow_lazy_start"] = allow_lazy_start
|
|
2785
|
+
if analyzed_fields is not None:
|
|
2786
|
+
__body["analyzed_fields"] = analyzed_fields
|
|
2787
|
+
if description is not None:
|
|
2788
|
+
__body["description"] = description
|
|
2789
|
+
if headers is not None:
|
|
2790
|
+
__body["headers"] = headers
|
|
2791
|
+
if max_num_threads is not None:
|
|
2792
|
+
__body["max_num_threads"] = max_num_threads
|
|
2793
|
+
if model_memory_limit is not None:
|
|
2794
|
+
__body["model_memory_limit"] = model_memory_limit
|
|
2795
|
+
if version is not None:
|
|
2796
|
+
__body["version"] = version
|
|
2701
2797
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2702
2798
|
return await self.perform_request( # type: ignore[return-value]
|
|
2703
2799
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
2704
2800
|
)
|
|
2705
2801
|
|
|
2706
2802
|
@_rewrite_parameters(
|
|
2707
|
-
body_fields=
|
|
2803
|
+
body_fields=(
|
|
2804
|
+
"aggregations",
|
|
2805
|
+
"chunking_config",
|
|
2806
|
+
"delayed_data_check_config",
|
|
2807
|
+
"frequency",
|
|
2808
|
+
"headers",
|
|
2809
|
+
"indexes",
|
|
2810
|
+
"indices",
|
|
2811
|
+
"indices_options",
|
|
2812
|
+
"job_id",
|
|
2813
|
+
"max_empty_searches",
|
|
2814
|
+
"query",
|
|
2815
|
+
"query_delay",
|
|
2816
|
+
"runtime_mappings",
|
|
2817
|
+
"script_fields",
|
|
2818
|
+
"scroll_size",
|
|
2819
|
+
),
|
|
2708
2820
|
ignore_deprecated_options={"headers"},
|
|
2709
2821
|
)
|
|
2710
2822
|
async def put_datafeed(
|
|
@@ -2741,11 +2853,12 @@ class MlClient(NamespacedClient):
|
|
|
2741
2853
|
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
|
|
2742
2854
|
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
|
|
2743
2855
|
scroll_size: t.Optional[int] = None,
|
|
2856
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2744
2857
|
) -> ObjectApiResponse[t.Any]:
|
|
2745
2858
|
"""
|
|
2746
2859
|
Instantiates a datafeed.
|
|
2747
2860
|
|
|
2748
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
2861
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-put-datafeed.html>`_
|
|
2749
2862
|
|
|
2750
2863
|
:param datafeed_id: A numerical character string that uniquely identifies the
|
|
2751
2864
|
datafeed. This identifier can contain lowercase alphanumeric characters (a-z
|
|
@@ -2819,61 +2932,62 @@ class MlClient(NamespacedClient):
|
|
|
2819
2932
|
if datafeed_id in SKIP_IN_PATH:
|
|
2820
2933
|
raise ValueError("Empty value passed for parameter 'datafeed_id'")
|
|
2821
2934
|
__path = f"/_ml/datafeeds/{_quote(datafeed_id)}"
|
|
2822
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2823
2935
|
__query: t.Dict[str, t.Any] = {}
|
|
2824
|
-
if
|
|
2825
|
-
__body["aggregations"] = aggregations
|
|
2936
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2826
2937
|
if allow_no_indices is not None:
|
|
2827
2938
|
__query["allow_no_indices"] = allow_no_indices
|
|
2828
|
-
if chunking_config is not None:
|
|
2829
|
-
__body["chunking_config"] = chunking_config
|
|
2830
|
-
if delayed_data_check_config is not None:
|
|
2831
|
-
__body["delayed_data_check_config"] = delayed_data_check_config
|
|
2832
2939
|
if error_trace is not None:
|
|
2833
2940
|
__query["error_trace"] = error_trace
|
|
2834
2941
|
if expand_wildcards is not None:
|
|
2835
2942
|
__query["expand_wildcards"] = expand_wildcards
|
|
2836
2943
|
if filter_path is not None:
|
|
2837
2944
|
__query["filter_path"] = filter_path
|
|
2838
|
-
if frequency is not None:
|
|
2839
|
-
__body["frequency"] = frequency
|
|
2840
|
-
if headers is not None:
|
|
2841
|
-
__body["headers"] = headers
|
|
2842
2945
|
if human is not None:
|
|
2843
2946
|
__query["human"] = human
|
|
2844
2947
|
if ignore_throttled is not None:
|
|
2845
2948
|
__query["ignore_throttled"] = ignore_throttled
|
|
2846
2949
|
if ignore_unavailable is not None:
|
|
2847
2950
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
2848
|
-
if indexes is not None:
|
|
2849
|
-
__body["indexes"] = indexes
|
|
2850
|
-
if indices is not None:
|
|
2851
|
-
__body["indices"] = indices
|
|
2852
|
-
if indices_options is not None:
|
|
2853
|
-
__body["indices_options"] = indices_options
|
|
2854
|
-
if job_id is not None:
|
|
2855
|
-
__body["job_id"] = job_id
|
|
2856
|
-
if max_empty_searches is not None:
|
|
2857
|
-
__body["max_empty_searches"] = max_empty_searches
|
|
2858
2951
|
if pretty is not None:
|
|
2859
2952
|
__query["pretty"] = pretty
|
|
2860
|
-
if
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2953
|
+
if not __body:
|
|
2954
|
+
if aggregations is not None:
|
|
2955
|
+
__body["aggregations"] = aggregations
|
|
2956
|
+
if chunking_config is not None:
|
|
2957
|
+
__body["chunking_config"] = chunking_config
|
|
2958
|
+
if delayed_data_check_config is not None:
|
|
2959
|
+
__body["delayed_data_check_config"] = delayed_data_check_config
|
|
2960
|
+
if frequency is not None:
|
|
2961
|
+
__body["frequency"] = frequency
|
|
2962
|
+
if headers is not None:
|
|
2963
|
+
__body["headers"] = headers
|
|
2964
|
+
if indexes is not None:
|
|
2965
|
+
__body["indexes"] = indexes
|
|
2966
|
+
if indices is not None:
|
|
2967
|
+
__body["indices"] = indices
|
|
2968
|
+
if indices_options is not None:
|
|
2969
|
+
__body["indices_options"] = indices_options
|
|
2970
|
+
if job_id is not None:
|
|
2971
|
+
__body["job_id"] = job_id
|
|
2972
|
+
if max_empty_searches is not None:
|
|
2973
|
+
__body["max_empty_searches"] = max_empty_searches
|
|
2974
|
+
if query is not None:
|
|
2975
|
+
__body["query"] = query
|
|
2976
|
+
if query_delay is not None:
|
|
2977
|
+
__body["query_delay"] = query_delay
|
|
2978
|
+
if runtime_mappings is not None:
|
|
2979
|
+
__body["runtime_mappings"] = runtime_mappings
|
|
2980
|
+
if script_fields is not None:
|
|
2981
|
+
__body["script_fields"] = script_fields
|
|
2982
|
+
if scroll_size is not None:
|
|
2983
|
+
__body["scroll_size"] = scroll_size
|
|
2870
2984
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2871
2985
|
return await self.perform_request( # type: ignore[return-value]
|
|
2872
2986
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
2873
2987
|
)
|
|
2874
2988
|
|
|
2875
2989
|
@_rewrite_parameters(
|
|
2876
|
-
body_fields=
|
|
2990
|
+
body_fields=("description", "items"),
|
|
2877
2991
|
)
|
|
2878
2992
|
async def put_filter(
|
|
2879
2993
|
self,
|
|
@@ -2885,11 +2999,12 @@ class MlClient(NamespacedClient):
|
|
|
2885
2999
|
human: t.Optional[bool] = None,
|
|
2886
3000
|
items: t.Optional[t.Sequence[str]] = None,
|
|
2887
3001
|
pretty: t.Optional[bool] = None,
|
|
3002
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2888
3003
|
) -> ObjectApiResponse[t.Any]:
|
|
2889
3004
|
"""
|
|
2890
3005
|
Instantiates a filter.
|
|
2891
3006
|
|
|
2892
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3007
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-put-filter.html>`_
|
|
2893
3008
|
|
|
2894
3009
|
:param filter_id: A string that uniquely identifies a filter.
|
|
2895
3010
|
:param description: A description of the filter.
|
|
@@ -2899,34 +3014,51 @@ class MlClient(NamespacedClient):
|
|
|
2899
3014
|
if filter_id in SKIP_IN_PATH:
|
|
2900
3015
|
raise ValueError("Empty value passed for parameter 'filter_id'")
|
|
2901
3016
|
__path = f"/_ml/filters/{_quote(filter_id)}"
|
|
2902
|
-
__body: t.Dict[str, t.Any] = {}
|
|
2903
3017
|
__query: t.Dict[str, t.Any] = {}
|
|
2904
|
-
if
|
|
2905
|
-
__body["description"] = description
|
|
3018
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
2906
3019
|
if error_trace is not None:
|
|
2907
3020
|
__query["error_trace"] = error_trace
|
|
2908
3021
|
if filter_path is not None:
|
|
2909
3022
|
__query["filter_path"] = filter_path
|
|
2910
3023
|
if human is not None:
|
|
2911
3024
|
__query["human"] = human
|
|
2912
|
-
if items is not None:
|
|
2913
|
-
__body["items"] = items
|
|
2914
3025
|
if pretty is not None:
|
|
2915
3026
|
__query["pretty"] = pretty
|
|
3027
|
+
if not __body:
|
|
3028
|
+
if description is not None:
|
|
3029
|
+
__body["description"] = description
|
|
3030
|
+
if items is not None:
|
|
3031
|
+
__body["items"] = items
|
|
2916
3032
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
2917
3033
|
return await self.perform_request( # type: ignore[return-value]
|
|
2918
3034
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
2919
3035
|
)
|
|
2920
3036
|
|
|
2921
3037
|
@_rewrite_parameters(
|
|
2922
|
-
body_fields=
|
|
3038
|
+
body_fields=(
|
|
3039
|
+
"analysis_config",
|
|
3040
|
+
"data_description",
|
|
3041
|
+
"allow_lazy_open",
|
|
3042
|
+
"analysis_limits",
|
|
3043
|
+
"background_persist_interval",
|
|
3044
|
+
"custom_settings",
|
|
3045
|
+
"daily_model_snapshot_retention_after_days",
|
|
3046
|
+
"datafeed_config",
|
|
3047
|
+
"description",
|
|
3048
|
+
"groups",
|
|
3049
|
+
"model_plot_config",
|
|
3050
|
+
"model_snapshot_retention_days",
|
|
3051
|
+
"renormalization_window_days",
|
|
3052
|
+
"results_index_name",
|
|
3053
|
+
"results_retention_days",
|
|
3054
|
+
),
|
|
2923
3055
|
)
|
|
2924
3056
|
async def put_job(
|
|
2925
3057
|
self,
|
|
2926
3058
|
*,
|
|
2927
3059
|
job_id: str,
|
|
2928
|
-
analysis_config: t.Mapping[str, t.Any],
|
|
2929
|
-
data_description: t.Mapping[str, t.Any],
|
|
3060
|
+
analysis_config: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
3061
|
+
data_description: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2930
3062
|
allow_lazy_open: t.Optional[bool] = None,
|
|
2931
3063
|
analysis_limits: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
2932
3064
|
background_persist_interval: t.Optional[
|
|
@@ -2946,11 +3078,12 @@ class MlClient(NamespacedClient):
|
|
|
2946
3078
|
renormalization_window_days: t.Optional[int] = None,
|
|
2947
3079
|
results_index_name: t.Optional[str] = None,
|
|
2948
3080
|
results_retention_days: t.Optional[int] = None,
|
|
3081
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
2949
3082
|
) -> ObjectApiResponse[t.Any]:
|
|
2950
3083
|
"""
|
|
2951
3084
|
Instantiates an anomaly detection job.
|
|
2952
3085
|
|
|
2953
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3086
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-put-job.html>`_
|
|
2954
3087
|
|
|
2955
3088
|
:param job_id: The identifier for the anomaly detection job. This identifier
|
|
2956
3089
|
can contain lowercase alphanumeric characters (a-z and 0-9), hyphens, and
|
|
@@ -3027,60 +3160,72 @@ class MlClient(NamespacedClient):
|
|
|
3027
3160
|
"""
|
|
3028
3161
|
if job_id in SKIP_IN_PATH:
|
|
3029
3162
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
3030
|
-
if analysis_config is None:
|
|
3163
|
+
if analysis_config is None and body is None:
|
|
3031
3164
|
raise ValueError("Empty value passed for parameter 'analysis_config'")
|
|
3032
|
-
if data_description is None:
|
|
3165
|
+
if data_description is None and body is None:
|
|
3033
3166
|
raise ValueError("Empty value passed for parameter 'data_description'")
|
|
3034
3167
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}"
|
|
3035
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3036
3168
|
__query: t.Dict[str, t.Any] = {}
|
|
3037
|
-
if
|
|
3038
|
-
__body["analysis_config"] = analysis_config
|
|
3039
|
-
if data_description is not None:
|
|
3040
|
-
__body["data_description"] = data_description
|
|
3041
|
-
if allow_lazy_open is not None:
|
|
3042
|
-
__body["allow_lazy_open"] = allow_lazy_open
|
|
3043
|
-
if analysis_limits is not None:
|
|
3044
|
-
__body["analysis_limits"] = analysis_limits
|
|
3045
|
-
if background_persist_interval is not None:
|
|
3046
|
-
__body["background_persist_interval"] = background_persist_interval
|
|
3047
|
-
if custom_settings is not None:
|
|
3048
|
-
__body["custom_settings"] = custom_settings
|
|
3049
|
-
if daily_model_snapshot_retention_after_days is not None:
|
|
3050
|
-
__body[
|
|
3051
|
-
"daily_model_snapshot_retention_after_days"
|
|
3052
|
-
] = daily_model_snapshot_retention_after_days
|
|
3053
|
-
if datafeed_config is not None:
|
|
3054
|
-
__body["datafeed_config"] = datafeed_config
|
|
3055
|
-
if description is not None:
|
|
3056
|
-
__body["description"] = description
|
|
3169
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3057
3170
|
if error_trace is not None:
|
|
3058
3171
|
__query["error_trace"] = error_trace
|
|
3059
3172
|
if filter_path is not None:
|
|
3060
3173
|
__query["filter_path"] = filter_path
|
|
3061
|
-
if groups is not None:
|
|
3062
|
-
__body["groups"] = groups
|
|
3063
3174
|
if human is not None:
|
|
3064
3175
|
__query["human"] = human
|
|
3065
|
-
if model_plot_config is not None:
|
|
3066
|
-
__body["model_plot_config"] = model_plot_config
|
|
3067
|
-
if model_snapshot_retention_days is not None:
|
|
3068
|
-
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
3069
3176
|
if pretty is not None:
|
|
3070
3177
|
__query["pretty"] = pretty
|
|
3071
|
-
if
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3178
|
+
if not __body:
|
|
3179
|
+
if analysis_config is not None:
|
|
3180
|
+
__body["analysis_config"] = analysis_config
|
|
3181
|
+
if data_description is not None:
|
|
3182
|
+
__body["data_description"] = data_description
|
|
3183
|
+
if allow_lazy_open is not None:
|
|
3184
|
+
__body["allow_lazy_open"] = allow_lazy_open
|
|
3185
|
+
if analysis_limits is not None:
|
|
3186
|
+
__body["analysis_limits"] = analysis_limits
|
|
3187
|
+
if background_persist_interval is not None:
|
|
3188
|
+
__body["background_persist_interval"] = background_persist_interval
|
|
3189
|
+
if custom_settings is not None:
|
|
3190
|
+
__body["custom_settings"] = custom_settings
|
|
3191
|
+
if daily_model_snapshot_retention_after_days is not None:
|
|
3192
|
+
__body[
|
|
3193
|
+
"daily_model_snapshot_retention_after_days"
|
|
3194
|
+
] = daily_model_snapshot_retention_after_days
|
|
3195
|
+
if datafeed_config is not None:
|
|
3196
|
+
__body["datafeed_config"] = datafeed_config
|
|
3197
|
+
if description is not None:
|
|
3198
|
+
__body["description"] = description
|
|
3199
|
+
if groups is not None:
|
|
3200
|
+
__body["groups"] = groups
|
|
3201
|
+
if model_plot_config is not None:
|
|
3202
|
+
__body["model_plot_config"] = model_plot_config
|
|
3203
|
+
if model_snapshot_retention_days is not None:
|
|
3204
|
+
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
3205
|
+
if renormalization_window_days is not None:
|
|
3206
|
+
__body["renormalization_window_days"] = renormalization_window_days
|
|
3207
|
+
if results_index_name is not None:
|
|
3208
|
+
__body["results_index_name"] = results_index_name
|
|
3209
|
+
if results_retention_days is not None:
|
|
3210
|
+
__body["results_retention_days"] = results_retention_days
|
|
3077
3211
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3078
3212
|
return await self.perform_request( # type: ignore[return-value]
|
|
3079
3213
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
3080
3214
|
)
|
|
3081
3215
|
|
|
3082
3216
|
@_rewrite_parameters(
|
|
3083
|
-
body_fields=
|
|
3217
|
+
body_fields=(
|
|
3218
|
+
"compressed_definition",
|
|
3219
|
+
"definition",
|
|
3220
|
+
"description",
|
|
3221
|
+
"inference_config",
|
|
3222
|
+
"input",
|
|
3223
|
+
"metadata",
|
|
3224
|
+
"model_size_bytes",
|
|
3225
|
+
"model_type",
|
|
3226
|
+
"platform_architecture",
|
|
3227
|
+
"tags",
|
|
3228
|
+
),
|
|
3084
3229
|
)
|
|
3085
3230
|
async def put_trained_model(
|
|
3086
3231
|
self,
|
|
@@ -3103,11 +3248,12 @@ class MlClient(NamespacedClient):
|
|
|
3103
3248
|
platform_architecture: t.Optional[str] = None,
|
|
3104
3249
|
pretty: t.Optional[bool] = None,
|
|
3105
3250
|
tags: t.Optional[t.Sequence[str]] = None,
|
|
3251
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3106
3252
|
) -> ObjectApiResponse[t.Any]:
|
|
3107
3253
|
"""
|
|
3108
3254
|
Creates an inference trained model.
|
|
3109
3255
|
|
|
3110
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3256
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-trained-models.html>`_
|
|
3111
3257
|
|
|
3112
3258
|
:param model_id: The unique identifier of the trained model.
|
|
3113
3259
|
:param compressed_definition: The compressed (GZipped and Base64 encoded) inference
|
|
@@ -3142,38 +3288,39 @@ class MlClient(NamespacedClient):
|
|
|
3142
3288
|
if model_id in SKIP_IN_PATH:
|
|
3143
3289
|
raise ValueError("Empty value passed for parameter 'model_id'")
|
|
3144
3290
|
__path = f"/_ml/trained_models/{_quote(model_id)}"
|
|
3145
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3146
3291
|
__query: t.Dict[str, t.Any] = {}
|
|
3147
|
-
if
|
|
3148
|
-
__body["compressed_definition"] = compressed_definition
|
|
3292
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3149
3293
|
if defer_definition_decompression is not None:
|
|
3150
3294
|
__query["defer_definition_decompression"] = defer_definition_decompression
|
|
3151
|
-
if definition is not None:
|
|
3152
|
-
__body["definition"] = definition
|
|
3153
|
-
if description is not None:
|
|
3154
|
-
__body["description"] = description
|
|
3155
3295
|
if error_trace is not None:
|
|
3156
3296
|
__query["error_trace"] = error_trace
|
|
3157
3297
|
if filter_path is not None:
|
|
3158
3298
|
__query["filter_path"] = filter_path
|
|
3159
3299
|
if human is not None:
|
|
3160
3300
|
__query["human"] = human
|
|
3161
|
-
if inference_config is not None:
|
|
3162
|
-
__body["inference_config"] = inference_config
|
|
3163
|
-
if input is not None:
|
|
3164
|
-
__body["input"] = input
|
|
3165
|
-
if metadata is not None:
|
|
3166
|
-
__body["metadata"] = metadata
|
|
3167
|
-
if model_size_bytes is not None:
|
|
3168
|
-
__body["model_size_bytes"] = model_size_bytes
|
|
3169
|
-
if model_type is not None:
|
|
3170
|
-
__body["model_type"] = model_type
|
|
3171
|
-
if platform_architecture is not None:
|
|
3172
|
-
__body["platform_architecture"] = platform_architecture
|
|
3173
3301
|
if pretty is not None:
|
|
3174
3302
|
__query["pretty"] = pretty
|
|
3175
|
-
if
|
|
3176
|
-
|
|
3303
|
+
if not __body:
|
|
3304
|
+
if compressed_definition is not None:
|
|
3305
|
+
__body["compressed_definition"] = compressed_definition
|
|
3306
|
+
if definition is not None:
|
|
3307
|
+
__body["definition"] = definition
|
|
3308
|
+
if description is not None:
|
|
3309
|
+
__body["description"] = description
|
|
3310
|
+
if inference_config is not None:
|
|
3311
|
+
__body["inference_config"] = inference_config
|
|
3312
|
+
if input is not None:
|
|
3313
|
+
__body["input"] = input
|
|
3314
|
+
if metadata is not None:
|
|
3315
|
+
__body["metadata"] = metadata
|
|
3316
|
+
if model_size_bytes is not None:
|
|
3317
|
+
__body["model_size_bytes"] = model_size_bytes
|
|
3318
|
+
if model_type is not None:
|
|
3319
|
+
__body["model_type"] = model_type
|
|
3320
|
+
if platform_architecture is not None:
|
|
3321
|
+
__body["platform_architecture"] = platform_architecture
|
|
3322
|
+
if tags is not None:
|
|
3323
|
+
__body["tags"] = tags
|
|
3177
3324
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3178
3325
|
return await self.perform_request( # type: ignore[return-value]
|
|
3179
3326
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
@@ -3195,7 +3342,7 @@ class MlClient(NamespacedClient):
|
|
|
3195
3342
|
Creates a new model alias (or reassigns an existing one) to refer to the trained
|
|
3196
3343
|
model
|
|
3197
3344
|
|
|
3198
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3345
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-trained-models-aliases.html>`_
|
|
3199
3346
|
|
|
3200
3347
|
:param model_id: The identifier for the trained model that the alias refers to.
|
|
3201
3348
|
:param model_alias: The alias to create or update. This value cannot end in numbers.
|
|
@@ -3225,25 +3372,26 @@ class MlClient(NamespacedClient):
|
|
|
3225
3372
|
)
|
|
3226
3373
|
|
|
3227
3374
|
@_rewrite_parameters(
|
|
3228
|
-
body_fields=
|
|
3375
|
+
body_fields=("definition", "total_definition_length", "total_parts"),
|
|
3229
3376
|
)
|
|
3230
3377
|
async def put_trained_model_definition_part(
|
|
3231
3378
|
self,
|
|
3232
3379
|
*,
|
|
3233
3380
|
model_id: str,
|
|
3234
3381
|
part: int,
|
|
3235
|
-
definition: str,
|
|
3236
|
-
total_definition_length: int,
|
|
3237
|
-
total_parts: int,
|
|
3382
|
+
definition: t.Optional[str] = None,
|
|
3383
|
+
total_definition_length: t.Optional[int] = None,
|
|
3384
|
+
total_parts: t.Optional[int] = None,
|
|
3238
3385
|
error_trace: t.Optional[bool] = None,
|
|
3239
3386
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
3240
3387
|
human: t.Optional[bool] = None,
|
|
3241
3388
|
pretty: t.Optional[bool] = None,
|
|
3389
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3242
3390
|
) -> ObjectApiResponse[t.Any]:
|
|
3243
3391
|
"""
|
|
3244
3392
|
Creates part of a trained model definition
|
|
3245
3393
|
|
|
3246
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3394
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-trained-model-definition-part.html>`_
|
|
3247
3395
|
|
|
3248
3396
|
:param model_id: The unique identifier of the trained model.
|
|
3249
3397
|
:param part: The definition part number. When the definition is loaded for inference
|
|
@@ -3260,23 +3408,17 @@ class MlClient(NamespacedClient):
|
|
|
3260
3408
|
raise ValueError("Empty value passed for parameter 'model_id'")
|
|
3261
3409
|
if part in SKIP_IN_PATH:
|
|
3262
3410
|
raise ValueError("Empty value passed for parameter 'part'")
|
|
3263
|
-
if definition is None:
|
|
3411
|
+
if definition is None and body is None:
|
|
3264
3412
|
raise ValueError("Empty value passed for parameter 'definition'")
|
|
3265
|
-
if total_definition_length is None:
|
|
3413
|
+
if total_definition_length is None and body is None:
|
|
3266
3414
|
raise ValueError(
|
|
3267
3415
|
"Empty value passed for parameter 'total_definition_length'"
|
|
3268
3416
|
)
|
|
3269
|
-
if total_parts is None:
|
|
3417
|
+
if total_parts is None and body is None:
|
|
3270
3418
|
raise ValueError("Empty value passed for parameter 'total_parts'")
|
|
3271
3419
|
__path = f"/_ml/trained_models/{_quote(model_id)}/definition/{_quote(part)}"
|
|
3272
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3273
3420
|
__query: t.Dict[str, t.Any] = {}
|
|
3274
|
-
if
|
|
3275
|
-
__body["definition"] = definition
|
|
3276
|
-
if total_definition_length is not None:
|
|
3277
|
-
__body["total_definition_length"] = total_definition_length
|
|
3278
|
-
if total_parts is not None:
|
|
3279
|
-
__body["total_parts"] = total_parts
|
|
3421
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3280
3422
|
if error_trace is not None:
|
|
3281
3423
|
__query["error_trace"] = error_trace
|
|
3282
3424
|
if filter_path is not None:
|
|
@@ -3285,30 +3427,38 @@ class MlClient(NamespacedClient):
|
|
|
3285
3427
|
__query["human"] = human
|
|
3286
3428
|
if pretty is not None:
|
|
3287
3429
|
__query["pretty"] = pretty
|
|
3430
|
+
if not __body:
|
|
3431
|
+
if definition is not None:
|
|
3432
|
+
__body["definition"] = definition
|
|
3433
|
+
if total_definition_length is not None:
|
|
3434
|
+
__body["total_definition_length"] = total_definition_length
|
|
3435
|
+
if total_parts is not None:
|
|
3436
|
+
__body["total_parts"] = total_parts
|
|
3288
3437
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3289
3438
|
return await self.perform_request( # type: ignore[return-value]
|
|
3290
3439
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
3291
3440
|
)
|
|
3292
3441
|
|
|
3293
3442
|
@_rewrite_parameters(
|
|
3294
|
-
body_fields=
|
|
3443
|
+
body_fields=("vocabulary", "merges", "scores"),
|
|
3295
3444
|
)
|
|
3296
3445
|
async def put_trained_model_vocabulary(
|
|
3297
3446
|
self,
|
|
3298
3447
|
*,
|
|
3299
3448
|
model_id: str,
|
|
3300
|
-
vocabulary: t.Sequence[str],
|
|
3449
|
+
vocabulary: t.Optional[t.Sequence[str]] = None,
|
|
3301
3450
|
error_trace: t.Optional[bool] = None,
|
|
3302
3451
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
3303
3452
|
human: t.Optional[bool] = None,
|
|
3304
3453
|
merges: t.Optional[t.Sequence[str]] = None,
|
|
3305
3454
|
pretty: t.Optional[bool] = None,
|
|
3306
3455
|
scores: t.Optional[t.Sequence[float]] = None,
|
|
3456
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3307
3457
|
) -> ObjectApiResponse[t.Any]:
|
|
3308
3458
|
"""
|
|
3309
3459
|
Creates a trained model vocabulary
|
|
3310
3460
|
|
|
3311
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3461
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-trained-model-vocabulary.html>`_
|
|
3312
3462
|
|
|
3313
3463
|
:param model_id: The unique identifier of the trained model.
|
|
3314
3464
|
:param vocabulary: The model vocabulary, which must not be empty.
|
|
@@ -3317,25 +3467,26 @@ class MlClient(NamespacedClient):
|
|
|
3317
3467
|
"""
|
|
3318
3468
|
if model_id in SKIP_IN_PATH:
|
|
3319
3469
|
raise ValueError("Empty value passed for parameter 'model_id'")
|
|
3320
|
-
if vocabulary is None:
|
|
3470
|
+
if vocabulary is None and body is None:
|
|
3321
3471
|
raise ValueError("Empty value passed for parameter 'vocabulary'")
|
|
3322
3472
|
__path = f"/_ml/trained_models/{_quote(model_id)}/vocabulary"
|
|
3323
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3324
3473
|
__query: t.Dict[str, t.Any] = {}
|
|
3325
|
-
if
|
|
3326
|
-
__body["vocabulary"] = vocabulary
|
|
3474
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3327
3475
|
if error_trace is not None:
|
|
3328
3476
|
__query["error_trace"] = error_trace
|
|
3329
3477
|
if filter_path is not None:
|
|
3330
3478
|
__query["filter_path"] = filter_path
|
|
3331
3479
|
if human is not None:
|
|
3332
3480
|
__query["human"] = human
|
|
3333
|
-
if merges is not None:
|
|
3334
|
-
__body["merges"] = merges
|
|
3335
3481
|
if pretty is not None:
|
|
3336
3482
|
__query["pretty"] = pretty
|
|
3337
|
-
if
|
|
3338
|
-
|
|
3483
|
+
if not __body:
|
|
3484
|
+
if vocabulary is not None:
|
|
3485
|
+
__body["vocabulary"] = vocabulary
|
|
3486
|
+
if merges is not None:
|
|
3487
|
+
__body["merges"] = merges
|
|
3488
|
+
if scores is not None:
|
|
3489
|
+
__body["scores"] = scores
|
|
3339
3490
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3340
3491
|
return await self.perform_request( # type: ignore[return-value]
|
|
3341
3492
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
@@ -3356,7 +3507,7 @@ class MlClient(NamespacedClient):
|
|
|
3356
3507
|
"""
|
|
3357
3508
|
Resets an existing anomaly detection job.
|
|
3358
3509
|
|
|
3359
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3510
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-reset-job.html>`_
|
|
3360
3511
|
|
|
3361
3512
|
:param job_id: The ID of the job to reset.
|
|
3362
3513
|
:param delete_user_annotations: Specifies whether annotations that have been
|
|
@@ -3387,7 +3538,7 @@ class MlClient(NamespacedClient):
|
|
|
3387
3538
|
)
|
|
3388
3539
|
|
|
3389
3540
|
@_rewrite_parameters(
|
|
3390
|
-
body_fields=
|
|
3541
|
+
body_fields=("delete_intervening_results",),
|
|
3391
3542
|
)
|
|
3392
3543
|
async def revert_model_snapshot(
|
|
3393
3544
|
self,
|
|
@@ -3399,11 +3550,12 @@ class MlClient(NamespacedClient):
|
|
|
3399
3550
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
3400
3551
|
human: t.Optional[bool] = None,
|
|
3401
3552
|
pretty: t.Optional[bool] = None,
|
|
3553
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3402
3554
|
) -> ObjectApiResponse[t.Any]:
|
|
3403
3555
|
"""
|
|
3404
3556
|
Reverts to a specific snapshot.
|
|
3405
3557
|
|
|
3406
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3558
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-revert-snapshot.html>`_
|
|
3407
3559
|
|
|
3408
3560
|
:param job_id: Identifier for the anomaly detection job.
|
|
3409
3561
|
:param snapshot_id: You can specify `empty` as the <snapshot_id>. Reverting to
|
|
@@ -3417,10 +3569,8 @@ class MlClient(NamespacedClient):
|
|
|
3417
3569
|
if snapshot_id in SKIP_IN_PATH:
|
|
3418
3570
|
raise ValueError("Empty value passed for parameter 'snapshot_id'")
|
|
3419
3571
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_revert"
|
|
3420
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3421
3572
|
__query: t.Dict[str, t.Any] = {}
|
|
3422
|
-
if
|
|
3423
|
-
__body["delete_intervening_results"] = delete_intervening_results
|
|
3573
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3424
3574
|
if error_trace is not None:
|
|
3425
3575
|
__query["error_trace"] = error_trace
|
|
3426
3576
|
if filter_path is not None:
|
|
@@ -3429,6 +3579,9 @@ class MlClient(NamespacedClient):
|
|
|
3429
3579
|
__query["human"] = human
|
|
3430
3580
|
if pretty is not None:
|
|
3431
3581
|
__query["pretty"] = pretty
|
|
3582
|
+
if not __body:
|
|
3583
|
+
if delete_intervening_results is not None:
|
|
3584
|
+
__body["delete_intervening_results"] = delete_intervening_results
|
|
3432
3585
|
if not __body:
|
|
3433
3586
|
__body = None # type: ignore[assignment]
|
|
3434
3587
|
__headers = {"accept": "application/json"}
|
|
@@ -3453,7 +3606,7 @@ class MlClient(NamespacedClient):
|
|
|
3453
3606
|
Sets a cluster wide upgrade_mode setting that prepares machine learning indices
|
|
3454
3607
|
for an upgrade.
|
|
3455
3608
|
|
|
3456
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3609
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-set-upgrade-mode.html>`_
|
|
3457
3610
|
|
|
3458
3611
|
:param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
|
|
3459
3612
|
all job and datafeed tasks and prohibits new job and datafeed tasks from
|
|
@@ -3493,7 +3646,7 @@ class MlClient(NamespacedClient):
|
|
|
3493
3646
|
"""
|
|
3494
3647
|
Starts a data frame analytics job.
|
|
3495
3648
|
|
|
3496
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3649
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/start-dfanalytics.html>`_
|
|
3497
3650
|
|
|
3498
3651
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
3499
3652
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -3521,7 +3674,7 @@ class MlClient(NamespacedClient):
|
|
|
3521
3674
|
)
|
|
3522
3675
|
|
|
3523
3676
|
@_rewrite_parameters(
|
|
3524
|
-
body_fields=
|
|
3677
|
+
body_fields=("end", "start", "timeout"),
|
|
3525
3678
|
)
|
|
3526
3679
|
async def start_datafeed(
|
|
3527
3680
|
self,
|
|
@@ -3534,11 +3687,12 @@ class MlClient(NamespacedClient):
|
|
|
3534
3687
|
pretty: t.Optional[bool] = None,
|
|
3535
3688
|
start: t.Optional[t.Union[str, t.Any]] = None,
|
|
3536
3689
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
3690
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3537
3691
|
) -> ObjectApiResponse[t.Any]:
|
|
3538
3692
|
"""
|
|
3539
3693
|
Starts one or more datafeeds.
|
|
3540
3694
|
|
|
3541
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3695
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-start-datafeed.html>`_
|
|
3542
3696
|
|
|
3543
3697
|
:param datafeed_id: A numerical character string that uniquely identifies the
|
|
3544
3698
|
datafeed. This identifier can contain lowercase alphanumeric characters (a-z
|
|
@@ -3551,10 +3705,8 @@ class MlClient(NamespacedClient):
|
|
|
3551
3705
|
if datafeed_id in SKIP_IN_PATH:
|
|
3552
3706
|
raise ValueError("Empty value passed for parameter 'datafeed_id'")
|
|
3553
3707
|
__path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_start"
|
|
3554
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3555
3708
|
__query: t.Dict[str, t.Any] = {}
|
|
3556
|
-
if
|
|
3557
|
-
__body["end"] = end
|
|
3709
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3558
3710
|
if error_trace is not None:
|
|
3559
3711
|
__query["error_trace"] = error_trace
|
|
3560
3712
|
if filter_path is not None:
|
|
@@ -3563,10 +3715,13 @@ class MlClient(NamespacedClient):
|
|
|
3563
3715
|
__query["human"] = human
|
|
3564
3716
|
if pretty is not None:
|
|
3565
3717
|
__query["pretty"] = pretty
|
|
3566
|
-
if
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3718
|
+
if not __body:
|
|
3719
|
+
if end is not None:
|
|
3720
|
+
__body["end"] = end
|
|
3721
|
+
if start is not None:
|
|
3722
|
+
__body["start"] = start
|
|
3723
|
+
if timeout is not None:
|
|
3724
|
+
__body["timeout"] = timeout
|
|
3570
3725
|
if not __body:
|
|
3571
3726
|
__body = None # type: ignore[assignment]
|
|
3572
3727
|
__headers = {"accept": "application/json"}
|
|
@@ -3582,6 +3737,7 @@ class MlClient(NamespacedClient):
|
|
|
3582
3737
|
*,
|
|
3583
3738
|
model_id: str,
|
|
3584
3739
|
cache_size: t.Optional[t.Union[int, str]] = None,
|
|
3740
|
+
deployment_id: t.Optional[str] = None,
|
|
3585
3741
|
error_trace: t.Optional[bool] = None,
|
|
3586
3742
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
3587
3743
|
human: t.Optional[bool] = None,
|
|
@@ -3598,13 +3754,14 @@ class MlClient(NamespacedClient):
|
|
|
3598
3754
|
"""
|
|
3599
3755
|
Start a trained model deployment.
|
|
3600
3756
|
|
|
3601
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3757
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/start-trained-model-deployment.html>`_
|
|
3602
3758
|
|
|
3603
3759
|
:param model_id: The unique identifier of the trained model. Currently, only
|
|
3604
3760
|
PyTorch models are supported.
|
|
3605
3761
|
:param cache_size: The inference cache size (in memory outside the JVM heap)
|
|
3606
3762
|
per node for the model. The default value is the same size as the `model_size_bytes`.
|
|
3607
3763
|
To disable the cache, `0b` can be provided.
|
|
3764
|
+
:param deployment_id: A unique identifier for the deployment of the model.
|
|
3608
3765
|
:param number_of_allocations: The number of model allocations on each node where
|
|
3609
3766
|
the model is deployed. All allocations on a node share the same copy of the
|
|
3610
3767
|
model in memory but use a separate set of threads to evaluate the model.
|
|
@@ -3631,6 +3788,8 @@ class MlClient(NamespacedClient):
|
|
|
3631
3788
|
__query: t.Dict[str, t.Any] = {}
|
|
3632
3789
|
if cache_size is not None:
|
|
3633
3790
|
__query["cache_size"] = cache_size
|
|
3791
|
+
if deployment_id is not None:
|
|
3792
|
+
__query["deployment_id"] = deployment_id
|
|
3634
3793
|
if error_trace is not None:
|
|
3635
3794
|
__query["error_trace"] = error_trace
|
|
3636
3795
|
if filter_path is not None:
|
|
@@ -3672,7 +3831,7 @@ class MlClient(NamespacedClient):
|
|
|
3672
3831
|
"""
|
|
3673
3832
|
Stops one or more data frame analytics jobs.
|
|
3674
3833
|
|
|
3675
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3834
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/stop-dfanalytics.html>`_
|
|
3676
3835
|
|
|
3677
3836
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
3678
3837
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -3713,7 +3872,7 @@ class MlClient(NamespacedClient):
|
|
|
3713
3872
|
)
|
|
3714
3873
|
|
|
3715
3874
|
@_rewrite_parameters(
|
|
3716
|
-
body_fields=
|
|
3875
|
+
body_fields=("allow_no_match", "force", "timeout"),
|
|
3717
3876
|
)
|
|
3718
3877
|
async def stop_datafeed(
|
|
3719
3878
|
self,
|
|
@@ -3726,11 +3885,12 @@ class MlClient(NamespacedClient):
|
|
|
3726
3885
|
human: t.Optional[bool] = None,
|
|
3727
3886
|
pretty: t.Optional[bool] = None,
|
|
3728
3887
|
timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
|
|
3888
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3729
3889
|
) -> ObjectApiResponse[t.Any]:
|
|
3730
3890
|
"""
|
|
3731
3891
|
Stops one or more datafeeds.
|
|
3732
3892
|
|
|
3733
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3893
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-stop-datafeed.html>`_
|
|
3734
3894
|
|
|
3735
3895
|
:param datafeed_id: Identifier for the datafeed. You can stop multiple datafeeds
|
|
3736
3896
|
in a single API request by using a comma-separated list of datafeeds or a
|
|
@@ -3744,22 +3904,23 @@ class MlClient(NamespacedClient):
|
|
|
3744
3904
|
if datafeed_id in SKIP_IN_PATH:
|
|
3745
3905
|
raise ValueError("Empty value passed for parameter 'datafeed_id'")
|
|
3746
3906
|
__path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_stop"
|
|
3747
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3748
3907
|
__query: t.Dict[str, t.Any] = {}
|
|
3749
|
-
if
|
|
3750
|
-
__body["allow_no_match"] = allow_no_match
|
|
3908
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3751
3909
|
if error_trace is not None:
|
|
3752
3910
|
__query["error_trace"] = error_trace
|
|
3753
3911
|
if filter_path is not None:
|
|
3754
3912
|
__query["filter_path"] = filter_path
|
|
3755
|
-
if force is not None:
|
|
3756
|
-
__body["force"] = force
|
|
3757
3913
|
if human is not None:
|
|
3758
3914
|
__query["human"] = human
|
|
3759
3915
|
if pretty is not None:
|
|
3760
3916
|
__query["pretty"] = pretty
|
|
3761
|
-
if
|
|
3762
|
-
|
|
3917
|
+
if not __body:
|
|
3918
|
+
if allow_no_match is not None:
|
|
3919
|
+
__body["allow_no_match"] = allow_no_match
|
|
3920
|
+
if force is not None:
|
|
3921
|
+
__body["force"] = force
|
|
3922
|
+
if timeout is not None:
|
|
3923
|
+
__body["timeout"] = timeout
|
|
3763
3924
|
if not __body:
|
|
3764
3925
|
__body = None # type: ignore[assignment]
|
|
3765
3926
|
__headers = {"accept": "application/json"}
|
|
@@ -3784,7 +3945,7 @@ class MlClient(NamespacedClient):
|
|
|
3784
3945
|
"""
|
|
3785
3946
|
Stop a trained model deployment.
|
|
3786
3947
|
|
|
3787
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
3948
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/stop-trained-model-deployment.html>`_
|
|
3788
3949
|
|
|
3789
3950
|
:param model_id: The unique identifier of the trained model.
|
|
3790
3951
|
:param allow_no_match: Specifies what to do when the request: contains wildcard
|
|
@@ -3819,7 +3980,12 @@ class MlClient(NamespacedClient):
|
|
|
3819
3980
|
)
|
|
3820
3981
|
|
|
3821
3982
|
@_rewrite_parameters(
|
|
3822
|
-
body_fields=
|
|
3983
|
+
body_fields=(
|
|
3984
|
+
"allow_lazy_start",
|
|
3985
|
+
"description",
|
|
3986
|
+
"max_num_threads",
|
|
3987
|
+
"model_memory_limit",
|
|
3988
|
+
),
|
|
3823
3989
|
)
|
|
3824
3990
|
async def update_data_frame_analytics(
|
|
3825
3991
|
self,
|
|
@@ -3833,11 +3999,12 @@ class MlClient(NamespacedClient):
|
|
|
3833
3999
|
max_num_threads: t.Optional[int] = None,
|
|
3834
4000
|
model_memory_limit: t.Optional[str] = None,
|
|
3835
4001
|
pretty: t.Optional[bool] = None,
|
|
4002
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3836
4003
|
) -> ObjectApiResponse[t.Any]:
|
|
3837
4004
|
"""
|
|
3838
4005
|
Updates certain properties of a data frame analytics job.
|
|
3839
4006
|
|
|
3840
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4007
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/update-dfanalytics.html>`_
|
|
3841
4008
|
|
|
3842
4009
|
:param id: Identifier for the data frame analytics job. This identifier can contain
|
|
3843
4010
|
lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
|
|
@@ -3858,31 +4025,47 @@ class MlClient(NamespacedClient):
|
|
|
3858
4025
|
if id in SKIP_IN_PATH:
|
|
3859
4026
|
raise ValueError("Empty value passed for parameter 'id'")
|
|
3860
4027
|
__path = f"/_ml/data_frame/analytics/{_quote(id)}/_update"
|
|
3861
|
-
__body: t.Dict[str, t.Any] = {}
|
|
3862
4028
|
__query: t.Dict[str, t.Any] = {}
|
|
3863
|
-
if
|
|
3864
|
-
__body["allow_lazy_start"] = allow_lazy_start
|
|
3865
|
-
if description is not None:
|
|
3866
|
-
__body["description"] = description
|
|
4029
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
3867
4030
|
if error_trace is not None:
|
|
3868
4031
|
__query["error_trace"] = error_trace
|
|
3869
4032
|
if filter_path is not None:
|
|
3870
4033
|
__query["filter_path"] = filter_path
|
|
3871
4034
|
if human is not None:
|
|
3872
4035
|
__query["human"] = human
|
|
3873
|
-
if max_num_threads is not None:
|
|
3874
|
-
__body["max_num_threads"] = max_num_threads
|
|
3875
|
-
if model_memory_limit is not None:
|
|
3876
|
-
__body["model_memory_limit"] = model_memory_limit
|
|
3877
4036
|
if pretty is not None:
|
|
3878
4037
|
__query["pretty"] = pretty
|
|
4038
|
+
if not __body:
|
|
4039
|
+
if allow_lazy_start is not None:
|
|
4040
|
+
__body["allow_lazy_start"] = allow_lazy_start
|
|
4041
|
+
if description is not None:
|
|
4042
|
+
__body["description"] = description
|
|
4043
|
+
if max_num_threads is not None:
|
|
4044
|
+
__body["max_num_threads"] = max_num_threads
|
|
4045
|
+
if model_memory_limit is not None:
|
|
4046
|
+
__body["model_memory_limit"] = model_memory_limit
|
|
3879
4047
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
3880
4048
|
return await self.perform_request( # type: ignore[return-value]
|
|
3881
4049
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
3882
4050
|
)
|
|
3883
4051
|
|
|
3884
4052
|
@_rewrite_parameters(
|
|
3885
|
-
body_fields=
|
|
4053
|
+
body_fields=(
|
|
4054
|
+
"aggregations",
|
|
4055
|
+
"chunking_config",
|
|
4056
|
+
"delayed_data_check_config",
|
|
4057
|
+
"frequency",
|
|
4058
|
+
"indexes",
|
|
4059
|
+
"indices",
|
|
4060
|
+
"indices_options",
|
|
4061
|
+
"job_id",
|
|
4062
|
+
"max_empty_searches",
|
|
4063
|
+
"query",
|
|
4064
|
+
"query_delay",
|
|
4065
|
+
"runtime_mappings",
|
|
4066
|
+
"script_fields",
|
|
4067
|
+
"scroll_size",
|
|
4068
|
+
),
|
|
3886
4069
|
)
|
|
3887
4070
|
async def update_datafeed(
|
|
3888
4071
|
self,
|
|
@@ -3917,11 +4100,12 @@ class MlClient(NamespacedClient):
|
|
|
3917
4100
|
runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
|
|
3918
4101
|
script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
|
|
3919
4102
|
scroll_size: t.Optional[int] = None,
|
|
4103
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
3920
4104
|
) -> ObjectApiResponse[t.Any]:
|
|
3921
4105
|
"""
|
|
3922
4106
|
Updates certain properties of a datafeed.
|
|
3923
4107
|
|
|
3924
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4108
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-update-datafeed.html>`_
|
|
3925
4109
|
|
|
3926
4110
|
:param datafeed_id: A numerical character string that uniquely identifies the
|
|
3927
4111
|
datafeed. This identifier can contain lowercase alphanumeric characters (a-z
|
|
@@ -4006,59 +4190,60 @@ class MlClient(NamespacedClient):
|
|
|
4006
4190
|
if datafeed_id in SKIP_IN_PATH:
|
|
4007
4191
|
raise ValueError("Empty value passed for parameter 'datafeed_id'")
|
|
4008
4192
|
__path = f"/_ml/datafeeds/{_quote(datafeed_id)}/_update"
|
|
4009
|
-
__body: t.Dict[str, t.Any] = {}
|
|
4010
4193
|
__query: t.Dict[str, t.Any] = {}
|
|
4011
|
-
if
|
|
4012
|
-
__body["aggregations"] = aggregations
|
|
4194
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4013
4195
|
if allow_no_indices is not None:
|
|
4014
4196
|
__query["allow_no_indices"] = allow_no_indices
|
|
4015
|
-
if chunking_config is not None:
|
|
4016
|
-
__body["chunking_config"] = chunking_config
|
|
4017
|
-
if delayed_data_check_config is not None:
|
|
4018
|
-
__body["delayed_data_check_config"] = delayed_data_check_config
|
|
4019
4197
|
if error_trace is not None:
|
|
4020
4198
|
__query["error_trace"] = error_trace
|
|
4021
4199
|
if expand_wildcards is not None:
|
|
4022
4200
|
__query["expand_wildcards"] = expand_wildcards
|
|
4023
4201
|
if filter_path is not None:
|
|
4024
4202
|
__query["filter_path"] = filter_path
|
|
4025
|
-
if frequency is not None:
|
|
4026
|
-
__body["frequency"] = frequency
|
|
4027
4203
|
if human is not None:
|
|
4028
4204
|
__query["human"] = human
|
|
4029
4205
|
if ignore_throttled is not None:
|
|
4030
4206
|
__query["ignore_throttled"] = ignore_throttled
|
|
4031
4207
|
if ignore_unavailable is not None:
|
|
4032
4208
|
__query["ignore_unavailable"] = ignore_unavailable
|
|
4033
|
-
if indexes is not None:
|
|
4034
|
-
__body["indexes"] = indexes
|
|
4035
|
-
if indices is not None:
|
|
4036
|
-
__body["indices"] = indices
|
|
4037
|
-
if indices_options is not None:
|
|
4038
|
-
__body["indices_options"] = indices_options
|
|
4039
|
-
if job_id is not None:
|
|
4040
|
-
__body["job_id"] = job_id
|
|
4041
|
-
if max_empty_searches is not None:
|
|
4042
|
-
__body["max_empty_searches"] = max_empty_searches
|
|
4043
4209
|
if pretty is not None:
|
|
4044
4210
|
__query["pretty"] = pretty
|
|
4045
|
-
if
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4211
|
+
if not __body:
|
|
4212
|
+
if aggregations is not None:
|
|
4213
|
+
__body["aggregations"] = aggregations
|
|
4214
|
+
if chunking_config is not None:
|
|
4215
|
+
__body["chunking_config"] = chunking_config
|
|
4216
|
+
if delayed_data_check_config is not None:
|
|
4217
|
+
__body["delayed_data_check_config"] = delayed_data_check_config
|
|
4218
|
+
if frequency is not None:
|
|
4219
|
+
__body["frequency"] = frequency
|
|
4220
|
+
if indexes is not None:
|
|
4221
|
+
__body["indexes"] = indexes
|
|
4222
|
+
if indices is not None:
|
|
4223
|
+
__body["indices"] = indices
|
|
4224
|
+
if indices_options is not None:
|
|
4225
|
+
__body["indices_options"] = indices_options
|
|
4226
|
+
if job_id is not None:
|
|
4227
|
+
__body["job_id"] = job_id
|
|
4228
|
+
if max_empty_searches is not None:
|
|
4229
|
+
__body["max_empty_searches"] = max_empty_searches
|
|
4230
|
+
if query is not None:
|
|
4231
|
+
__body["query"] = query
|
|
4232
|
+
if query_delay is not None:
|
|
4233
|
+
__body["query_delay"] = query_delay
|
|
4234
|
+
if runtime_mappings is not None:
|
|
4235
|
+
__body["runtime_mappings"] = runtime_mappings
|
|
4236
|
+
if script_fields is not None:
|
|
4237
|
+
__body["script_fields"] = script_fields
|
|
4238
|
+
if scroll_size is not None:
|
|
4239
|
+
__body["scroll_size"] = scroll_size
|
|
4055
4240
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4056
4241
|
return await self.perform_request( # type: ignore[return-value]
|
|
4057
4242
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
4058
4243
|
)
|
|
4059
4244
|
|
|
4060
4245
|
@_rewrite_parameters(
|
|
4061
|
-
body_fields=
|
|
4246
|
+
body_fields=("add_items", "description", "remove_items"),
|
|
4062
4247
|
)
|
|
4063
4248
|
async def update_filter(
|
|
4064
4249
|
self,
|
|
@@ -4071,11 +4256,12 @@ class MlClient(NamespacedClient):
|
|
|
4071
4256
|
human: t.Optional[bool] = None,
|
|
4072
4257
|
pretty: t.Optional[bool] = None,
|
|
4073
4258
|
remove_items: t.Optional[t.Sequence[str]] = None,
|
|
4259
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4074
4260
|
) -> ObjectApiResponse[t.Any]:
|
|
4075
4261
|
"""
|
|
4076
4262
|
Updates the description of a filter, adds items, or removes items.
|
|
4077
4263
|
|
|
4078
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4264
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-update-filter.html>`_
|
|
4079
4265
|
|
|
4080
4266
|
:param filter_id: A string that uniquely identifies a filter.
|
|
4081
4267
|
:param add_items: The items to add to the filter.
|
|
@@ -4085,12 +4271,8 @@ class MlClient(NamespacedClient):
|
|
|
4085
4271
|
if filter_id in SKIP_IN_PATH:
|
|
4086
4272
|
raise ValueError("Empty value passed for parameter 'filter_id'")
|
|
4087
4273
|
__path = f"/_ml/filters/{_quote(filter_id)}/_update"
|
|
4088
|
-
__body: t.Dict[str, t.Any] = {}
|
|
4089
4274
|
__query: t.Dict[str, t.Any] = {}
|
|
4090
|
-
if
|
|
4091
|
-
__body["add_items"] = add_items
|
|
4092
|
-
if description is not None:
|
|
4093
|
-
__body["description"] = description
|
|
4275
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4094
4276
|
if error_trace is not None:
|
|
4095
4277
|
__query["error_trace"] = error_trace
|
|
4096
4278
|
if filter_path is not None:
|
|
@@ -4099,15 +4281,36 @@ class MlClient(NamespacedClient):
|
|
|
4099
4281
|
__query["human"] = human
|
|
4100
4282
|
if pretty is not None:
|
|
4101
4283
|
__query["pretty"] = pretty
|
|
4102
|
-
if
|
|
4103
|
-
|
|
4284
|
+
if not __body:
|
|
4285
|
+
if add_items is not None:
|
|
4286
|
+
__body["add_items"] = add_items
|
|
4287
|
+
if description is not None:
|
|
4288
|
+
__body["description"] = description
|
|
4289
|
+
if remove_items is not None:
|
|
4290
|
+
__body["remove_items"] = remove_items
|
|
4104
4291
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4105
4292
|
return await self.perform_request( # type: ignore[return-value]
|
|
4106
4293
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
4107
4294
|
)
|
|
4108
4295
|
|
|
4109
4296
|
@_rewrite_parameters(
|
|
4110
|
-
body_fields=
|
|
4297
|
+
body_fields=(
|
|
4298
|
+
"allow_lazy_open",
|
|
4299
|
+
"analysis_limits",
|
|
4300
|
+
"background_persist_interval",
|
|
4301
|
+
"categorization_filters",
|
|
4302
|
+
"custom_settings",
|
|
4303
|
+
"daily_model_snapshot_retention_after_days",
|
|
4304
|
+
"description",
|
|
4305
|
+
"detectors",
|
|
4306
|
+
"groups",
|
|
4307
|
+
"model_plot_config",
|
|
4308
|
+
"model_prune_window",
|
|
4309
|
+
"model_snapshot_retention_days",
|
|
4310
|
+
"per_partition_categorization",
|
|
4311
|
+
"renormalization_window_days",
|
|
4312
|
+
"results_retention_days",
|
|
4313
|
+
),
|
|
4111
4314
|
)
|
|
4112
4315
|
async def update_job(
|
|
4113
4316
|
self,
|
|
@@ -4136,11 +4339,12 @@ class MlClient(NamespacedClient):
|
|
|
4136
4339
|
pretty: t.Optional[bool] = None,
|
|
4137
4340
|
renormalization_window_days: t.Optional[int] = None,
|
|
4138
4341
|
results_retention_days: t.Optional[int] = None,
|
|
4342
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4139
4343
|
) -> ObjectApiResponse[t.Any]:
|
|
4140
4344
|
"""
|
|
4141
4345
|
Updates certain properties of an anomaly detection job.
|
|
4142
4346
|
|
|
4143
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4347
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-update-job.html>`_
|
|
4144
4348
|
|
|
4145
4349
|
:param job_id: Identifier for the job.
|
|
4146
4350
|
:param allow_lazy_open: Advanced configuration option. Specifies whether this
|
|
@@ -4194,55 +4398,56 @@ class MlClient(NamespacedClient):
|
|
|
4194
4398
|
if job_id in SKIP_IN_PATH:
|
|
4195
4399
|
raise ValueError("Empty value passed for parameter 'job_id'")
|
|
4196
4400
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/_update"
|
|
4197
|
-
__body: t.Dict[str, t.Any] = {}
|
|
4198
4401
|
__query: t.Dict[str, t.Any] = {}
|
|
4199
|
-
if
|
|
4200
|
-
__body["allow_lazy_open"] = allow_lazy_open
|
|
4201
|
-
if analysis_limits is not None:
|
|
4202
|
-
__body["analysis_limits"] = analysis_limits
|
|
4203
|
-
if background_persist_interval is not None:
|
|
4204
|
-
__body["background_persist_interval"] = background_persist_interval
|
|
4205
|
-
if categorization_filters is not None:
|
|
4206
|
-
__body["categorization_filters"] = categorization_filters
|
|
4207
|
-
if custom_settings is not None:
|
|
4208
|
-
__body["custom_settings"] = custom_settings
|
|
4209
|
-
if daily_model_snapshot_retention_after_days is not None:
|
|
4210
|
-
__body[
|
|
4211
|
-
"daily_model_snapshot_retention_after_days"
|
|
4212
|
-
] = daily_model_snapshot_retention_after_days
|
|
4213
|
-
if description is not None:
|
|
4214
|
-
__body["description"] = description
|
|
4215
|
-
if detectors is not None:
|
|
4216
|
-
__body["detectors"] = detectors
|
|
4402
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4217
4403
|
if error_trace is not None:
|
|
4218
4404
|
__query["error_trace"] = error_trace
|
|
4219
4405
|
if filter_path is not None:
|
|
4220
4406
|
__query["filter_path"] = filter_path
|
|
4221
|
-
if groups is not None:
|
|
4222
|
-
__body["groups"] = groups
|
|
4223
4407
|
if human is not None:
|
|
4224
4408
|
__query["human"] = human
|
|
4225
|
-
if model_plot_config is not None:
|
|
4226
|
-
__body["model_plot_config"] = model_plot_config
|
|
4227
|
-
if model_prune_window is not None:
|
|
4228
|
-
__body["model_prune_window"] = model_prune_window
|
|
4229
|
-
if model_snapshot_retention_days is not None:
|
|
4230
|
-
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
4231
|
-
if per_partition_categorization is not None:
|
|
4232
|
-
__body["per_partition_categorization"] = per_partition_categorization
|
|
4233
4409
|
if pretty is not None:
|
|
4234
4410
|
__query["pretty"] = pretty
|
|
4235
|
-
if
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4411
|
+
if not __body:
|
|
4412
|
+
if allow_lazy_open is not None:
|
|
4413
|
+
__body["allow_lazy_open"] = allow_lazy_open
|
|
4414
|
+
if analysis_limits is not None:
|
|
4415
|
+
__body["analysis_limits"] = analysis_limits
|
|
4416
|
+
if background_persist_interval is not None:
|
|
4417
|
+
__body["background_persist_interval"] = background_persist_interval
|
|
4418
|
+
if categorization_filters is not None:
|
|
4419
|
+
__body["categorization_filters"] = categorization_filters
|
|
4420
|
+
if custom_settings is not None:
|
|
4421
|
+
__body["custom_settings"] = custom_settings
|
|
4422
|
+
if daily_model_snapshot_retention_after_days is not None:
|
|
4423
|
+
__body[
|
|
4424
|
+
"daily_model_snapshot_retention_after_days"
|
|
4425
|
+
] = daily_model_snapshot_retention_after_days
|
|
4426
|
+
if description is not None:
|
|
4427
|
+
__body["description"] = description
|
|
4428
|
+
if detectors is not None:
|
|
4429
|
+
__body["detectors"] = detectors
|
|
4430
|
+
if groups is not None:
|
|
4431
|
+
__body["groups"] = groups
|
|
4432
|
+
if model_plot_config is not None:
|
|
4433
|
+
__body["model_plot_config"] = model_plot_config
|
|
4434
|
+
if model_prune_window is not None:
|
|
4435
|
+
__body["model_prune_window"] = model_prune_window
|
|
4436
|
+
if model_snapshot_retention_days is not None:
|
|
4437
|
+
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
4438
|
+
if per_partition_categorization is not None:
|
|
4439
|
+
__body["per_partition_categorization"] = per_partition_categorization
|
|
4440
|
+
if renormalization_window_days is not None:
|
|
4441
|
+
__body["renormalization_window_days"] = renormalization_window_days
|
|
4442
|
+
if results_retention_days is not None:
|
|
4443
|
+
__body["results_retention_days"] = results_retention_days
|
|
4239
4444
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4240
4445
|
return await self.perform_request( # type: ignore[return-value]
|
|
4241
4446
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
4242
4447
|
)
|
|
4243
4448
|
|
|
4244
4449
|
@_rewrite_parameters(
|
|
4245
|
-
body_fields=
|
|
4450
|
+
body_fields=("description", "retain"),
|
|
4246
4451
|
)
|
|
4247
4452
|
async def update_model_snapshot(
|
|
4248
4453
|
self,
|
|
@@ -4255,11 +4460,12 @@ class MlClient(NamespacedClient):
|
|
|
4255
4460
|
human: t.Optional[bool] = None,
|
|
4256
4461
|
pretty: t.Optional[bool] = None,
|
|
4257
4462
|
retain: t.Optional[bool] = None,
|
|
4463
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4258
4464
|
) -> ObjectApiResponse[t.Any]:
|
|
4259
4465
|
"""
|
|
4260
4466
|
Updates certain properties of a snapshot.
|
|
4261
4467
|
|
|
4262
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4468
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-update-snapshot.html>`_
|
|
4263
4469
|
|
|
4264
4470
|
:param job_id: Identifier for the anomaly detection job.
|
|
4265
4471
|
:param snapshot_id: Identifier for the model snapshot.
|
|
@@ -4273,10 +4479,8 @@ class MlClient(NamespacedClient):
|
|
|
4273
4479
|
if snapshot_id in SKIP_IN_PATH:
|
|
4274
4480
|
raise ValueError("Empty value passed for parameter 'snapshot_id'")
|
|
4275
4481
|
__path = f"/_ml/anomaly_detectors/{_quote(job_id)}/model_snapshots/{_quote(snapshot_id)}/_update"
|
|
4276
|
-
__body: t.Dict[str, t.Any] = {}
|
|
4277
4482
|
__query: t.Dict[str, t.Any] = {}
|
|
4278
|
-
if
|
|
4279
|
-
__body["description"] = description
|
|
4483
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4280
4484
|
if error_trace is not None:
|
|
4281
4485
|
__query["error_trace"] = error_trace
|
|
4282
4486
|
if filter_path is not None:
|
|
@@ -4285,8 +4489,11 @@ class MlClient(NamespacedClient):
|
|
|
4285
4489
|
__query["human"] = human
|
|
4286
4490
|
if pretty is not None:
|
|
4287
4491
|
__query["pretty"] = pretty
|
|
4288
|
-
if
|
|
4289
|
-
|
|
4492
|
+
if not __body:
|
|
4493
|
+
if description is not None:
|
|
4494
|
+
__body["description"] = description
|
|
4495
|
+
if retain is not None:
|
|
4496
|
+
__body["retain"] = retain
|
|
4290
4497
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4291
4498
|
return await self.perform_request( # type: ignore[return-value]
|
|
4292
4499
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -4308,7 +4515,7 @@ class MlClient(NamespacedClient):
|
|
|
4308
4515
|
"""
|
|
4309
4516
|
Upgrades a given job snapshot to the current major version.
|
|
4310
4517
|
|
|
4311
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
4518
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/ml-upgrade-job-model-snapshot.html>`_
|
|
4312
4519
|
|
|
4313
4520
|
:param job_id: Identifier for the anomaly detection job.
|
|
4314
4521
|
:param snapshot_id: A numerical character string that uniquely identifies the
|
|
@@ -4342,7 +4549,17 @@ class MlClient(NamespacedClient):
|
|
|
4342
4549
|
)
|
|
4343
4550
|
|
|
4344
4551
|
@_rewrite_parameters(
|
|
4345
|
-
body_fields=
|
|
4552
|
+
body_fields=(
|
|
4553
|
+
"analysis_config",
|
|
4554
|
+
"analysis_limits",
|
|
4555
|
+
"data_description",
|
|
4556
|
+
"description",
|
|
4557
|
+
"job_id",
|
|
4558
|
+
"model_plot",
|
|
4559
|
+
"model_snapshot_id",
|
|
4560
|
+
"model_snapshot_retention_days",
|
|
4561
|
+
"results_index_name",
|
|
4562
|
+
),
|
|
4346
4563
|
)
|
|
4347
4564
|
async def validate(
|
|
4348
4565
|
self,
|
|
@@ -4360,11 +4577,12 @@ class MlClient(NamespacedClient):
|
|
|
4360
4577
|
model_snapshot_retention_days: t.Optional[int] = None,
|
|
4361
4578
|
pretty: t.Optional[bool] = None,
|
|
4362
4579
|
results_index_name: t.Optional[str] = None,
|
|
4580
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
4363
4581
|
) -> ObjectApiResponse[t.Any]:
|
|
4364
4582
|
"""
|
|
4365
4583
|
Validates an anomaly detection job.
|
|
4366
4584
|
|
|
4367
|
-
`<https://www.elastic.co/guide/en/machine-learning/8.
|
|
4585
|
+
`<https://www.elastic.co/guide/en/machine-learning/8.12/ml-jobs.html>`_
|
|
4368
4586
|
|
|
4369
4587
|
:param analysis_config:
|
|
4370
4588
|
:param analysis_limits:
|
|
@@ -4377,34 +4595,35 @@ class MlClient(NamespacedClient):
|
|
|
4377
4595
|
:param results_index_name:
|
|
4378
4596
|
"""
|
|
4379
4597
|
__path = "/_ml/anomaly_detectors/_validate"
|
|
4380
|
-
__body: t.Dict[str, t.Any] = {}
|
|
4381
4598
|
__query: t.Dict[str, t.Any] = {}
|
|
4382
|
-
if
|
|
4383
|
-
__body["analysis_config"] = analysis_config
|
|
4384
|
-
if analysis_limits is not None:
|
|
4385
|
-
__body["analysis_limits"] = analysis_limits
|
|
4386
|
-
if data_description is not None:
|
|
4387
|
-
__body["data_description"] = data_description
|
|
4388
|
-
if description is not None:
|
|
4389
|
-
__body["description"] = description
|
|
4599
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
4390
4600
|
if error_trace is not None:
|
|
4391
4601
|
__query["error_trace"] = error_trace
|
|
4392
4602
|
if filter_path is not None:
|
|
4393
4603
|
__query["filter_path"] = filter_path
|
|
4394
4604
|
if human is not None:
|
|
4395
4605
|
__query["human"] = human
|
|
4396
|
-
if job_id is not None:
|
|
4397
|
-
__body["job_id"] = job_id
|
|
4398
|
-
if model_plot is not None:
|
|
4399
|
-
__body["model_plot"] = model_plot
|
|
4400
|
-
if model_snapshot_id is not None:
|
|
4401
|
-
__body["model_snapshot_id"] = model_snapshot_id
|
|
4402
|
-
if model_snapshot_retention_days is not None:
|
|
4403
|
-
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
4404
4606
|
if pretty is not None:
|
|
4405
4607
|
__query["pretty"] = pretty
|
|
4406
|
-
if
|
|
4407
|
-
|
|
4608
|
+
if not __body:
|
|
4609
|
+
if analysis_config is not None:
|
|
4610
|
+
__body["analysis_config"] = analysis_config
|
|
4611
|
+
if analysis_limits is not None:
|
|
4612
|
+
__body["analysis_limits"] = analysis_limits
|
|
4613
|
+
if data_description is not None:
|
|
4614
|
+
__body["data_description"] = data_description
|
|
4615
|
+
if description is not None:
|
|
4616
|
+
__body["description"] = description
|
|
4617
|
+
if job_id is not None:
|
|
4618
|
+
__body["job_id"] = job_id
|
|
4619
|
+
if model_plot is not None:
|
|
4620
|
+
__body["model_plot"] = model_plot
|
|
4621
|
+
if model_snapshot_id is not None:
|
|
4622
|
+
__body["model_snapshot_id"] = model_snapshot_id
|
|
4623
|
+
if model_snapshot_retention_days is not None:
|
|
4624
|
+
__body["model_snapshot_retention_days"] = model_snapshot_retention_days
|
|
4625
|
+
if results_index_name is not None:
|
|
4626
|
+
__body["results_index_name"] = results_index_name
|
|
4408
4627
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4409
4628
|
return await self.perform_request( # type: ignore[return-value]
|
|
4410
4629
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -4416,7 +4635,8 @@ class MlClient(NamespacedClient):
|
|
|
4416
4635
|
async def validate_detector(
|
|
4417
4636
|
self,
|
|
4418
4637
|
*,
|
|
4419
|
-
detector: t.Mapping[str, t.Any],
|
|
4638
|
+
detector: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4639
|
+
body: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
4420
4640
|
error_trace: t.Optional[bool] = None,
|
|
4421
4641
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
4422
4642
|
human: t.Optional[bool] = None,
|
|
@@ -4425,12 +4645,16 @@ class MlClient(NamespacedClient):
|
|
|
4425
4645
|
"""
|
|
4426
4646
|
Validates an anomaly detection detector.
|
|
4427
4647
|
|
|
4428
|
-
`<https://www.elastic.co/guide/en/machine-learning/8.
|
|
4648
|
+
`<https://www.elastic.co/guide/en/machine-learning/8.12/ml-jobs.html>`_
|
|
4429
4649
|
|
|
4430
4650
|
:param detector:
|
|
4431
4651
|
"""
|
|
4432
|
-
if detector is None:
|
|
4433
|
-
raise ValueError(
|
|
4652
|
+
if detector is None and body is None:
|
|
4653
|
+
raise ValueError(
|
|
4654
|
+
"Empty value passed for parameters 'detector' and 'body', one of them should be set."
|
|
4655
|
+
)
|
|
4656
|
+
elif detector is not None and body is not None:
|
|
4657
|
+
raise ValueError("Cannot set both 'detector' and 'body'")
|
|
4434
4658
|
__path = "/_ml/anomaly_detectors/_validate/detector"
|
|
4435
4659
|
__query: t.Dict[str, t.Any] = {}
|
|
4436
4660
|
if error_trace is not None:
|
|
@@ -4441,7 +4665,7 @@ class MlClient(NamespacedClient):
|
|
|
4441
4665
|
__query["human"] = human
|
|
4442
4666
|
if pretty is not None:
|
|
4443
4667
|
__query["pretty"] = pretty
|
|
4444
|
-
__body = detector
|
|
4668
|
+
__body = detector if detector is not None else body
|
|
4445
4669
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
4446
4670
|
return await self.perform_request( # type: ignore[return-value]
|
|
4447
4671
|
"POST", __path, params=__query, headers=__headers, body=__body
|