elasticsearch 8.15.1__py3-none-any.whl → 8.16.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 (94) hide show
  1. elasticsearch/_async/client/__init__.py +198 -117
  2. elasticsearch/_async/client/async_search.py +25 -25
  3. elasticsearch/_async/client/autoscaling.py +24 -11
  4. elasticsearch/_async/client/cat.py +75 -66
  5. elasticsearch/_async/client/ccr.py +13 -13
  6. elasticsearch/_async/client/cluster.py +40 -37
  7. elasticsearch/_async/client/connector.py +112 -51
  8. elasticsearch/_async/client/dangling_indices.py +27 -12
  9. elasticsearch/_async/client/enrich.py +10 -10
  10. elasticsearch/_async/client/eql.py +4 -4
  11. elasticsearch/_async/client/esql.py +42 -4
  12. elasticsearch/_async/client/features.py +4 -3
  13. elasticsearch/_async/client/fleet.py +10 -2
  14. elasticsearch/_async/client/graph.py +1 -1
  15. elasticsearch/_async/client/ilm.py +16 -12
  16. elasticsearch/_async/client/indices.py +176 -108
  17. elasticsearch/_async/client/inference.py +15 -5
  18. elasticsearch/_async/client/ingest.py +28 -12
  19. elasticsearch/_async/client/license.py +10 -10
  20. elasticsearch/_async/client/logstash.py +3 -3
  21. elasticsearch/_async/client/migration.py +3 -3
  22. elasticsearch/_async/client/ml.py +294 -291
  23. elasticsearch/_async/client/monitoring.py +1 -1
  24. elasticsearch/_async/client/nodes.py +16 -8
  25. elasticsearch/_async/client/query_rules.py +61 -8
  26. elasticsearch/_async/client/rollup.py +23 -9
  27. elasticsearch/_async/client/search_application.py +35 -16
  28. elasticsearch/_async/client/searchable_snapshots.py +13 -5
  29. elasticsearch/_async/client/security.py +371 -180
  30. elasticsearch/_async/client/slm.py +9 -9
  31. elasticsearch/_async/client/snapshot.py +97 -12
  32. elasticsearch/_async/client/sql.py +11 -7
  33. elasticsearch/_async/client/ssl.py +18 -3
  34. elasticsearch/_async/client/synonyms.py +7 -7
  35. elasticsearch/_async/client/tasks.py +19 -9
  36. elasticsearch/_async/client/text_structure.py +2 -2
  37. elasticsearch/_async/client/transform.py +78 -72
  38. elasticsearch/_async/client/utils.py +4 -0
  39. elasticsearch/_async/client/watcher.py +11 -11
  40. elasticsearch/_async/client/xpack.py +5 -3
  41. elasticsearch/_async/helpers.py +19 -10
  42. elasticsearch/_otel.py +2 -2
  43. elasticsearch/_sync/client/__init__.py +198 -117
  44. elasticsearch/_sync/client/async_search.py +25 -25
  45. elasticsearch/_sync/client/autoscaling.py +24 -11
  46. elasticsearch/_sync/client/cat.py +75 -66
  47. elasticsearch/_sync/client/ccr.py +13 -13
  48. elasticsearch/_sync/client/cluster.py +40 -37
  49. elasticsearch/_sync/client/connector.py +112 -51
  50. elasticsearch/_sync/client/dangling_indices.py +27 -12
  51. elasticsearch/_sync/client/enrich.py +10 -10
  52. elasticsearch/_sync/client/eql.py +4 -4
  53. elasticsearch/_sync/client/esql.py +42 -4
  54. elasticsearch/_sync/client/features.py +4 -3
  55. elasticsearch/_sync/client/fleet.py +10 -2
  56. elasticsearch/_sync/client/graph.py +1 -1
  57. elasticsearch/_sync/client/ilm.py +16 -12
  58. elasticsearch/_sync/client/indices.py +176 -108
  59. elasticsearch/_sync/client/inference.py +15 -5
  60. elasticsearch/_sync/client/ingest.py +28 -12
  61. elasticsearch/_sync/client/license.py +10 -10
  62. elasticsearch/_sync/client/logstash.py +3 -3
  63. elasticsearch/_sync/client/migration.py +3 -3
  64. elasticsearch/_sync/client/ml.py +294 -291
  65. elasticsearch/_sync/client/monitoring.py +1 -1
  66. elasticsearch/_sync/client/nodes.py +16 -8
  67. elasticsearch/_sync/client/query_rules.py +61 -8
  68. elasticsearch/_sync/client/rollup.py +23 -9
  69. elasticsearch/_sync/client/search_application.py +35 -16
  70. elasticsearch/_sync/client/searchable_snapshots.py +13 -5
  71. elasticsearch/_sync/client/security.py +371 -180
  72. elasticsearch/_sync/client/slm.py +9 -9
  73. elasticsearch/_sync/client/snapshot.py +97 -12
  74. elasticsearch/_sync/client/sql.py +11 -7
  75. elasticsearch/_sync/client/ssl.py +18 -3
  76. elasticsearch/_sync/client/synonyms.py +7 -7
  77. elasticsearch/_sync/client/tasks.py +19 -9
  78. elasticsearch/_sync/client/text_structure.py +2 -2
  79. elasticsearch/_sync/client/transform.py +78 -72
  80. elasticsearch/_sync/client/utils.py +40 -0
  81. elasticsearch/_sync/client/watcher.py +11 -11
  82. elasticsearch/_sync/client/xpack.py +5 -3
  83. elasticsearch/_version.py +1 -1
  84. elasticsearch/exceptions.py +4 -0
  85. elasticsearch/helpers/actions.py +19 -10
  86. elasticsearch/helpers/errors.py +12 -4
  87. elasticsearch/helpers/vectorstore/_async/strategies.py +30 -9
  88. elasticsearch/helpers/vectorstore/_sync/strategies.py +30 -9
  89. {elasticsearch-8.15.1.dist-info → elasticsearch-8.16.0.dist-info}/METADATA +5 -6
  90. elasticsearch-8.16.0.dist-info/RECORD +117 -0
  91. {elasticsearch-8.15.1.dist-info → elasticsearch-8.16.0.dist-info}/WHEEL +1 -1
  92. elasticsearch-8.15.1.dist-info/RECORD +0 -117
  93. {elasticsearch-8.15.1.dist-info → elasticsearch-8.16.0.dist-info}/licenses/LICENSE +0 -0
  94. {elasticsearch-8.15.1.dist-info → elasticsearch-8.16.0.dist-info}/licenses/NOTICE +0 -0
@@ -39,9 +39,9 @@ class TransformClient(NamespacedClient):
39
39
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
40
40
  ) -> ObjectApiResponse[t.Any]:
41
41
  """
42
- Deletes a transform.
42
+ Delete a transform. Deletes a transform.
43
43
 
44
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/delete-transform.html>`_
44
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/delete-transform.html>`_
45
45
 
46
46
  :param transform_id: Identifier for the transform.
47
47
  :param delete_dest_index: If this value is true, the destination index is deleted
@@ -99,9 +99,9 @@ class TransformClient(NamespacedClient):
99
99
  size: t.Optional[int] = None,
100
100
  ) -> ObjectApiResponse[t.Any]:
101
101
  """
102
- Retrieves configuration information for transforms.
102
+ Get transforms. Retrieves configuration information for transforms.
103
103
 
104
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-transform.html>`_
104
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-transform.html>`_
105
105
 
106
106
  :param transform_id: Identifier for the transform. It can be a transform identifier
107
107
  or a wildcard expression. You can get information for all transforms by using
@@ -168,9 +168,9 @@ class TransformClient(NamespacedClient):
168
168
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
169
169
  ) -> ObjectApiResponse[t.Any]:
170
170
  """
171
- Retrieves usage information for transforms.
171
+ Get transform stats. Retrieves usage information for transforms.
172
172
 
173
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/get-transform-stats.html>`_
173
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/get-transform-stats.html>`_
174
174
 
175
175
  :param transform_id: Identifier for the transform. It can be a transform identifier
176
176
  or a wildcard expression. You can get information for all transforms by using
@@ -249,12 +249,14 @@ class TransformClient(NamespacedClient):
249
249
  body: t.Optional[t.Dict[str, t.Any]] = None,
250
250
  ) -> ObjectApiResponse[t.Any]:
251
251
  """
252
- Previews a transform. It returns a maximum of 100 results. The calculations are
253
- based on all the current data in the source index. It also generates a list of
254
- mappings and settings for the destination index. These values are determined
255
- based on the field types of the source index and the transform aggregations.
252
+ Preview a transform. Generates a preview of the results that you will get when
253
+ you create a transform with the same configuration. It returns a maximum of 100
254
+ results. The calculations are based on all the current data in the source index.
255
+ It also generates a list of mappings and settings for the destination index.
256
+ These values are determined based on the field types of the source index and
257
+ the transform aggregations.
256
258
 
257
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/preview-transform.html>`_
259
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/preview-transform.html>`_
258
260
 
259
261
  :param transform_id: Identifier for the transform to preview. If you specify
260
262
  this path parameter, you cannot provide transform configuration details in
@@ -369,28 +371,29 @@ class TransformClient(NamespacedClient):
369
371
  body: t.Optional[t.Dict[str, t.Any]] = None,
370
372
  ) -> ObjectApiResponse[t.Any]:
371
373
  """
372
- Creates a transform. A transform copies data from source indices, transforms
373
- it, and persists it into an entity-centric destination index. You can also think
374
- of the destination index as a two-dimensional tabular data structure (known as
375
- a data frame). The ID for each document in the data frame is generated from a
376
- hash of the entity, so there is a unique row per entity. You must choose either
377
- the latest or pivot method for your transform; you cannot use both in a single
378
- transform. If you choose to use the pivot method for your transform, the entities
379
- are defined by the set of `group_by` fields in the pivot object. If you choose
380
- to use the latest method, the entities are defined by the `unique_key` field
381
- values in the latest object. You must have `create_index`, `index`, and `read`
382
- privileges on the destination index and `read` and `view_index_metadata` privileges
383
- on the source indices. When Elasticsearch security features are enabled, the
384
- transform remembers which roles the user that created it had at the time of creation
385
- and uses those same roles. If those roles do not have the required privileges
386
- on the source and destination indices, the transform fails when it attempts unauthorized
387
- operations. NOTE: You must use Kibana or this API to create a transform. Do not
388
- add a transform directly into any `.transform-internal*` indices using the Elasticsearch
389
- index API. If Elasticsearch security features are enabled, do not give users
390
- any privileges on `.transform-internal*` indices. If you used transforms prior
391
- to 7.5, also do not give users any privileges on `.data-frame-internal*` indices.
392
-
393
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/put-transform.html>`_
374
+ Create a transform. Creates a transform. A transform copies data from source
375
+ indices, transforms it, and persists it into an entity-centric destination index.
376
+ You can also think of the destination index as a two-dimensional tabular data
377
+ structure (known as a data frame). The ID for each document in the data frame
378
+ is generated from a hash of the entity, so there is a unique row per entity.
379
+ You must choose either the latest or pivot method for your transform; you cannot
380
+ use both in a single transform. If you choose to use the pivot method for your
381
+ transform, the entities are defined by the set of `group_by` fields in the pivot
382
+ object. If you choose to use the latest method, the entities are defined by the
383
+ `unique_key` field values in the latest object. You must have `create_index`,
384
+ `index`, and `read` privileges on the destination index and `read` and `view_index_metadata`
385
+ privileges on the source indices. When Elasticsearch security features are enabled,
386
+ the transform remembers which roles the user that created it had at the time
387
+ of creation and uses those same roles. If those roles do not have the required
388
+ privileges on the source and destination indices, the transform fails when it
389
+ attempts unauthorized operations. NOTE: You must use Kibana or this API to create
390
+ a transform. Do not add a transform directly into any `.transform-internal*`
391
+ indices using the Elasticsearch index API. If Elasticsearch security features
392
+ are enabled, do not give users any privileges on `.transform-internal*` indices.
393
+ If you used transforms prior to 7.5, also do not give users any privileges on
394
+ `.data-frame-internal*` indices.
395
+
396
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/put-transform.html>`_
394
397
 
395
398
  :param transform_id: Identifier for the transform. This identifier can contain
396
399
  lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
@@ -488,11 +491,11 @@ class TransformClient(NamespacedClient):
488
491
  pretty: t.Optional[bool] = None,
489
492
  ) -> ObjectApiResponse[t.Any]:
490
493
  """
491
- Resets a transform. Before you can reset it, you must stop it; alternatively,
492
- use the `force` query parameter. If the destination index was created by the
493
- transform, it is deleted.
494
+ Reset a transform. Resets a transform. Before you can reset it, you must stop
495
+ it; alternatively, use the `force` query parameter. If the destination index
496
+ was created by the transform, it is deleted.
494
497
 
495
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/reset-transform.html>`_
498
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/reset-transform.html>`_
496
499
 
497
500
  :param transform_id: Identifier for the transform. This identifier can contain
498
501
  lowercase alphanumeric characters (a-z and 0-9), hyphens, and underscores.
@@ -538,12 +541,13 @@ class TransformClient(NamespacedClient):
538
541
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
539
542
  ) -> ObjectApiResponse[t.Any]:
540
543
  """
541
- Schedules now a transform. If you _schedule_now a transform, it will process
542
- the new data instantly, without waiting for the configured frequency interval.
543
- After _schedule_now API is called, the transform will be processed again at now
544
- + frequency unless _schedule_now API is called again in the meantime.
544
+ Schedule a transform to start now. Instantly runs a transform to process data.
545
+ If you _schedule_now a transform, it will process the new data instantly, without
546
+ waiting for the configured frequency interval. After _schedule_now API is called,
547
+ the transform will be processed again at now + frequency unless _schedule_now
548
+ API is called again in the meantime.
545
549
 
546
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/schedule-now-transform.html>`_
550
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/schedule-now-transform.html>`_
547
551
 
548
552
  :param transform_id: Identifier for the transform.
549
553
  :param timeout: Controls the time to wait for the scheduling to take place
@@ -588,25 +592,26 @@ class TransformClient(NamespacedClient):
588
592
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
589
593
  ) -> ObjectApiResponse[t.Any]:
590
594
  """
591
- Starts a transform. When you start a transform, it creates the destination index
592
- if it does not already exist. The `number_of_shards` is set to `1` and the `auto_expand_replicas`
593
- is set to `0-1`. If it is a pivot transform, it deduces the mapping definitions
594
- for the destination index from the source indices and the transform aggregations.
595
- If fields in the destination index are derived from scripts (as in the case of
596
- `scripted_metric` or `bucket_script` aggregations), the transform uses dynamic
597
- mappings unless an index template exists. If it is a latest transform, it does
598
- not deduce mapping definitions; it uses dynamic mappings. To use explicit mappings,
599
- create the destination index before you start the transform. Alternatively, you
600
- can create an index template, though it does not affect the deduced mappings
601
- in a pivot transform. When the transform starts, a series of validations occur
602
- to ensure its success. If you deferred validation when you created the transform,
603
- they occur when you start the transform—​with the exception of privilege checks.
604
- When Elasticsearch security features are enabled, the transform remembers which
605
- roles the user that created it had at the time of creation and uses those same
606
- roles. If those roles do not have the required privileges on the source and destination
607
- indices, the transform fails when it attempts unauthorized operations.
608
-
609
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/start-transform.html>`_
595
+ Start a transform. Starts a transform. When you start a transform, it creates
596
+ the destination index if it does not already exist. The `number_of_shards` is
597
+ set to `1` and the `auto_expand_replicas` is set to `0-1`. If it is a pivot transform,
598
+ it deduces the mapping definitions for the destination index from the source
599
+ indices and the transform aggregations. If fields in the destination index are
600
+ derived from scripts (as in the case of `scripted_metric` or `bucket_script`
601
+ aggregations), the transform uses dynamic mappings unless an index template exists.
602
+ If it is a latest transform, it does not deduce mapping definitions; it uses
603
+ dynamic mappings. To use explicit mappings, create the destination index before
604
+ you start the transform. Alternatively, you can create an index template, though
605
+ it does not affect the deduced mappings in a pivot transform. When the transform
606
+ starts, a series of validations occur to ensure its success. If you deferred
607
+ validation when you created the transform, they occur when you start the transform—​with
608
+ the exception of privilege checks. When Elasticsearch security features are enabled,
609
+ the transform remembers which roles the user that created it had at the time
610
+ of creation and uses those same roles. If those roles do not have the required
611
+ privileges on the source and destination indices, the transform fails when it
612
+ attempts unauthorized operations.
613
+
614
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/start-transform.html>`_
610
615
 
611
616
  :param transform_id: Identifier for the transform.
612
617
  :param from_: Restricts the set of transformed entities to those changed after
@@ -658,9 +663,9 @@ class TransformClient(NamespacedClient):
658
663
  wait_for_completion: t.Optional[bool] = None,
659
664
  ) -> ObjectApiResponse[t.Any]:
660
665
  """
661
- Stops one or more transforms.
666
+ Stop transforms. Stops one or more transforms.
662
667
 
663
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/stop-transform.html>`_
668
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/stop-transform.html>`_
664
669
 
665
670
  :param transform_id: Identifier for the transform. To stop multiple transforms,
666
671
  use a comma-separated list or a wildcard expression. To stop all transforms,
@@ -751,15 +756,16 @@ class TransformClient(NamespacedClient):
751
756
  body: t.Optional[t.Dict[str, t.Any]] = None,
752
757
  ) -> ObjectApiResponse[t.Any]:
753
758
  """
754
- Updates certain properties of a transform. All updated properties except `description`
755
- do not take effect until after the transform starts the next checkpoint, thus
756
- there is data consistency in each checkpoint. To use this API, you must have
757
- `read` and `view_index_metadata` privileges for the source indices. You must
758
- also have `index` and `read` privileges for the destination index. When Elasticsearch
759
- security features are enabled, the transform remembers which roles the user who
760
- updated it had at the time of update and runs with those privileges.
759
+ Update a transform. Updates certain properties of a transform. All updated properties
760
+ except `description` do not take effect until after the transform starts the
761
+ next checkpoint, thus there is data consistency in each checkpoint. To use this
762
+ API, you must have `read` and `view_index_metadata` privileges for the source
763
+ indices. You must also have `index` and `read` privileges for the destination
764
+ index. When Elasticsearch security features are enabled, the transform remembers
765
+ which roles the user who updated it had at the time of update and runs with those
766
+ privileges.
761
767
 
762
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/update-transform.html>`_
768
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/update-transform.html>`_
763
769
 
764
770
  :param transform_id: Identifier for the transform.
765
771
  :param defer_validation: When true, deferrable validations are not run. This
@@ -846,7 +852,7 @@ class TransformClient(NamespacedClient):
846
852
  the role used to read source data and write to the destination index remains
847
853
  unchanged.
848
854
 
849
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/upgrade-transforms.html>`_
855
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/upgrade-transforms.html>`_
850
856
 
851
857
  :param dry_run: When true, the request checks for updates but does not run them.
852
858
  :param timeout: Period to wait for a response. If no response is received before
@@ -20,10 +20,12 @@ from ..._sync.client.utils import (
20
20
  _TYPE_HOSTS,
21
21
  CLIENT_META_SERVICE,
22
22
  SKIP_IN_PATH,
23
+ Stability,
23
24
  _base64_auth_header,
24
25
  _quote,
25
26
  _quote_query,
26
27
  _rewrite_parameters,
28
+ _stability_warning,
27
29
  client_node_configs,
28
30
  is_requests_http_auth,
29
31
  is_requests_node_class,
@@ -37,8 +39,10 @@ __all__ = [
37
39
  "_quote_query",
38
40
  "_TYPE_HOSTS",
39
41
  "SKIP_IN_PATH",
42
+ "Stability",
40
43
  "client_node_configs",
41
44
  "_rewrite_parameters",
45
+ "_stability_warning",
42
46
  "is_requests_http_auth",
43
47
  "is_requests_node_class",
44
48
  ]
@@ -39,7 +39,7 @@ class WatcherClient(NamespacedClient):
39
39
  """
40
40
  Acknowledges a watch, manually throttling the execution of the watch's actions.
41
41
 
42
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-ack-watch.html>`_
42
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-ack-watch.html>`_
43
43
 
44
44
  :param watch_id: Watch ID
45
45
  :param action_id: A comma-separated list of the action ids to be acked
@@ -90,7 +90,7 @@ class WatcherClient(NamespacedClient):
90
90
  """
91
91
  Activates a currently inactive watch.
92
92
 
93
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-activate-watch.html>`_
93
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-activate-watch.html>`_
94
94
 
95
95
  :param watch_id: Watch ID
96
96
  """
@@ -130,7 +130,7 @@ class WatcherClient(NamespacedClient):
130
130
  """
131
131
  Deactivates a currently active watch.
132
132
 
133
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-deactivate-watch.html>`_
133
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-deactivate-watch.html>`_
134
134
 
135
135
  :param watch_id: Watch ID
136
136
  """
@@ -170,7 +170,7 @@ class WatcherClient(NamespacedClient):
170
170
  """
171
171
  Removes a watch from Watcher.
172
172
 
173
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-delete-watch.html>`_
173
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-delete-watch.html>`_
174
174
 
175
175
  :param id: Watch ID
176
176
  """
@@ -245,7 +245,7 @@ class WatcherClient(NamespacedClient):
245
245
  and control whether a watch record would be written to the watch history after
246
246
  execution.
247
247
 
248
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-execute-watch.html>`_
248
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-execute-watch.html>`_
249
249
 
250
250
  :param id: Identifier for the watch.
251
251
  :param action_modes: Determines how to handle the watch actions as part of the
@@ -328,7 +328,7 @@ class WatcherClient(NamespacedClient):
328
328
  """
329
329
  Retrieves a watch by its ID.
330
330
 
331
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-get-watch.html>`_
331
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-get-watch.html>`_
332
332
 
333
333
  :param id: Watch ID
334
334
  """
@@ -390,7 +390,7 @@ class WatcherClient(NamespacedClient):
390
390
  """
391
391
  Creates a new watch, or updates an existing one.
392
392
 
393
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-put-watch.html>`_
393
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-put-watch.html>`_
394
394
 
395
395
  :param id: Watch ID
396
396
  :param actions:
@@ -487,7 +487,7 @@ class WatcherClient(NamespacedClient):
487
487
  """
488
488
  Retrieves stored watches.
489
489
 
490
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-query-watches.html>`_
490
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-query-watches.html>`_
491
491
 
492
492
  :param from_: The offset from the first result to fetch. Needs to be non-negative.
493
493
  :param query: Optional, query filter watches to be returned.
@@ -557,7 +557,7 @@ class WatcherClient(NamespacedClient):
557
557
  """
558
558
  Starts Watcher if it is not already running.
559
559
 
560
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-start.html>`_
560
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-start.html>`_
561
561
  """
562
562
  __path_parts: t.Dict[str, str] = {}
563
563
  __path = "/_watcher/_start"
@@ -614,7 +614,7 @@ class WatcherClient(NamespacedClient):
614
614
  """
615
615
  Retrieves the current Watcher metrics.
616
616
 
617
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-stats.html>`_
617
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-stats.html>`_
618
618
 
619
619
  :param metric: Defines which additional metrics are included in the response.
620
620
  :param emit_stacktraces: Defines whether stack traces are generated for each
@@ -660,7 +660,7 @@ class WatcherClient(NamespacedClient):
660
660
  """
661
661
  Stops Watcher if it is running.
662
662
 
663
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/watcher-api-stop.html>`_
663
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/watcher-api-stop.html>`_
664
664
  """
665
665
  __path_parts: t.Dict[str, str] = {}
666
666
  __path = "/_watcher/_stop"
@@ -34,7 +34,9 @@ class XPackClient(NamespacedClient):
34
34
  self,
35
35
  *,
36
36
  accept_enterprise: t.Optional[bool] = None,
37
- categories: t.Optional[t.Sequence[str]] = None,
37
+ categories: t.Optional[
38
+ t.Sequence[t.Union[str, t.Literal["build", "features", "license"]]]
39
+ ] = None,
38
40
  error_trace: t.Optional[bool] = None,
39
41
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
40
42
  human: t.Optional[bool] = None,
@@ -43,7 +45,7 @@ class XPackClient(NamespacedClient):
43
45
  """
44
46
  Provides general information about the installed X-Pack features.
45
47
 
46
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/info-api.html>`_
48
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/info-api.html>`_
47
49
 
48
50
  :param accept_enterprise: If this param is used it must be set to true
49
51
  :param categories: A comma-separated list of the information categories to include
@@ -88,7 +90,7 @@ class XPackClient(NamespacedClient):
88
90
  This API provides information about which features are currently enabled and
89
91
  available under the current license and some usage statistics.
90
92
 
91
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.15/usage-api.html>`_
93
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.16/usage-api.html>`_
92
94
 
93
95
  :param master_timeout: Period to wait for a connection to the master node. If
94
96
  no response is received before the timeout expires, the request fails and
@@ -173,6 +173,7 @@ async def async_streaming_bulk(
173
173
  max_backoff: float = 600,
174
174
  yield_ok: bool = True,
175
175
  ignore_status: Union[int, Collection[int]] = (),
176
+ retry_on_status: Union[int, Collection[int]] = (429,),
176
177
  *args: Any,
177
178
  **kwargs: Any,
178
179
  ) -> AsyncIterable[Tuple[bool, Dict[str, Any]]]:
@@ -184,10 +185,11 @@ async def async_streaming_bulk(
184
185
  entire input is consumed and sent.
185
186
 
186
187
  If you specify ``max_retries`` it will also retry any documents that were
187
- rejected with a ``429`` status code. To do this it will wait (**by calling
188
- asyncio.sleep**) for ``initial_backoff`` seconds and then,
189
- every subsequent rejection for the same chunk, for double the time every
190
- time up to ``max_backoff`` seconds.
188
+ rejected with a ``429`` status code. Use ``retry_on_status`` to
189
+ configure which status codes will be retried. To do this it will wait
190
+ (**by calling asyncio.sleep which will block**) for ``initial_backoff`` seconds
191
+ and then, every subsequent rejection for the same chunk, for double the time
192
+ every time up to ``max_backoff`` seconds.
191
193
 
192
194
  :arg client: instance of :class:`~elasticsearch.AsyncElasticsearch` to use
193
195
  :arg actions: iterable or async iterable containing the actions to be executed
@@ -200,8 +202,11 @@ async def async_streaming_bulk(
200
202
  :arg expand_action_callback: callback executed on each action passed in,
201
203
  should return a tuple containing the action line and the data line
202
204
  (`None` if data line should be omitted).
205
+ :arg retry_on_status: HTTP status code that will trigger a retry.
206
+ (if `None` is specified only status 429 will retry).
203
207
  :arg max_retries: maximum number of times a document will be retried when
204
- ``429`` is received, set to 0 (default) for no retries on ``429``
208
+ retry_on_status (defaulting to ``429``) is received,
209
+ set to 0 (default) for no retries
205
210
  :arg initial_backoff: number of seconds we should wait before the first
206
211
  retry. Any subsequent retries will be powers of ``initial_backoff *
207
212
  2**retry_number``
@@ -213,6 +218,9 @@ async def async_streaming_bulk(
213
218
  client = client.options()
214
219
  client._client_meta = (("h", "bp"),)
215
220
 
221
+ if isinstance(retry_on_status, int):
222
+ retry_on_status = (retry_on_status,)
223
+
216
224
  async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]:
217
225
  async for item in aiter(actions):
218
226
  yield expand_action_callback(item)
@@ -264,11 +272,11 @@ async def async_streaming_bulk(
264
272
  ):
265
273
  if not ok:
266
274
  action, info = info.popitem()
267
- # retry if retries enabled, we get 429, and we are not
268
- # in the last attempt
275
+ # retry if retries enabled, we are not in the last attempt,
276
+ # and status in retry_on_status (defaulting to 429)
269
277
  if (
270
278
  max_retries
271
- and info["status"] == 429
279
+ and info["status"] in retry_on_status
272
280
  and (attempt + 1) <= max_retries
273
281
  ):
274
282
  # _process_bulk_chunk expects strings so we need to
@@ -281,8 +289,9 @@ async def async_streaming_bulk(
281
289
  yield ok, info
282
290
 
283
291
  except ApiError as e:
284
- # suppress 429 errors since we will retry them
285
- if attempt == max_retries or e.status_code != 429:
292
+ # suppress any status in retry_on_status (429 by default)
293
+ # since we will retry them
294
+ if attempt == max_retries or e.status_code not in retry_on_status:
286
295
  raise
287
296
  else:
288
297
  if not to_retry:
elasticsearch/_otel.py CHANGED
@@ -25,7 +25,7 @@ try:
25
25
  from opentelemetry import trace
26
26
 
27
27
  _tracer: trace.Tracer | None = trace.get_tracer("elasticsearch-api")
28
- except ModuleNotFoundError:
28
+ except ImportError:
29
29
  _tracer = None
30
30
 
31
31
  from elastic_transport import OpenTelemetrySpan
@@ -102,7 +102,7 @@ class OpenTelemetry:
102
102
 
103
103
  @contextlib.contextmanager
104
104
  def use_span(self, span: OpenTelemetrySpan) -> Generator[None, None, None]:
105
- if not self.enabled or self.tracer is None:
105
+ if not self.enabled or self.tracer is None or span.otel_span is None:
106
106
  yield
107
107
  return
108
108