elasticsearch 8.19.1__py3-none-any.whl → 8.19.3__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 (112) hide show
  1. elasticsearch/_async/client/__init__.py +66 -67
  2. elasticsearch/_async/client/async_search.py +3 -3
  3. elasticsearch/_async/client/autoscaling.py +8 -4
  4. elasticsearch/_async/client/cat.py +521 -27
  5. elasticsearch/_async/client/ccr.py +2 -2
  6. elasticsearch/_async/client/cluster.py +10 -9
  7. elasticsearch/_async/client/connector.py +37 -36
  8. elasticsearch/_async/client/dangling_indices.py +6 -10
  9. elasticsearch/_async/client/eql.py +2 -2
  10. elasticsearch/_async/client/esql.py +1 -1
  11. elasticsearch/_async/client/features.py +2 -2
  12. elasticsearch/_async/client/fleet.py +4 -8
  13. elasticsearch/_async/client/graph.py +1 -5
  14. elasticsearch/_async/client/ilm.py +2 -10
  15. elasticsearch/_async/client/indices.py +393 -56
  16. elasticsearch/_async/client/inference.py +35 -121
  17. elasticsearch/_async/client/ingest.py +1 -1
  18. elasticsearch/_async/client/license.py +3 -5
  19. elasticsearch/_async/client/ml.py +61 -21
  20. elasticsearch/_async/client/monitoring.py +2 -1
  21. elasticsearch/_async/client/nodes.py +9 -9
  22. elasticsearch/_async/client/rollup.py +9 -9
  23. elasticsearch/_async/client/search_application.py +11 -11
  24. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  25. elasticsearch/_async/client/security.py +4 -4
  26. elasticsearch/_async/client/shutdown.py +12 -17
  27. elasticsearch/_async/client/simulate.py +2 -2
  28. elasticsearch/_async/client/slm.py +2 -6
  29. elasticsearch/_async/client/snapshot.py +3 -2
  30. elasticsearch/_async/client/streams.py +185 -0
  31. elasticsearch/_async/client/tasks.py +4 -4
  32. elasticsearch/_async/client/text_structure.py +5 -1
  33. elasticsearch/_async/client/transform.py +37 -0
  34. elasticsearch/_async/client/utils.py +4 -2
  35. elasticsearch/_async/client/watcher.py +3 -7
  36. elasticsearch/_async/client/xpack.py +2 -1
  37. elasticsearch/_async/helpers.py +58 -9
  38. elasticsearch/_sync/client/__init__.py +68 -67
  39. elasticsearch/_sync/client/async_search.py +3 -3
  40. elasticsearch/_sync/client/autoscaling.py +8 -4
  41. elasticsearch/_sync/client/cat.py +521 -27
  42. elasticsearch/_sync/client/ccr.py +2 -2
  43. elasticsearch/_sync/client/cluster.py +10 -9
  44. elasticsearch/_sync/client/connector.py +37 -36
  45. elasticsearch/_sync/client/dangling_indices.py +6 -10
  46. elasticsearch/_sync/client/eql.py +2 -2
  47. elasticsearch/_sync/client/esql.py +1 -1
  48. elasticsearch/_sync/client/features.py +2 -2
  49. elasticsearch/_sync/client/fleet.py +4 -8
  50. elasticsearch/_sync/client/graph.py +1 -5
  51. elasticsearch/_sync/client/ilm.py +2 -10
  52. elasticsearch/_sync/client/indices.py +393 -56
  53. elasticsearch/_sync/client/inference.py +35 -121
  54. elasticsearch/_sync/client/ingest.py +1 -1
  55. elasticsearch/_sync/client/license.py +3 -5
  56. elasticsearch/_sync/client/ml.py +61 -21
  57. elasticsearch/_sync/client/monitoring.py +2 -1
  58. elasticsearch/_sync/client/nodes.py +9 -9
  59. elasticsearch/_sync/client/rollup.py +9 -9
  60. elasticsearch/_sync/client/search_application.py +11 -11
  61. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  62. elasticsearch/_sync/client/security.py +4 -4
  63. elasticsearch/_sync/client/shutdown.py +12 -17
  64. elasticsearch/_sync/client/simulate.py +2 -2
  65. elasticsearch/_sync/client/slm.py +2 -6
  66. elasticsearch/_sync/client/snapshot.py +3 -2
  67. elasticsearch/_sync/client/streams.py +185 -0
  68. elasticsearch/_sync/client/tasks.py +4 -4
  69. elasticsearch/_sync/client/text_structure.py +5 -1
  70. elasticsearch/_sync/client/transform.py +37 -0
  71. elasticsearch/_sync/client/utils.py +16 -2
  72. elasticsearch/_sync/client/watcher.py +3 -7
  73. elasticsearch/_sync/client/xpack.py +2 -1
  74. elasticsearch/_version.py +2 -1
  75. elasticsearch/client.py +2 -0
  76. elasticsearch/compat.py +45 -1
  77. elasticsearch/dsl/__init__.py +28 -0
  78. elasticsearch/dsl/_async/document.py +4 -5
  79. elasticsearch/dsl/_async/index.py +1 -1
  80. elasticsearch/dsl/_async/search.py +2 -3
  81. elasticsearch/dsl/_sync/document.py +4 -5
  82. elasticsearch/dsl/_sync/index.py +1 -1
  83. elasticsearch/dsl/_sync/search.py +2 -3
  84. elasticsearch/dsl/aggs.py +104 -7
  85. elasticsearch/dsl/async_connections.py +1 -2
  86. elasticsearch/dsl/connections.py +1 -2
  87. elasticsearch/dsl/document_base.py +16 -1
  88. elasticsearch/dsl/field.py +12 -1
  89. elasticsearch/dsl/query.py +24 -1
  90. elasticsearch/dsl/response/__init__.py +3 -0
  91. elasticsearch/dsl/serializer.py +1 -2
  92. elasticsearch/dsl/types.py +187 -9
  93. elasticsearch/dsl/utils.py +1 -2
  94. elasticsearch/esql/esql.py +1 -1
  95. elasticsearch/esql/functions.py +2 -2
  96. elasticsearch/helpers/__init__.py +10 -1
  97. elasticsearch/helpers/actions.py +106 -33
  98. elasticsearch/helpers/vectorstore/__init__.py +7 -7
  99. elasticsearch/helpers/vectorstore/_async/_utils.py +1 -1
  100. elasticsearch/helpers/vectorstore/_async/embedding_service.py +2 -2
  101. elasticsearch/helpers/vectorstore/_async/strategies.py +3 -3
  102. elasticsearch/helpers/vectorstore/_async/vectorstore.py +5 -5
  103. elasticsearch/helpers/vectorstore/_sync/_utils.py +1 -1
  104. elasticsearch/helpers/vectorstore/_sync/embedding_service.py +2 -2
  105. elasticsearch/helpers/vectorstore/_sync/strategies.py +3 -3
  106. elasticsearch/helpers/vectorstore/_sync/vectorstore.py +5 -5
  107. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/METADATA +2 -2
  108. elasticsearch-8.19.3.dist-info/RECORD +166 -0
  109. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/WHEEL +1 -1
  110. elasticsearch-8.19.1.dist-info/RECORD +0 -164
  111. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/licenses/LICENSE +0 -0
  112. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.3.dist-info}/licenses/NOTICE +0 -0
@@ -85,6 +85,43 @@ class TransformClient(NamespacedClient):
85
85
  path_parts=__path_parts,
86
86
  )
87
87
 
88
+ @_rewrite_parameters()
89
+ async def get_node_stats(
90
+ self,
91
+ *,
92
+ error_trace: t.Optional[bool] = None,
93
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
94
+ human: t.Optional[bool] = None,
95
+ pretty: t.Optional[bool] = None,
96
+ ) -> ObjectApiResponse[t.Any]:
97
+ """
98
+ .. raw:: html
99
+
100
+ <p>Get node stats.</p>
101
+ <p>Get per-node information about transform usage.</p>
102
+
103
+ """
104
+ __path_parts: t.Dict[str, str] = {}
105
+ __path = "/_transform/_node_stats"
106
+ __query: t.Dict[str, t.Any] = {}
107
+ if error_trace is not None:
108
+ __query["error_trace"] = error_trace
109
+ if filter_path is not None:
110
+ __query["filter_path"] = filter_path
111
+ if human is not None:
112
+ __query["human"] = human
113
+ if pretty is not None:
114
+ __query["pretty"] = pretty
115
+ __headers = {"accept": "application/json"}
116
+ return await self.perform_request( # type: ignore[return-value]
117
+ "GET",
118
+ __path,
119
+ params=__query,
120
+ headers=__headers,
121
+ endpoint_id="transform.get_node_stats",
122
+ path_parts=__path_parts,
123
+ )
124
+
88
125
  @_rewrite_parameters(
89
126
  parameter_aliases={"from": "from_"},
90
127
  )
@@ -21,11 +21,12 @@ from ..._sync.client.utils import (
21
21
  CLIENT_META_SERVICE,
22
22
  SKIP_IN_PATH,
23
23
  Stability,
24
+ Visibility,
25
+ _availability_warning,
24
26
  _base64_auth_header,
25
27
  _quote,
26
28
  _quote_query,
27
29
  _rewrite_parameters,
28
- _stability_warning,
29
30
  client_node_configs,
30
31
  is_requests_http_auth,
31
32
  is_requests_node_class,
@@ -40,9 +41,10 @@ __all__ = [
40
41
  "_TYPE_HOSTS",
41
42
  "SKIP_IN_PATH",
42
43
  "Stability",
44
+ "Visibility",
43
45
  "client_node_configs",
44
46
  "_rewrite_parameters",
45
- "_stability_warning",
47
+ "_availability_warning",
46
48
  "is_requests_http_auth",
47
49
  "is_requests_node_class",
48
50
  ]
@@ -492,9 +492,9 @@ class WatcherClient(NamespacedClient):
492
492
  :param active: The initial state of the watch. The default value is `true`, which
493
493
  means the watch is active by default.
494
494
  :param condition: The condition that defines if the actions should be run.
495
- :param if_primary_term: only update the watch if the last operation that has
495
+ :param if_primary_term: Only update the watch if the last operation that has
496
496
  changed the watch has the specified primary term
497
- :param if_seq_no: only update the watch if the last operation that has changed
497
+ :param if_seq_no: Only update the watch if the last operation that has changed
498
498
  the watch has the specified sequence number
499
499
  :param input: The input that defines the input that loads the data for the watch.
500
500
  :param metadata: Metadata JSON that will be copied into the history entries.
@@ -550,11 +550,7 @@ class WatcherClient(NamespacedClient):
550
550
  __body["transform"] = transform
551
551
  if trigger is not None:
552
552
  __body["trigger"] = trigger
553
- if not __body:
554
- __body = None # type: ignore[assignment]
555
- __headers = {"accept": "application/json"}
556
- if __body is not None:
557
- __headers["content-type"] = "application/json"
553
+ __headers = {"accept": "application/json", "content-type": "application/json"}
558
554
  return await self.perform_request( # type: ignore[return-value]
559
555
  "PUT",
560
556
  __path,
@@ -56,7 +56,8 @@ class XPackClient(NamespacedClient):
56
56
 
57
57
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/info-api.html>`_
58
58
 
59
- :param accept_enterprise: If this param is used it must be set to true
59
+ :param accept_enterprise: If used, this otherwise ignored parameter must be set
60
+ to true
60
61
  :param categories: A comma-separated list of the information categories to include
61
62
  in the response. For example, `build,license,features`.
62
63
  """
@@ -33,12 +33,16 @@ from typing import (
33
33
  Union,
34
34
  )
35
35
 
36
+ from ..compat import safe_task
36
37
  from ..exceptions import ApiError, NotFoundError, TransportError
37
38
  from ..helpers.actions import (
38
39
  _TYPE_BULK_ACTION,
39
40
  _TYPE_BULK_ACTION_BODY,
40
41
  _TYPE_BULK_ACTION_HEADER,
41
42
  _TYPE_BULK_ACTION_HEADER_AND_BODY,
43
+ _TYPE_BULK_ACTION_HEADER_WITH_META_AND_BODY,
44
+ _TYPE_BULK_ACTION_WITH_META,
45
+ BulkMeta,
42
46
  _ActionChunker,
43
47
  _process_bulk_chunk_error,
44
48
  _process_bulk_chunk_success,
@@ -54,9 +58,10 @@ T = TypeVar("T")
54
58
 
55
59
 
56
60
  async def _chunk_actions(
57
- actions: AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY],
61
+ actions: AsyncIterable[_TYPE_BULK_ACTION_HEADER_WITH_META_AND_BODY],
58
62
  chunk_size: int,
59
63
  max_chunk_bytes: int,
64
+ flush_after_seconds: Optional[float],
60
65
  serializer: Serializer,
61
66
  ) -> AsyncIterable[
62
67
  Tuple[
@@ -76,10 +81,42 @@ async def _chunk_actions(
76
81
  chunker = _ActionChunker(
77
82
  chunk_size=chunk_size, max_chunk_bytes=max_chunk_bytes, serializer=serializer
78
83
  )
79
- async for action, data in actions:
80
- ret = chunker.feed(action, data)
81
- if ret:
82
- yield ret
84
+
85
+ if not flush_after_seconds:
86
+ async for action, data in actions:
87
+ ret = chunker.feed(action, data)
88
+ if ret:
89
+ yield ret
90
+ else:
91
+ item_queue: asyncio.Queue[_TYPE_BULK_ACTION_HEADER_WITH_META_AND_BODY] = (
92
+ asyncio.Queue()
93
+ )
94
+
95
+ async def get_items() -> None:
96
+ try:
97
+ async for item in actions:
98
+ await item_queue.put(item)
99
+ finally:
100
+ await item_queue.put((BulkMeta.done, None))
101
+
102
+ async with safe_task(get_items()):
103
+ timeout: Optional[float] = flush_after_seconds
104
+ while True:
105
+ try:
106
+ action, data = await asyncio.wait_for(
107
+ item_queue.get(), timeout=timeout
108
+ )
109
+ timeout = flush_after_seconds
110
+ except asyncio.TimeoutError:
111
+ action, data = BulkMeta.flush, None
112
+ timeout = None
113
+
114
+ if action is BulkMeta.done:
115
+ break
116
+ ret = chunker.feed(action, data)
117
+ if ret:
118
+ yield ret
119
+
83
120
  ret = chunker.flush()
84
121
  if ret:
85
122
  yield ret
@@ -159,9 +196,13 @@ async def azip(
159
196
 
160
197
  async def async_streaming_bulk(
161
198
  client: AsyncElasticsearch,
162
- actions: Union[Iterable[_TYPE_BULK_ACTION], AsyncIterable[_TYPE_BULK_ACTION]],
199
+ actions: Union[
200
+ Iterable[_TYPE_BULK_ACTION_WITH_META],
201
+ AsyncIterable[_TYPE_BULK_ACTION_WITH_META],
202
+ ],
163
203
  chunk_size: int = 500,
164
204
  max_chunk_bytes: int = 100 * 1024 * 1024,
205
+ flush_after_seconds: Optional[float] = None,
165
206
  raise_on_error: bool = True,
166
207
  expand_action_callback: Callable[
167
208
  [_TYPE_BULK_ACTION], _TYPE_BULK_ACTION_HEADER_AND_BODY
@@ -194,6 +235,9 @@ async def async_streaming_bulk(
194
235
  :arg actions: iterable or async iterable containing the actions to be executed
195
236
  :arg chunk_size: number of docs in one chunk sent to es (default: 500)
196
237
  :arg max_chunk_bytes: the maximum size of the request in bytes (default: 100MB)
238
+ :arg flush_after_seconds: time in seconds after which a chunk is written even
239
+ if hasn't reached `chunk_size` or `max_chunk_bytes`. Set to 0 to not use a
240
+ timeout-based flush. (default: 0)
197
241
  :arg raise_on_error: raise ``BulkIndexError`` containing errors (as `.errors`)
198
242
  from the execution of the last chunk when some occur. By default we raise.
199
243
  :arg raise_on_exception: if ``False`` then don't propagate exceptions from
@@ -220,9 +264,14 @@ async def async_streaming_bulk(
220
264
  if isinstance(retry_on_status, int):
221
265
  retry_on_status = (retry_on_status,)
222
266
 
223
- async def map_actions() -> AsyncIterable[_TYPE_BULK_ACTION_HEADER_AND_BODY]:
267
+ async def map_actions() -> (
268
+ AsyncIterable[_TYPE_BULK_ACTION_HEADER_WITH_META_AND_BODY]
269
+ ):
224
270
  async for item in aiter(actions):
225
- yield expand_action_callback(item)
271
+ if isinstance(item, BulkMeta):
272
+ yield item, None
273
+ else:
274
+ yield expand_action_callback(item)
226
275
 
227
276
  serializer = client.transport.serializers.get_serializer("application/json")
228
277
 
@@ -234,7 +283,7 @@ async def async_streaming_bulk(
234
283
  ]
235
284
  bulk_actions: List[bytes]
236
285
  async for bulk_data, bulk_actions in _chunk_actions(
237
- map_actions(), chunk_size, max_chunk_bytes, serializer
286
+ map_actions(), chunk_size, max_chunk_bytes, flush_after_seconds, serializer
238
287
  ):
239
288
  for attempt in range(max_retries + 1):
240
289
  to_retry: List[bytes] = []
@@ -75,6 +75,7 @@ from .slm import SlmClient
75
75
  from .snapshot import SnapshotClient
76
76
  from .sql import SqlClient
77
77
  from .ssl import SslClient
78
+ from .streams import StreamsClient
78
79
  from .synonyms import SynonymsClient
79
80
  from .tasks import TasksClient
80
81
  from .text_structure import TextStructureClient
@@ -84,9 +85,9 @@ from .utils import (
84
85
  CLIENT_META_SERVICE,
85
86
  SKIP_IN_PATH,
86
87
  Stability,
88
+ _availability_warning,
87
89
  _quote,
88
90
  _rewrite_parameters,
89
- _stability_warning,
90
91
  client_node_configs,
91
92
  is_requests_http_auth,
92
93
  is_requests_node_class,
@@ -470,6 +471,7 @@ class Elasticsearch(BaseClient):
470
471
  self.shutdown = ShutdownClient(self)
471
472
  self.sql = SqlClient(self)
472
473
  self.ssl = SslClient(self)
474
+ self.streams = StreamsClient(self)
473
475
  self.synonyms = SynonymsClient(self)
474
476
  self.text_structure = TextStructureClient(self)
475
477
  self.transform = TransformClient(self)
@@ -592,6 +594,7 @@ class Elasticsearch(BaseClient):
592
594
  """
593
595
  __path = "/"
594
596
  __query: t.Dict[str, t.Any] = {}
597
+ __path_parts: t.Dict[str, str] = {}
595
598
  if error_trace is not None:
596
599
  __query["error_trace"] = error_trace
597
600
  if filter_path is not None:
@@ -602,7 +605,14 @@ class Elasticsearch(BaseClient):
602
605
  __query["pretty"] = pretty
603
606
  __headers = {"accept": "application/json"}
604
607
  try:
605
- self.perform_request("HEAD", __path, params=__query, headers=__headers)
608
+ self.perform_request(
609
+ "HEAD",
610
+ __path,
611
+ params=__query,
612
+ headers=__headers,
613
+ endpoint_id="ping",
614
+ path_parts=__path_parts,
615
+ )
606
616
  return True
607
617
  except (ApiError, TransportError):
608
618
  return False
@@ -696,6 +706,7 @@ class Elasticsearch(BaseClient):
696
706
  <li>Perl: Check out <code>Search::Elasticsearch::Client::5_0::Bulk</code> and <code>Search::Elasticsearch::Client::5_0::Scroll</code></li>
697
707
  <li>Python: Check out <code>elasticsearch.helpers.*</code></li>
698
708
  <li>JavaScript: Check out <code>client.helpers.*</code></li>
709
+ <li>Java: Check out <code>co.elastic.clients.elasticsearch._helpers.bulk.BulkIngester</code></li>
699
710
  <li>.NET: Check out <code>BulkAllObservable</code></li>
700
711
  <li>PHP: Check out bulk indexing.</li>
701
712
  <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
@@ -933,11 +944,7 @@ class Elasticsearch(BaseClient):
933
944
  if not __body:
934
945
  if id is not None:
935
946
  __body["id"] = id
936
- if not __body:
937
- __body = None # type: ignore[assignment]
938
- __headers = {"accept": "application/json"}
939
- if __body is not None:
940
- __headers["content-type"] = "application/json"
947
+ __headers = {"accept": "application/json", "content-type": "application/json"}
941
948
  return self.perform_request( # type: ignore[return-value]
942
949
  "DELETE",
943
950
  __path,
@@ -1010,8 +1017,8 @@ class Elasticsearch(BaseClient):
1010
1017
  This parameter can be used only when the `q` query string parameter is specified.
1011
1018
  :param analyzer: The analyzer to use for the query string. This parameter can
1012
1019
  be used only when the `q` query string parameter is specified.
1013
- :param default_operator: The default operator for query string query: `AND` or
1014
- `OR`. This parameter can be used only when the `q` query string parameter
1020
+ :param default_operator: The default operator for query string query: `and` or
1021
+ `or`. This parameter can be used only when the `q` query string parameter
1015
1022
  is specified.
1016
1023
  :param df: The field to use as a default when no field prefix is given in the
1017
1024
  query string. This parameter can be used only when the `q` query string parameter
@@ -1132,7 +1139,7 @@ class Elasticsearch(BaseClient):
1132
1139
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1133
1140
  version: t.Optional[int] = None,
1134
1141
  version_type: t.Optional[
1135
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1142
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1136
1143
  ] = None,
1137
1144
  wait_for_active_shards: t.Optional[
1138
1145
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1311,7 +1318,7 @@ class Elasticsearch(BaseClient):
1311
1318
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1312
1319
  version: t.Optional[int] = None,
1313
1320
  version_type: t.Optional[
1314
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1321
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1315
1322
  ] = None,
1316
1323
  wait_for_active_shards: t.Optional[
1317
1324
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1556,8 +1563,8 @@ class Elasticsearch(BaseClient):
1556
1563
  used only when the `q` query string parameter is specified.
1557
1564
  :param conflicts: What to do if delete by query hits version conflicts: `abort`
1558
1565
  or `proceed`.
1559
- :param default_operator: The default operator for query string query: `AND` or
1560
- `OR`. This parameter can be used only when the `q` query string parameter
1566
+ :param default_operator: The default operator for query string query: `and` or
1567
+ `or`. This parameter can be used only when the `q` query string parameter
1561
1568
  is specified.
1562
1569
  :param df: The field to use as default where no field prefix is given in the
1563
1570
  query string. This parameter can be used only when the `q` query string parameter
@@ -1723,11 +1730,11 @@ class Elasticsearch(BaseClient):
1723
1730
  self,
1724
1731
  *,
1725
1732
  task_id: t.Union[int, str],
1733
+ requests_per_second: float,
1726
1734
  error_trace: t.Optional[bool] = None,
1727
1735
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1728
1736
  human: t.Optional[bool] = None,
1729
1737
  pretty: t.Optional[bool] = None,
1730
- requests_per_second: t.Optional[float] = None,
1731
1738
  ) -> ObjectApiResponse[t.Any]:
1732
1739
  """
1733
1740
  .. raw:: html
@@ -1745,9 +1752,13 @@ class Elasticsearch(BaseClient):
1745
1752
  """
1746
1753
  if task_id in SKIP_IN_PATH:
1747
1754
  raise ValueError("Empty value passed for parameter 'task_id'")
1755
+ if requests_per_second is None:
1756
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
1748
1757
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
1749
1758
  __path = f'/_delete_by_query/{__path_parts["task_id"]}/_rethrottle'
1750
1759
  __query: t.Dict[str, t.Any] = {}
1760
+ if requests_per_second is not None:
1761
+ __query["requests_per_second"] = requests_per_second
1751
1762
  if error_trace is not None:
1752
1763
  __query["error_trace"] = error_trace
1753
1764
  if filter_path is not None:
@@ -1756,8 +1767,6 @@ class Elasticsearch(BaseClient):
1756
1767
  __query["human"] = human
1757
1768
  if pretty is not None:
1758
1769
  __query["pretty"] = pretty
1759
- if requests_per_second is not None:
1760
- __query["requests_per_second"] = requests_per_second
1761
1770
  __headers = {"accept": "application/json"}
1762
1771
  return self.perform_request( # type: ignore[return-value]
1763
1772
  "POST",
@@ -1851,7 +1860,7 @@ class Elasticsearch(BaseClient):
1851
1860
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1852
1861
  version: t.Optional[int] = None,
1853
1862
  version_type: t.Optional[
1854
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1863
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1855
1864
  ] = None,
1856
1865
  ) -> HeadApiResponse:
1857
1866
  """
@@ -1980,7 +1989,7 @@ class Elasticsearch(BaseClient):
1980
1989
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1981
1990
  version: t.Optional[int] = None,
1982
1991
  version_type: t.Optional[
1983
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1992
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1984
1993
  ] = None,
1985
1994
  ) -> HeadApiResponse:
1986
1995
  """
@@ -2109,8 +2118,8 @@ class Elasticsearch(BaseClient):
2109
2118
  This parameter can be used only when the `q` query string parameter is specified.
2110
2119
  :param analyzer: The analyzer to use for the query string. This parameter can
2111
2120
  be used only when the `q` query string parameter is specified.
2112
- :param default_operator: The default operator for query string query: `AND` or
2113
- `OR`. This parameter can be used only when the `q` query string parameter
2121
+ :param default_operator: The default operator for query string query: `and` or
2122
+ `or`. This parameter can be used only when the `q` query string parameter
2114
2123
  is specified.
2115
2124
  :param df: The field to use as default where no field prefix is given in the
2116
2125
  query string. This parameter can be used only when the `q` query string parameter
@@ -2352,7 +2361,7 @@ class Elasticsearch(BaseClient):
2352
2361
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2353
2362
  version: t.Optional[int] = None,
2354
2363
  version_type: t.Optional[
2355
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2364
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2356
2365
  ] = None,
2357
2366
  ) -> ObjectApiResponse[t.Any]:
2358
2367
  """
@@ -2639,7 +2648,7 @@ class Elasticsearch(BaseClient):
2639
2648
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2640
2649
  version: t.Optional[int] = None,
2641
2650
  version_type: t.Optional[
2642
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2651
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2643
2652
  ] = None,
2644
2653
  ) -> ObjectApiResponse[t.Any]:
2645
2654
  """
@@ -2819,7 +2828,7 @@ class Elasticsearch(BaseClient):
2819
2828
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2820
2829
  version: t.Optional[int] = None,
2821
2830
  version_type: t.Optional[
2822
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2831
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2823
2832
  ] = None,
2824
2833
  wait_for_active_shards: t.Optional[
2825
2834
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -3088,7 +3097,7 @@ class Elasticsearch(BaseClient):
3088
3097
  ),
3089
3098
  parameter_aliases={"_source": "source"},
3090
3099
  )
3091
- @_stability_warning(Stability.EXPERIMENTAL)
3100
+ @_availability_warning(Stability.EXPERIMENTAL)
3092
3101
  def knn_search(
3093
3102
  self,
3094
3103
  *,
@@ -3183,11 +3192,7 @@ class Elasticsearch(BaseClient):
3183
3192
  __body["_source"] = source
3184
3193
  if stored_fields is not None:
3185
3194
  __body["stored_fields"] = stored_fields
3186
- if not __body:
3187
- __body = None # type: ignore[assignment]
3188
- __headers = {"accept": "application/json"}
3189
- if __body is not None:
3190
- __headers["content-type"] = "application/json"
3195
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3191
3196
  return self.perform_request( # type: ignore[return-value]
3192
3197
  "POST",
3193
3198
  __path,
@@ -3612,7 +3617,7 @@ class Elasticsearch(BaseClient):
3612
3617
  term_statistics: t.Optional[bool] = None,
3613
3618
  version: t.Optional[int] = None,
3614
3619
  version_type: t.Optional[
3615
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
3620
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
3616
3621
  ] = None,
3617
3622
  body: t.Optional[t.Dict[str, t.Any]] = None,
3618
3623
  ) -> ObjectApiResponse[t.Any]:
@@ -4022,7 +4027,7 @@ class Elasticsearch(BaseClient):
4022
4027
  )
4023
4028
 
4024
4029
  @_rewrite_parameters(
4025
- body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"),
4030
+ body_fields=("dest", "source", "conflicts", "max_docs", "script"),
4026
4031
  )
4027
4032
  def reindex(
4028
4033
  self,
@@ -4040,7 +4045,6 @@ class Elasticsearch(BaseClient):
4040
4045
  require_alias: t.Optional[bool] = None,
4041
4046
  script: t.Optional[t.Mapping[str, t.Any]] = None,
4042
4047
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4043
- size: t.Optional[int] = None,
4044
4048
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
4045
4049
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4046
4050
  wait_for_active_shards: t.Optional[
@@ -4212,7 +4216,6 @@ class Elasticsearch(BaseClient):
4212
4216
  reindexing.
4213
4217
  :param scroll: The period of time that a consistent view of the index should
4214
4218
  be maintained for scrolled search.
4215
- :param size:
4216
4219
  :param slices: The number of slices this task should be divided into. It defaults
4217
4220
  to one slice, which means the task isn't sliced into subtasks. Reindex supports
4218
4221
  sliced scroll to parallelize the reindexing process. This parallelization
@@ -4277,8 +4280,6 @@ class Elasticsearch(BaseClient):
4277
4280
  __body["max_docs"] = max_docs
4278
4281
  if script is not None:
4279
4282
  __body["script"] = script
4280
- if size is not None:
4281
- __body["size"] = size
4282
4283
  __headers = {"accept": "application/json", "content-type": "application/json"}
4283
4284
  return self.perform_request( # type: ignore[return-value]
4284
4285
  "POST",
@@ -4295,11 +4296,11 @@ class Elasticsearch(BaseClient):
4295
4296
  self,
4296
4297
  *,
4297
4298
  task_id: str,
4299
+ requests_per_second: float,
4298
4300
  error_trace: t.Optional[bool] = None,
4299
4301
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4300
4302
  human: t.Optional[bool] = None,
4301
4303
  pretty: t.Optional[bool] = None,
4302
- requests_per_second: t.Optional[float] = None,
4303
4304
  ) -> ObjectApiResponse[t.Any]:
4304
4305
  """
4305
4306
  .. raw:: html
@@ -4323,9 +4324,13 @@ class Elasticsearch(BaseClient):
4323
4324
  """
4324
4325
  if task_id in SKIP_IN_PATH:
4325
4326
  raise ValueError("Empty value passed for parameter 'task_id'")
4327
+ if requests_per_second is None:
4328
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
4326
4329
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
4327
4330
  __path = f'/_reindex/{__path_parts["task_id"]}/_rethrottle'
4328
4331
  __query: t.Dict[str, t.Any] = {}
4332
+ if requests_per_second is not None:
4333
+ __query["requests_per_second"] = requests_per_second
4329
4334
  if error_trace is not None:
4330
4335
  __query["error_trace"] = error_trace
4331
4336
  if filter_path is not None:
@@ -4334,8 +4339,6 @@ class Elasticsearch(BaseClient):
4334
4339
  __query["human"] = human
4335
4340
  if pretty is not None:
4336
4341
  __query["pretty"] = pretty
4337
- if requests_per_second is not None:
4338
- __query["requests_per_second"] = requests_per_second
4339
4342
  __headers = {"accept": "application/json"}
4340
4343
  return self.perform_request( # type: ignore[return-value]
4341
4344
  "POST",
@@ -4405,11 +4408,7 @@ class Elasticsearch(BaseClient):
4405
4408
  __body["params"] = params
4406
4409
  if source is not None:
4407
4410
  __body["source"] = source
4408
- if not __body:
4409
- __body = None # type: ignore[assignment]
4410
- __headers = {"accept": "application/json"}
4411
- if __body is not None:
4412
- __headers["content-type"] = "application/json"
4411
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4413
4412
  return self.perform_request( # type: ignore[return-value]
4414
4413
  "POST",
4415
4414
  __path,
@@ -4423,7 +4422,7 @@ class Elasticsearch(BaseClient):
4423
4422
  @_rewrite_parameters(
4424
4423
  body_fields=("context", "context_setup", "script"),
4425
4424
  )
4426
- @_stability_warning(Stability.EXPERIMENTAL)
4425
+ @_availability_warning(Stability.EXPERIMENTAL)
4427
4426
  def scripts_painless_execute(
4428
4427
  self,
4429
4428
  *,
@@ -4492,11 +4491,7 @@ class Elasticsearch(BaseClient):
4492
4491
  __body["context_setup"] = context_setup
4493
4492
  if script is not None:
4494
4493
  __body["script"] = script
4495
- if not __body:
4496
- __body = None # type: ignore[assignment]
4497
- __headers = {"accept": "application/json"}
4498
- if __body is not None:
4499
- __headers["content-type"] = "application/json"
4494
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4500
4495
  return self.perform_request( # type: ignore[return-value]
4501
4496
  "POST",
4502
4497
  __path,
@@ -4772,8 +4767,8 @@ class Elasticsearch(BaseClient):
4772
4767
  node and the remote clusters are minimized when running cross-cluster search
4773
4768
  (CCS) requests.
4774
4769
  :param collapse: Collapses search results the values of the specified field.
4775
- :param default_operator: The default operator for the query string query: `AND`
4776
- or `OR`. This parameter can be used only when the `q` query string parameter
4770
+ :param default_operator: The default operator for the query string query: `and`
4771
+ or `or`. This parameter can be used only when the `q` query string parameter
4777
4772
  is specified.
4778
4773
  :param df: The field to use as a default when no field prefix is given in the
4779
4774
  query string. This parameter can be used only when the `q` query string parameter
@@ -5496,11 +5491,19 @@ class Elasticsearch(BaseClient):
5496
5491
 
5497
5492
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/search-vector-tile-api.html>`_
5498
5493
 
5499
- :param index: Comma-separated list of data streams, indices, or aliases to search
5500
- :param field: Field containing geospatial data to return
5501
- :param zoom: Zoom level for the vector tile to search
5502
- :param x: X coordinate for the vector tile to search
5503
- :param y: Y coordinate for the vector tile to search
5494
+ :param index: A list of indices, data streams, or aliases to search. It supports
5495
+ wildcards (`*`). To search all data streams and indices, omit this parameter
5496
+ or use `*` or `_all`. To search a remote cluster, use the `<cluster>:<target>`
5497
+ syntax.
5498
+ :param field: A field that contains the geospatial data to return. It must be
5499
+ a `geo_point` or `geo_shape` field. The field must have doc values enabled.
5500
+ It cannot be a nested field. NOTE: Vector tiles do not natively support geometry
5501
+ collections. For `geometrycollection` values in a `geo_shape` field, the
5502
+ API returns a hits layer feature for each element of the collection. This
5503
+ behavior may change in a future release.
5504
+ :param zoom: The zoom level of the vector tile to search. It accepts `0` to `29`.
5505
+ :param x: The X coordinate for the vector tile to search.
5506
+ :param y: The Y coordinate for the vector tile to search.
5504
5507
  :param aggs: Sub-aggregations for the geotile_grid. It supports the following
5505
5508
  aggregation types: - `avg` - `boxplot` - `cardinality` - `extended stats`
5506
5509
  - `max` - `median absolute deviation` - `min` - `percentile` - `percentile-rank`
@@ -5975,11 +5978,7 @@ class Elasticsearch(BaseClient):
5975
5978
  __body["string"] = string
5976
5979
  if timeout is not None:
5977
5980
  __body["timeout"] = timeout
5978
- if not __body:
5979
- __body = None # type: ignore[assignment]
5980
- __headers = {"accept": "application/json"}
5981
- if __body is not None:
5982
- __headers["content-type"] = "application/json"
5981
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5983
5982
  return self.perform_request( # type: ignore[return-value]
5984
5983
  "POST",
5985
5984
  __path,
@@ -6029,7 +6028,7 @@ class Elasticsearch(BaseClient):
6029
6028
  term_statistics: t.Optional[bool] = None,
6030
6029
  version: t.Optional[int] = None,
6031
6030
  version_type: t.Optional[
6032
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
6031
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
6033
6032
  ] = None,
6034
6033
  body: t.Optional[t.Dict[str, t.Any]] = None,
6035
6034
  ) -> ObjectApiResponse[t.Any]:
@@ -6495,8 +6494,8 @@ class Elasticsearch(BaseClient):
6495
6494
  be used only when the `q` query string parameter is specified.
6496
6495
  :param conflicts: The preferred behavior when update by query hits version conflicts:
6497
6496
  `abort` or `proceed`.
6498
- :param default_operator: The default operator for query string query: `AND` or
6499
- `OR`. This parameter can be used only when the `q` query string parameter
6497
+ :param default_operator: The default operator for query string query: `and` or
6498
+ `or`. This parameter can be used only when the `q` query string parameter
6500
6499
  is specified.
6501
6500
  :param df: The field to use as default where no field prefix is given in the
6502
6501
  query string. This parameter can be used only when the `q` query string parameter
@@ -6684,11 +6683,11 @@ class Elasticsearch(BaseClient):
6684
6683
  self,
6685
6684
  *,
6686
6685
  task_id: str,
6686
+ requests_per_second: float,
6687
6687
  error_trace: t.Optional[bool] = None,
6688
6688
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6689
6689
  human: t.Optional[bool] = None,
6690
6690
  pretty: t.Optional[bool] = None,
6691
- requests_per_second: t.Optional[float] = None,
6692
6691
  ) -> ObjectApiResponse[t.Any]:
6693
6692
  """
6694
6693
  .. raw:: html
@@ -6706,9 +6705,13 @@ class Elasticsearch(BaseClient):
6706
6705
  """
6707
6706
  if task_id in SKIP_IN_PATH:
6708
6707
  raise ValueError("Empty value passed for parameter 'task_id'")
6708
+ if requests_per_second is None:
6709
+ raise ValueError("Empty value passed for parameter 'requests_per_second'")
6709
6710
  __path_parts: t.Dict[str, str] = {"task_id": _quote(task_id)}
6710
6711
  __path = f'/_update_by_query/{__path_parts["task_id"]}/_rethrottle'
6711
6712
  __query: t.Dict[str, t.Any] = {}
6713
+ if requests_per_second is not None:
6714
+ __query["requests_per_second"] = requests_per_second
6712
6715
  if error_trace is not None:
6713
6716
  __query["error_trace"] = error_trace
6714
6717
  if filter_path is not None:
@@ -6717,8 +6720,6 @@ class Elasticsearch(BaseClient):
6717
6720
  __query["human"] = human
6718
6721
  if pretty is not None:
6719
6722
  __query["pretty"] = pretty
6720
- if requests_per_second is not None:
6721
- __query["requests_per_second"] = requests_per_second
6722
6723
  __headers = {"accept": "application/json"}
6723
6724
  return self.perform_request( # type: ignore[return-value]
6724
6725
  "POST",