@@ -1724,6 +1724,7 @@ async def get_model_snapshots(
1724
1724
filter_path : Optional [Union [List [str ], str ]] = None ,
1725
1725
from_ : Optional [int ] = None ,
1726
1726
human : Optional [bool ] = None ,
1727
+ page : Optional [Any ] = None ,
1727
1728
pretty : Optional [bool ] = None ,
1728
1729
size : Optional [int ] = None ,
1729
1730
sort : Optional [Any ] = None ,
@@ -1736,16 +1737,17 @@ async def get_model_snapshots(
1736
1737
1737
1738
:param job_id: Identifier for the anomaly detection job.
1738
1739
:param snapshot_id: A numerical character string that uniquely identifies the
1739
- model snapshot.
1740
- :param desc: If true, the results are sorted in descending order.
1741
- :param end: Returns snapshots with timestamps earlier than this time. Defaults
1742
- to unset, which means results are not limited to specific timestamps.
1740
+ model snapshot. You can get information for multiple snapshots by using a
1741
+ comma-separated list or a wildcard expression. You can get all snapshots
1742
+ by using `_all`, by specifying `*` as the snapshot ID, or by omitting the
1743
+ snapshot ID.
1744
+ :param desc: Refer to the description for the `desc` query parameter.
1745
+ :param end: Refer to the description for the `end` query parameter.
1743
1746
:param from_: Skips the specified number of snapshots.
1747
+ :param page:
1744
1748
:param size: Specifies the maximum number of snapshots to obtain.
1745
- :param sort: Specifies the sort field for the requested snapshots. By default,
1746
- the snapshots are sorted by their timestamp.
1747
- :param start: Returns snapshots with timestamps after this time. Defaults to
1748
- unset, which means results are not limited to specific timestamps.
1749
+ :param sort: Refer to the description for the `sort` query parameter.
1750
+ :param start: Refer to the description for the `start` query parameter.
1749
1751
"""
1750
1752
if job_id in SKIP_IN_PATH :
1751
1753
raise ValueError ("Empty value passed for parameter 'job_id'" )
@@ -1755,10 +1757,10 @@ async def get_model_snapshots(
1755
1757
__path = f"/_ml/anomaly_detectors/{ _quote (job_id )} /model_snapshots"
1756
1758
else :
1757
1759
raise ValueError ("Couldn't find a path for the given parameters" )
1758
- __query : Dict [str , Any ] = {}
1759
1760
__body : Dict [str , Any ] = {}
1761
+ __query : Dict [str , Any ] = {}
1760
1762
if desc is not None :
1761
- __query ["desc" ] = desc
1763
+ __body ["desc" ] = desc
1762
1764
if end is not None :
1763
1765
__body ["end" ] = end
1764
1766
if error_trace is not None :
@@ -1769,12 +1771,14 @@ async def get_model_snapshots(
1769
1771
__query ["from" ] = from_
1770
1772
if human is not None :
1771
1773
__query ["human" ] = human
1774
+ if page is not None :
1775
+ __body ["page" ] = page
1772
1776
if pretty is not None :
1773
1777
__query ["pretty" ] = pretty
1774
1778
if size is not None :
1775
1779
__query ["size" ] = size
1776
1780
if sort is not None :
1777
- __query ["sort" ] = sort
1781
+ __body ["sort" ] = sort
1778
1782
if start is not None :
1779
1783
__body ["start" ] = start
1780
1784
if not __body :
@@ -3528,6 +3532,175 @@ async def update_data_frame_analytics(
3528
3532
"POST" , __target , headers = __headers , body = __body
3529
3533
)
3530
3534
3535
+ @_rewrite_parameters (
3536
+ body_fields = True ,
3537
+ )
3538
+ async def update_datafeed (
3539
+ self ,
3540
+ * ,
3541
+ datafeed_id : Any ,
3542
+ aggregations : Optional [Dict [str , Any ]] = None ,
3543
+ allow_no_indices : Optional [bool ] = None ,
3544
+ chunking_config : Optional [Any ] = None ,
3545
+ delayed_data_check_config : Optional [Any ] = None ,
3546
+ error_trace : Optional [bool ] = None ,
3547
+ expand_wildcards : Optional [Any ] = None ,
3548
+ filter_path : Optional [Union [List [str ], str ]] = None ,
3549
+ frequency : Optional [Any ] = None ,
3550
+ human : Optional [bool ] = None ,
3551
+ ignore_throttled : Optional [bool ] = None ,
3552
+ ignore_unavailable : Optional [bool ] = None ,
3553
+ indexes : Optional [List [str ]] = None ,
3554
+ indices : Optional [List [str ]] = None ,
3555
+ indices_options : Optional [Any ] = None ,
3556
+ max_empty_searches : Optional [int ] = None ,
3557
+ pretty : Optional [bool ] = None ,
3558
+ query : Optional [Any ] = None ,
3559
+ query_delay : Optional [Any ] = None ,
3560
+ runtime_mappings : Optional [Any ] = None ,
3561
+ script_fields : Optional [Dict [str , Any ]] = None ,
3562
+ scroll_size : Optional [int ] = None ,
3563
+ ) -> Any :
3564
+ """
3565
+ Updates certain properties of a datafeed.
3566
+
3567
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-update-datafeed.html>`_
3568
+
3569
+ :param datafeed_id: A numerical character string that uniquely identifies the
3570
+ datafeed. This identifier can contain lowercase alphanumeric characters (a-z
3571
+ and 0-9), hyphens, and underscores. It must start and end with alphanumeric
3572
+ characters.
3573
+ :param aggregations: If set, the datafeed performs aggregation searches. Support
3574
+ for aggregations is limited and should be used only with low cardinality
3575
+ data.
3576
+ :param allow_no_indices: If `true`, wildcard indices expressions that resolve
3577
+ into no concrete indices are ignored. This includes the `_all` string or
3578
+ when no indices are specified.
3579
+ :param chunking_config: Datafeeds might search over long time periods, for several
3580
+ months or years. This search is split into time chunks in order to ensure
3581
+ the load on Elasticsearch is managed. Chunking configuration controls how
3582
+ the size of these time chunks are calculated; it is an advanced configuration
3583
+ option.
3584
+ :param delayed_data_check_config: Specifies whether the datafeed checks for missing
3585
+ data and the size of the window. The datafeed can optionally search over
3586
+ indices that have already been read in an effort to determine whether any
3587
+ data has subsequently been added to the index. If missing data is found,
3588
+ it is a good indication that the `query_delay` is set too low and the data
3589
+ is being indexed after the datafeed has passed that moment in time. This
3590
+ check runs only on real-time datafeeds.
3591
+ :param expand_wildcards: Type of index that wildcard patterns can match. If the
3592
+ request can target data streams, this argument determines whether wildcard
3593
+ expressions match hidden data streams. Supports comma-separated values. Valid
3594
+ values are: * `all`: Match any data stream or index, including hidden ones.
3595
+ * `closed`: Match closed, non-hidden indices. Also matches any non-hidden
3596
+ data stream. Data streams cannot be closed. * `hidden`: Match hidden data
3597
+ streams and hidden indices. Must be combined with `open`, `closed`, or both.
3598
+ * `none`: Wildcard patterns are not accepted. * `open`: Match open, non-hidden
3599
+ indices. Also matches any non-hidden data stream.
3600
+ :param frequency: The interval at which scheduled queries are made while the
3601
+ datafeed runs in real time. The default value is either the bucket span for
3602
+ short bucket spans, or, for longer bucket spans, a sensible fraction of the
3603
+ bucket span. When `frequency` is shorter than the bucket span, interim results
3604
+ for the last (partial) bucket are written then eventually overwritten by
3605
+ the full bucket results. If the datafeed uses aggregations, this value must
3606
+ be divisible by the interval of the date histogram aggregation.
3607
+ :param ignore_throttled: If `true`, concrete, expanded or aliased indices are
3608
+ ignored when frozen.
3609
+ :param ignore_unavailable: If `true`, unavailable indices (missing or closed)
3610
+ are ignored.
3611
+ :param indexes: An array of index names. Wildcards are supported. If any of the
3612
+ indices are in remote clusters, the machine learning nodes must have the
3613
+ `remote_cluster_client` role.
3614
+ :param indices: An array of index names. Wildcards are supported. If any of the
3615
+ indices are in remote clusters, the machine learning nodes must have the
3616
+ `remote_cluster_client` role.
3617
+ :param indices_options: Specifies index expansion options that are used during
3618
+ search.
3619
+ :param max_empty_searches: If a real-time datafeed has never seen any data (including
3620
+ during any initial training period), it automatically stops and closes the
3621
+ associated job after this many real-time searches return no documents. In
3622
+ other words, it stops after `frequency` times `max_empty_searches` of real-time
3623
+ operation. If not set, a datafeed with no end time that sees no data remains
3624
+ started until it is explicitly stopped. By default, it is not set.
3625
+ :param query: The Elasticsearch query domain-specific language (DSL). This value
3626
+ corresponds to the query object in an Elasticsearch search POST body. All
3627
+ the options that are supported by Elasticsearch can be used, as this object
3628
+ is passed verbatim to Elasticsearch. Note that if you change the query, the
3629
+ analyzed data is also changed. Therefore, the time required to learn might
3630
+ be long and the understandability of the results is unpredictable. If you
3631
+ want to make significant changes to the source data, it is recommended that
3632
+ you clone the job and datafeed and make the amendments in the clone. Let
3633
+ both run in parallel and close one when you are satisfied with the results
3634
+ of the job.
3635
+ :param query_delay: The number of seconds behind real time that data is queried.
3636
+ For example, if data from 10:04 a.m. might not be searchable in Elasticsearch
3637
+ until 10:06 a.m., set this property to 120 seconds. The default value is
3638
+ randomly selected between `60s` and `120s`. This randomness improves the
3639
+ query performance when there are multiple jobs running on the same node.
3640
+ :param runtime_mappings: Specifies runtime fields for the datafeed search.
3641
+ :param script_fields: Specifies scripts that evaluate custom expressions and
3642
+ returns script fields to the datafeed. The detector configuration objects
3643
+ in a job can contain functions that use these script fields.
3644
+ :param scroll_size: The size parameter that is used in Elasticsearch searches
3645
+ when the datafeed does not use aggregations. The maximum value is the value
3646
+ of `index.max_result_window`.
3647
+ """
3648
+ if datafeed_id in SKIP_IN_PATH :
3649
+ raise ValueError ("Empty value passed for parameter 'datafeed_id'" )
3650
+ __path = f"/_ml/datafeeds/{ _quote (datafeed_id )} /_update"
3651
+ __body : Dict [str , Any ] = {}
3652
+ __query : Dict [str , Any ] = {}
3653
+ if aggregations is not None :
3654
+ __body ["aggregations" ] = aggregations
3655
+ if allow_no_indices is not None :
3656
+ __query ["allow_no_indices" ] = allow_no_indices
3657
+ if chunking_config is not None :
3658
+ __body ["chunking_config" ] = chunking_config
3659
+ if delayed_data_check_config is not None :
3660
+ __body ["delayed_data_check_config" ] = delayed_data_check_config
3661
+ if error_trace is not None :
3662
+ __query ["error_trace" ] = error_trace
3663
+ if expand_wildcards is not None :
3664
+ __query ["expand_wildcards" ] = expand_wildcards
3665
+ if filter_path is not None :
3666
+ __query ["filter_path" ] = filter_path
3667
+ if frequency is not None :
3668
+ __body ["frequency" ] = frequency
3669
+ if human is not None :
3670
+ __query ["human" ] = human
3671
+ if ignore_throttled is not None :
3672
+ __query ["ignore_throttled" ] = ignore_throttled
3673
+ if ignore_unavailable is not None :
3674
+ __query ["ignore_unavailable" ] = ignore_unavailable
3675
+ if indexes is not None :
3676
+ __body ["indexes" ] = indexes
3677
+ if indices is not None :
3678
+ __body ["indices" ] = indices
3679
+ if indices_options is not None :
3680
+ __body ["indices_options" ] = indices_options
3681
+ if max_empty_searches is not None :
3682
+ __body ["max_empty_searches" ] = max_empty_searches
3683
+ if pretty is not None :
3684
+ __query ["pretty" ] = pretty
3685
+ if query is not None :
3686
+ __body ["query" ] = query
3687
+ if query_delay is not None :
3688
+ __body ["query_delay" ] = query_delay
3689
+ if runtime_mappings is not None :
3690
+ __body ["runtime_mappings" ] = runtime_mappings
3691
+ if script_fields is not None :
3692
+ __body ["script_fields" ] = script_fields
3693
+ if scroll_size is not None :
3694
+ __body ["scroll_size" ] = scroll_size
3695
+ if __query :
3696
+ __target = f"{ __path } ?{ _quote_query (__query )} "
3697
+ else :
3698
+ __target = __path
3699
+ __headers = {"accept" : "application/json" , "content-type" : "application/json" }
3700
+ return await self ._perform_request (
3701
+ "POST" , __target , headers = __headers , body = __body
3702
+ )
3703
+
3531
3704
@_rewrite_parameters (
3532
3705
body_fields = True ,
3533
3706
)
0 commit comments