elasticsearch9 9.2.1__py3-none-any.whl → 9.3.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.
Files changed (55) hide show
  1. elasticsearch9/_async/client/__init__.py +44 -40
  2. elasticsearch9/_async/client/async_search.py +4 -3
  3. elasticsearch9/_async/client/cat.py +163 -8
  4. elasticsearch9/_async/client/cluster.py +66 -34
  5. elasticsearch9/_async/client/eql.py +7 -6
  6. elasticsearch9/_async/client/esql.py +157 -8
  7. elasticsearch9/_async/client/fleet.py +1 -1
  8. elasticsearch9/_async/client/graph.py +1 -1
  9. elasticsearch9/_async/client/indices.py +436 -17
  10. elasticsearch9/_async/client/inference.py +299 -9
  11. elasticsearch9/_async/client/ml.py +7 -3
  12. elasticsearch9/_async/client/nodes.py +167 -5
  13. elasticsearch9/_async/client/project.py +9 -1
  14. elasticsearch9/_async/client/security.py +26 -3
  15. elasticsearch9/_async/client/snapshot.py +1 -1
  16. elasticsearch9/_async/client/sql.py +7 -6
  17. elasticsearch9/_async/client/streams.py +0 -1
  18. elasticsearch9/_async/client/text_structure.py +3 -3
  19. elasticsearch9/_sync/client/__init__.py +44 -40
  20. elasticsearch9/_sync/client/async_search.py +4 -3
  21. elasticsearch9/_sync/client/cat.py +163 -8
  22. elasticsearch9/_sync/client/cluster.py +66 -34
  23. elasticsearch9/_sync/client/eql.py +7 -6
  24. elasticsearch9/_sync/client/esql.py +157 -8
  25. elasticsearch9/_sync/client/fleet.py +1 -1
  26. elasticsearch9/_sync/client/graph.py +1 -1
  27. elasticsearch9/_sync/client/indices.py +436 -17
  28. elasticsearch9/_sync/client/inference.py +299 -9
  29. elasticsearch9/_sync/client/ml.py +7 -3
  30. elasticsearch9/_sync/client/nodes.py +167 -5
  31. elasticsearch9/_sync/client/project.py +9 -1
  32. elasticsearch9/_sync/client/project_routing.py +264 -0
  33. elasticsearch9/_sync/client/security.py +26 -3
  34. elasticsearch9/_sync/client/snapshot.py +1 -1
  35. elasticsearch9/_sync/client/sql.py +7 -6
  36. elasticsearch9/_sync/client/streams.py +0 -1
  37. elasticsearch9/_sync/client/text_structure.py +3 -3
  38. elasticsearch9/_version.py +2 -2
  39. elasticsearch9/dsl/__init__.py +4 -0
  40. elasticsearch9/dsl/aggs.py +6 -6
  41. elasticsearch9/dsl/field.py +91 -7
  42. elasticsearch9/dsl/query.py +2 -2
  43. elasticsearch9/dsl/response/__init__.py +2 -0
  44. elasticsearch9/dsl/types.py +66 -7
  45. elasticsearch9/dsl/utils.py +11 -2
  46. elasticsearch9/esql/functions.py +924 -250
  47. elasticsearch9/helpers/__init__.py +2 -0
  48. elasticsearch9/helpers/actions.py +21 -0
  49. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +3 -0
  50. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +3 -0
  51. {elasticsearch9-9.2.1.dist-info → elasticsearch9-9.3.0.dist-info}/METADATA +2 -1
  52. {elasticsearch9-9.2.1.dist-info → elasticsearch9-9.3.0.dist-info}/RECORD +55 -54
  53. {elasticsearch9-9.2.1.dist-info → elasticsearch9-9.3.0.dist-info}/WHEEL +0 -0
  54. {elasticsearch9-9.2.1.dist-info → elasticsearch9-9.3.0.dist-info}/licenses/LICENSE +0 -0
  55. {elasticsearch9-9.2.1.dist-info → elasticsearch9-9.3.0.dist-info}/licenses/NOTICE +0 -0
@@ -35,7 +35,7 @@ class IndicesClient(NamespacedClient):
35
35
  def add_block(
36
36
  self,
37
37
  *,
38
- index: str,
38
+ index: t.Union[str, t.Sequence[str]],
39
39
  block: t.Union[str, t.Literal["metadata", "read", "read_only", "write"]],
40
40
  allow_no_indices: t.Optional[bool] = None,
41
41
  error_trace: t.Optional[bool] = None,
@@ -842,7 +842,7 @@ class IndicesClient(NamespacedClient):
842
842
  def data_streams_stats(
843
843
  self,
844
844
  *,
845
- name: t.Optional[str] = None,
845
+ name: t.Optional[t.Union[str, t.Sequence[str]]] = None,
846
846
  error_trace: t.Optional[bool] = None,
847
847
  expand_wildcards: t.Optional[
848
848
  t.Union[
@@ -1298,6 +1298,62 @@ class IndicesClient(NamespacedClient):
1298
1298
  path_parts=__path_parts,
1299
1299
  )
1300
1300
 
1301
+ @_rewrite_parameters()
1302
+ @_availability_warning(Stability.EXPERIMENTAL)
1303
+ def delete_sample_configuration(
1304
+ self,
1305
+ *,
1306
+ index: str,
1307
+ error_trace: t.Optional[bool] = None,
1308
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1309
+ human: t.Optional[bool] = None,
1310
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1311
+ pretty: t.Optional[bool] = None,
1312
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1313
+ ) -> ObjectApiResponse[t.Any]:
1314
+ """
1315
+ .. raw:: html
1316
+
1317
+ <p>Delete sampling configuration.</p>
1318
+ <p>Delete the sampling configuration for the specified index.</p>
1319
+
1320
+
1321
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
1322
+
1323
+ :param index: The name of the index.
1324
+ :param master_timeout: Period to wait for a connection to the master node. If
1325
+ no response is received before the timeout expires, the request fails and
1326
+ returns an error.
1327
+ :param timeout: Period to wait for a response. If no response is received before
1328
+ the timeout expires, the request fails and returns an error.
1329
+ """
1330
+ if index in SKIP_IN_PATH:
1331
+ raise ValueError("Empty value passed for parameter 'index'")
1332
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
1333
+ __path = f'/{__path_parts["index"]}/_sample/config'
1334
+ __query: t.Dict[str, t.Any] = {}
1335
+ if error_trace is not None:
1336
+ __query["error_trace"] = error_trace
1337
+ if filter_path is not None:
1338
+ __query["filter_path"] = filter_path
1339
+ if human is not None:
1340
+ __query["human"] = human
1341
+ if master_timeout is not None:
1342
+ __query["master_timeout"] = master_timeout
1343
+ if pretty is not None:
1344
+ __query["pretty"] = pretty
1345
+ if timeout is not None:
1346
+ __query["timeout"] = timeout
1347
+ __headers = {"accept": "application/json"}
1348
+ return self.perform_request( # type: ignore[return-value]
1349
+ "DELETE",
1350
+ __path,
1351
+ params=__query,
1352
+ headers=__headers,
1353
+ endpoint_id="indices.delete_sample_configuration",
1354
+ path_parts=__path_parts,
1355
+ )
1356
+
1301
1357
  @_rewrite_parameters()
1302
1358
  def delete_template(
1303
1359
  self,
@@ -1465,12 +1521,17 @@ class IndicesClient(NamespacedClient):
1465
1521
  .. raw:: html
1466
1522
 
1467
1523
  <p>Downsample an index.</p>
1468
- <p>Aggregate a time series (TSDS) index and store pre-computed statistical summaries (<code>min</code>, <code>max</code>, <code>sum</code>, <code>value_count</code> and <code>avg</code>) for each metric field grouped by a configured time interval.
1469
- For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.
1524
+ <p>Downsamples a time series (TSDS) index and reduces its size by keeping the last value or by pre-aggregating metrics:</p>
1525
+ <ul>
1526
+ <li>When running in <code>aggregate</code> mode, it pre-calculates and stores statistical summaries (<code>min</code>, <code>max</code>, <code>sum</code>, <code>value_count</code> and <code>avg</code>)
1527
+ for each metric field grouped by a configured time interval and their dimensions.</li>
1528
+ <li>When running in <code>last_value</code> mode, it keeps the last value for each metric in the configured interval and their dimensions.</li>
1529
+ </ul>
1530
+ <p>For example, a TSDS index that contains metrics sampled every 10 seconds can be downsampled to an hourly index.
1470
1531
  All documents within an hour interval are summarized and stored as a single document in the downsample index.</p>
1471
1532
  <p>NOTE: Only indices in a time series data stream are supported.
1472
1533
  Neither field nor document level security can be defined on the source index.
1473
- The source index must be read only (<code>index.blocks.write: true</code>).</p>
1534
+ The source index must be read-only (<code>index.blocks.write: true</code>).</p>
1474
1535
 
1475
1536
 
1476
1537
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-downsample>`_
@@ -2116,7 +2177,7 @@ class IndicesClient(NamespacedClient):
2116
2177
  :param ignore_unavailable: Whether specified concrete indices should be ignored
2117
2178
  when unavailable (missing or closed)
2118
2179
  :param max_num_segments: The number of segments the index should be merged into
2119
- (defayult: dynamic)
2180
+ (default: dynamic)
2120
2181
  :param only_expunge_deletes: Specify whether the operation should only expunge
2121
2182
  deleted documents
2122
2183
  :param wait_for_completion: Should the request wait until the force merge is
@@ -2353,6 +2414,53 @@ class IndicesClient(NamespacedClient):
2353
2414
  path_parts=__path_parts,
2354
2415
  )
2355
2416
 
2417
+ @_rewrite_parameters()
2418
+ @_availability_warning(Stability.EXPERIMENTAL)
2419
+ def get_all_sample_configuration(
2420
+ self,
2421
+ *,
2422
+ error_trace: t.Optional[bool] = None,
2423
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2424
+ human: t.Optional[bool] = None,
2425
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2426
+ pretty: t.Optional[bool] = None,
2427
+ ) -> ObjectApiResponse[t.Any]:
2428
+ """
2429
+ .. raw:: html
2430
+
2431
+ <p>Get all sampling configurations.</p>
2432
+ <p>Get the sampling configurations for all indices.</p>
2433
+
2434
+
2435
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
2436
+
2437
+ :param master_timeout: Period to wait for a connection to the master node. If
2438
+ no response is received before the timeout expires, the request fails and
2439
+ returns an error.
2440
+ """
2441
+ __path_parts: t.Dict[str, str] = {}
2442
+ __path = "/_sample/config"
2443
+ __query: t.Dict[str, t.Any] = {}
2444
+ if error_trace is not None:
2445
+ __query["error_trace"] = error_trace
2446
+ if filter_path is not None:
2447
+ __query["filter_path"] = filter_path
2448
+ if human is not None:
2449
+ __query["human"] = human
2450
+ if master_timeout is not None:
2451
+ __query["master_timeout"] = master_timeout
2452
+ if pretty is not None:
2453
+ __query["pretty"] = pretty
2454
+ __headers = {"accept": "application/json"}
2455
+ return self.perform_request( # type: ignore[return-value]
2456
+ "GET",
2457
+ __path,
2458
+ params=__query,
2459
+ headers=__headers,
2460
+ endpoint_id="indices.get_all_sample_configuration",
2461
+ path_parts=__path_parts,
2462
+ )
2463
+
2356
2464
  @_rewrite_parameters()
2357
2465
  def get_data_lifecycle(
2358
2466
  self,
@@ -2988,6 +3096,145 @@ class IndicesClient(NamespacedClient):
2988
3096
  path_parts=__path_parts,
2989
3097
  )
2990
3098
 
3099
+ @_rewrite_parameters()
3100
+ @_availability_warning(Stability.EXPERIMENTAL)
3101
+ def get_sample(
3102
+ self,
3103
+ *,
3104
+ index: str,
3105
+ error_trace: t.Optional[bool] = None,
3106
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3107
+ human: t.Optional[bool] = None,
3108
+ pretty: t.Optional[bool] = None,
3109
+ ) -> ObjectApiResponse[t.Any]:
3110
+ """
3111
+ .. raw:: html
3112
+
3113
+ <p>Request for a random sample of raw documents ingested into the given index or data stream.</p>
3114
+
3115
+
3116
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
3117
+
3118
+ :param index: Single index or data stream name. Wildcards are not supported.
3119
+ """
3120
+ if index in SKIP_IN_PATH:
3121
+ raise ValueError("Empty value passed for parameter 'index'")
3122
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
3123
+ __path = f'/{__path_parts["index"]}/_sample'
3124
+ __query: t.Dict[str, t.Any] = {}
3125
+ if error_trace is not None:
3126
+ __query["error_trace"] = error_trace
3127
+ if filter_path is not None:
3128
+ __query["filter_path"] = filter_path
3129
+ if human is not None:
3130
+ __query["human"] = human
3131
+ if pretty is not None:
3132
+ __query["pretty"] = pretty
3133
+ __headers = {"accept": "application/json"}
3134
+ return self.perform_request( # type: ignore[return-value]
3135
+ "GET",
3136
+ __path,
3137
+ params=__query,
3138
+ headers=__headers,
3139
+ endpoint_id="indices.get_sample",
3140
+ path_parts=__path_parts,
3141
+ )
3142
+
3143
+ @_rewrite_parameters()
3144
+ @_availability_warning(Stability.EXPERIMENTAL)
3145
+ def get_sample_configuration(
3146
+ self,
3147
+ *,
3148
+ index: str,
3149
+ error_trace: t.Optional[bool] = None,
3150
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3151
+ human: t.Optional[bool] = None,
3152
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3153
+ pretty: t.Optional[bool] = None,
3154
+ ) -> ObjectApiResponse[t.Any]:
3155
+ """
3156
+ .. raw:: html
3157
+
3158
+ <p>Get sampling configuration.</p>
3159
+ <p>Get the sampling configuration for the specified index.</p>
3160
+
3161
+
3162
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
3163
+
3164
+ :param index: The name of the index.
3165
+ :param master_timeout: Period to wait for a connection to the master node. If
3166
+ no response is received before the timeout expires, the request fails and
3167
+ returns an error.
3168
+ """
3169
+ if index in SKIP_IN_PATH:
3170
+ raise ValueError("Empty value passed for parameter 'index'")
3171
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
3172
+ __path = f'/{__path_parts["index"]}/_sample/config'
3173
+ __query: t.Dict[str, t.Any] = {}
3174
+ if error_trace is not None:
3175
+ __query["error_trace"] = error_trace
3176
+ if filter_path is not None:
3177
+ __query["filter_path"] = filter_path
3178
+ if human is not None:
3179
+ __query["human"] = human
3180
+ if master_timeout is not None:
3181
+ __query["master_timeout"] = master_timeout
3182
+ if pretty is not None:
3183
+ __query["pretty"] = pretty
3184
+ __headers = {"accept": "application/json"}
3185
+ return self.perform_request( # type: ignore[return-value]
3186
+ "GET",
3187
+ __path,
3188
+ params=__query,
3189
+ headers=__headers,
3190
+ endpoint_id="indices.get_sample_configuration",
3191
+ path_parts=__path_parts,
3192
+ )
3193
+
3194
+ @_rewrite_parameters()
3195
+ @_availability_warning(Stability.EXPERIMENTAL)
3196
+ def get_sample_stats(
3197
+ self,
3198
+ *,
3199
+ index: str,
3200
+ error_trace: t.Optional[bool] = None,
3201
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3202
+ human: t.Optional[bool] = None,
3203
+ pretty: t.Optional[bool] = None,
3204
+ ) -> ObjectApiResponse[t.Any]:
3205
+ """
3206
+ .. raw:: html
3207
+
3208
+ <p>Request stats for a random sample of raw documents ingested into the given index or data stream.</p>
3209
+
3210
+
3211
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
3212
+
3213
+ :param index: Single index or data stream name. Wildcards are not supported.
3214
+ """
3215
+ if index in SKIP_IN_PATH:
3216
+ raise ValueError("Empty value passed for parameter 'index'")
3217
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
3218
+ __path = f'/{__path_parts["index"]}/_sample/stats'
3219
+ __query: t.Dict[str, t.Any] = {}
3220
+ if error_trace is not None:
3221
+ __query["error_trace"] = error_trace
3222
+ if filter_path is not None:
3223
+ __query["filter_path"] = filter_path
3224
+ if human is not None:
3225
+ __query["human"] = human
3226
+ if pretty is not None:
3227
+ __query["pretty"] = pretty
3228
+ __headers = {"accept": "application/json"}
3229
+ return self.perform_request( # type: ignore[return-value]
3230
+ "GET",
3231
+ __path,
3232
+ params=__query,
3233
+ headers=__headers,
3234
+ endpoint_id="indices.get_sample_stats",
3235
+ path_parts=__path_parts,
3236
+ )
3237
+
2991
3238
  @_rewrite_parameters()
2992
3239
  def get_settings(
2993
3240
  self,
@@ -3511,12 +3758,12 @@ class IndicesClient(NamespacedClient):
3511
3758
  filter: t.Optional[t.Mapping[str, t.Any]] = None,
3512
3759
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3513
3760
  human: t.Optional[bool] = None,
3514
- index_routing: t.Optional[str] = None,
3761
+ index_routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3515
3762
  is_write_index: t.Optional[bool] = None,
3516
3763
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3517
3764
  pretty: t.Optional[bool] = None,
3518
- routing: t.Optional[str] = None,
3519
- search_routing: t.Optional[str] = None,
3765
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3766
+ search_routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3520
3767
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3521
3768
  body: t.Optional[t.Dict[str, t.Any]] = None,
3522
3769
  ) -> ObjectApiResponse[t.Any]:
@@ -3602,7 +3849,12 @@ class IndicesClient(NamespacedClient):
3602
3849
  )
3603
3850
 
3604
3851
  @_rewrite_parameters(
3605
- body_fields=("data_retention", "downsampling", "enabled"),
3852
+ body_fields=(
3853
+ "data_retention",
3854
+ "downsampling",
3855
+ "downsampling_method",
3856
+ "enabled",
3857
+ ),
3606
3858
  )
3607
3859
  def put_data_lifecycle(
3608
3860
  self,
@@ -3610,6 +3862,9 @@ class IndicesClient(NamespacedClient):
3610
3862
  name: t.Union[str, t.Sequence[str]],
3611
3863
  data_retention: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3612
3864
  downsampling: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
3865
+ downsampling_method: t.Optional[
3866
+ t.Union[str, t.Literal["aggregate", "last_value"]]
3867
+ ] = None,
3613
3868
  enabled: t.Optional[bool] = None,
3614
3869
  error_trace: t.Optional[bool] = None,
3615
3870
  expand_wildcards: t.Optional[
@@ -3644,6 +3899,9 @@ class IndicesClient(NamespacedClient):
3644
3899
  will be stored indefinitely.
3645
3900
  :param downsampling: The downsampling configuration to execute for the managed
3646
3901
  backing index after rollover.
3902
+ :param downsampling_method: The method used to downsample the data. There are
3903
+ two options `aggregate` and `last_value`. It requires `downsampling` to be
3904
+ defined. Defaults to `aggregate`.
3647
3905
  :param enabled: If defined, it turns data stream lifecycle on/off (`true`/`false`)
3648
3906
  for this data stream. A data stream lifecycle that's disabled (enabled: `false`)
3649
3907
  will have no effect on the data stream.
@@ -3680,6 +3938,8 @@ class IndicesClient(NamespacedClient):
3680
3938
  __body["data_retention"] = data_retention
3681
3939
  if downsampling is not None:
3682
3940
  __body["downsampling"] = downsampling
3941
+ if downsampling_method is not None:
3942
+ __body["downsampling_method"] = downsampling_method
3683
3943
  if enabled is not None:
3684
3944
  __body["enabled"] = enabled
3685
3945
  __headers = {"accept": "application/json", "content-type": "application/json"}
@@ -4015,7 +4275,8 @@ class IndicesClient(NamespacedClient):
4015
4275
  :param ignore_missing_component_templates: The configuration option ignore_missing_component_templates
4016
4276
  can be used when an index template references a component template that might
4017
4277
  not exist
4018
- :param index_patterns: Name of the index template to create.
4278
+ :param index_patterns: Array of wildcard (`*`) expressions used to match the
4279
+ names of data streams and indices during creation.
4019
4280
  :param master_timeout: Period to wait for a connection to the master node. If
4020
4281
  no response is received before the timeout expires, the request fails and
4021
4282
  returns an error.
@@ -4265,6 +4526,95 @@ class IndicesClient(NamespacedClient):
4265
4526
  path_parts=__path_parts,
4266
4527
  )
4267
4528
 
4529
+ @_rewrite_parameters(
4530
+ body_fields=("rate", "if_", "max_samples", "max_size", "time_to_live"),
4531
+ parameter_aliases={"if": "if_"},
4532
+ )
4533
+ @_availability_warning(Stability.EXPERIMENTAL)
4534
+ def put_sample_configuration(
4535
+ self,
4536
+ *,
4537
+ index: str,
4538
+ rate: t.Optional[t.Union[str, t.Any]] = None,
4539
+ error_trace: t.Optional[bool] = None,
4540
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4541
+ human: t.Optional[bool] = None,
4542
+ if_: t.Optional[str] = None,
4543
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4544
+ max_samples: t.Optional[int] = None,
4545
+ max_size: t.Optional[t.Union[int, str]] = None,
4546
+ pretty: t.Optional[bool] = None,
4547
+ time_to_live: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4548
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4549
+ body: t.Optional[t.Dict[str, t.Any]] = None,
4550
+ ) -> ObjectApiResponse[t.Any]:
4551
+ """
4552
+ .. raw:: html
4553
+
4554
+ <p>Create or update sampling configuration.</p>
4555
+ <p>Create or update the sampling configuration for the specified index.</p>
4556
+
4557
+
4558
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
4559
+
4560
+ :param index: The name of the index or data stream.
4561
+ :param rate: The fraction of documents to sample. Must be greater than 0 and
4562
+ less than or equal to 1. Can be specified as a number or a string.
4563
+ :param if_: An optional condition script that sampled documents must satisfy.
4564
+ :param master_timeout: Period to wait for a connection to the master node. If
4565
+ no response is received before the timeout expires, the request fails and
4566
+ returns an error.
4567
+ :param max_samples: The maximum number of documents to sample. Must be greater
4568
+ than 0 and less than or equal to 10,000.
4569
+ :param max_size: The maximum total size of sampled documents. Must be greater
4570
+ than 0 and less than or equal to 5GB.
4571
+ :param time_to_live: The duration for which the sampled documents should be retained.
4572
+ Must be greater than 0 and less than or equal to 30 days.
4573
+ :param timeout: Period to wait for a response. If no response is received before
4574
+ the timeout expires, the request fails and returns an error.
4575
+ """
4576
+ if index in SKIP_IN_PATH:
4577
+ raise ValueError("Empty value passed for parameter 'index'")
4578
+ if rate is None and body is None:
4579
+ raise ValueError("Empty value passed for parameter 'rate'")
4580
+ __path_parts: t.Dict[str, str] = {"index": _quote(index)}
4581
+ __path = f'/{__path_parts["index"]}/_sample/config'
4582
+ __query: t.Dict[str, t.Any] = {}
4583
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
4584
+ if error_trace is not None:
4585
+ __query["error_trace"] = error_trace
4586
+ if filter_path is not None:
4587
+ __query["filter_path"] = filter_path
4588
+ if human is not None:
4589
+ __query["human"] = human
4590
+ if master_timeout is not None:
4591
+ __query["master_timeout"] = master_timeout
4592
+ if pretty is not None:
4593
+ __query["pretty"] = pretty
4594
+ if timeout is not None:
4595
+ __query["timeout"] = timeout
4596
+ if not __body:
4597
+ if rate is not None:
4598
+ __body["rate"] = rate
4599
+ if if_ is not None:
4600
+ __body["if"] = if_
4601
+ if max_samples is not None:
4602
+ __body["max_samples"] = max_samples
4603
+ if max_size is not None:
4604
+ __body["max_size"] = max_size
4605
+ if time_to_live is not None:
4606
+ __body["time_to_live"] = time_to_live
4607
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4608
+ return self.perform_request( # type: ignore[return-value]
4609
+ "PUT",
4610
+ __path,
4611
+ params=__query,
4612
+ headers=__headers,
4613
+ body=__body,
4614
+ endpoint_id="indices.put_sample_configuration",
4615
+ path_parts=__path_parts,
4616
+ )
4617
+
4268
4618
  @_rewrite_parameters(
4269
4619
  body_name="settings",
4270
4620
  )
@@ -4801,7 +5151,7 @@ class IndicesClient(NamespacedClient):
4801
5151
  def remove_block(
4802
5152
  self,
4803
5153
  *,
4804
- index: str,
5154
+ index: t.Union[str, t.Sequence[str]],
4805
5155
  block: t.Union[str, t.Literal["metadata", "read", "read_only", "write"]],
4806
5156
  allow_no_indices: t.Optional[bool] = None,
4807
5157
  error_trace: t.Optional[bool] = None,
@@ -5033,7 +5383,9 @@ class IndicesClient(NamespacedClient):
5033
5383
  path_parts=__path_parts,
5034
5384
  )
5035
5385
 
5036
- @_rewrite_parameters()
5386
+ @_rewrite_parameters(
5387
+ body_fields=("project_routing",),
5388
+ )
5037
5389
  def resolve_index(
5038
5390
  self,
5039
5391
  *,
@@ -5063,6 +5415,7 @@ class IndicesClient(NamespacedClient):
5063
5415
  ] = None,
5064
5416
  pretty: t.Optional[bool] = None,
5065
5417
  project_routing: t.Optional[str] = None,
5418
+ body: t.Optional[t.Dict[str, t.Any]] = None,
5066
5419
  ) -> ObjectApiResponse[t.Any]:
5067
5420
  """
5068
5421
  .. raw:: html
@@ -5100,6 +5453,7 @@ class IndicesClient(NamespacedClient):
5100
5453
  __path_parts: t.Dict[str, str] = {"name": _quote(name)}
5101
5454
  __path = f'/_resolve/index/{__path_parts["name"]}'
5102
5455
  __query: t.Dict[str, t.Any] = {}
5456
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
5103
5457
  if allow_no_indices is not None:
5104
5458
  __query["allow_no_indices"] = allow_no_indices
5105
5459
  if error_trace is not None:
@@ -5116,14 +5470,20 @@ class IndicesClient(NamespacedClient):
5116
5470
  __query["mode"] = mode
5117
5471
  if pretty is not None:
5118
5472
  __query["pretty"] = pretty
5119
- if project_routing is not None:
5120
- __query["project_routing"] = project_routing
5473
+ if not __body:
5474
+ if project_routing is not None:
5475
+ __body["project_routing"] = project_routing
5476
+ if not __body:
5477
+ __body = None # type: ignore[assignment]
5121
5478
  __headers = {"accept": "application/json"}
5479
+ if __body is not None:
5480
+ __headers["content-type"] = "application/json"
5122
5481
  return self.perform_request( # type: ignore[return-value]
5123
- "GET",
5482
+ "POST",
5124
5483
  __path,
5125
5484
  params=__query,
5126
5485
  headers=__headers,
5486
+ body=__body,
5127
5487
  endpoint_id="indices.resolve_index",
5128
5488
  path_parts=__path_parts,
5129
5489
  )
@@ -5902,7 +6262,66 @@ class IndicesClient(NamespacedClient):
5902
6262
  self,
5903
6263
  *,
5904
6264
  index: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5905
- metric: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6265
+ metric: t.Optional[
6266
+ t.Union[
6267
+ t.Sequence[
6268
+ t.Union[
6269
+ str,
6270
+ t.Literal[
6271
+ "_all",
6272
+ "bulk",
6273
+ "completion",
6274
+ "dense_vector",
6275
+ "docs",
6276
+ "fielddata",
6277
+ "flush",
6278
+ "get",
6279
+ "indexing",
6280
+ "mappings",
6281
+ "merge",
6282
+ "query_cache",
6283
+ "recovery",
6284
+ "refresh",
6285
+ "request_cache",
6286
+ "search",
6287
+ "segments",
6288
+ "shard_stats",
6289
+ "sparse_vector",
6290
+ "store",
6291
+ "translog",
6292
+ "warmer",
6293
+ ],
6294
+ ]
6295
+ ],
6296
+ t.Union[
6297
+ str,
6298
+ t.Literal[
6299
+ "_all",
6300
+ "bulk",
6301
+ "completion",
6302
+ "dense_vector",
6303
+ "docs",
6304
+ "fielddata",
6305
+ "flush",
6306
+ "get",
6307
+ "indexing",
6308
+ "mappings",
6309
+ "merge",
6310
+ "query_cache",
6311
+ "recovery",
6312
+ "refresh",
6313
+ "request_cache",
6314
+ "search",
6315
+ "segments",
6316
+ "shard_stats",
6317
+ "sparse_vector",
6318
+ "store",
6319
+ "translog",
6320
+ "warmer",
6321
+ ],
6322
+ ],
6323
+ ]
6324
+ ] = None,
5906
6325
  completion_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5907
6326
  error_trace: t.Optional[bool] = None,
5908
6327
  expand_wildcards: t.Optional[