elasticsearch9 9.0.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 (160) hide show
  1. elasticsearch9/__init__.py +98 -0
  2. elasticsearch9/_async/__init__.py +16 -0
  3. elasticsearch9/_async/client/__init__.py +6531 -0
  4. elasticsearch9/_async/client/_base.py +430 -0
  5. elasticsearch9/_async/client/async_search.py +637 -0
  6. elasticsearch9/_async/client/autoscaling.py +252 -0
  7. elasticsearch9/_async/client/cat.py +2995 -0
  8. elasticsearch9/_async/client/ccr.py +1043 -0
  9. elasticsearch9/_async/client/cluster.py +1223 -0
  10. elasticsearch9/_async/client/connector.py +1978 -0
  11. elasticsearch9/_async/client/dangling_indices.py +192 -0
  12. elasticsearch9/_async/client/enrich.py +291 -0
  13. elasticsearch9/_async/client/eql.py +359 -0
  14. elasticsearch9/_async/client/esql.py +490 -0
  15. elasticsearch9/_async/client/features.py +130 -0
  16. elasticsearch9/_async/client/fleet.py +658 -0
  17. elasticsearch9/_async/client/graph.py +113 -0
  18. elasticsearch9/_async/client/ilm.py +668 -0
  19. elasticsearch9/_async/client/indices.py +5582 -0
  20. elasticsearch9/_async/client/inference.py +2247 -0
  21. elasticsearch9/_async/client/ingest.py +766 -0
  22. elasticsearch9/_async/client/license.py +400 -0
  23. elasticsearch9/_async/client/logstash.py +176 -0
  24. elasticsearch9/_async/client/migration.py +160 -0
  25. elasticsearch9/_async/client/ml.py +5835 -0
  26. elasticsearch9/_async/client/monitoring.py +100 -0
  27. elasticsearch9/_async/client/nodes.py +543 -0
  28. elasticsearch9/_async/client/query_rules.py +485 -0
  29. elasticsearch9/_async/client/rollup.py +616 -0
  30. elasticsearch9/_async/client/search_application.py +574 -0
  31. elasticsearch9/_async/client/searchable_snapshots.py +313 -0
  32. elasticsearch9/_async/client/security.py +4688 -0
  33. elasticsearch9/_async/client/shutdown.py +268 -0
  34. elasticsearch9/_async/client/simulate.py +145 -0
  35. elasticsearch9/_async/client/slm.py +559 -0
  36. elasticsearch9/_async/client/snapshot.py +1338 -0
  37. elasticsearch9/_async/client/sql.py +469 -0
  38. elasticsearch9/_async/client/ssl.py +76 -0
  39. elasticsearch9/_async/client/synonyms.py +413 -0
  40. elasticsearch9/_async/client/tasks.py +295 -0
  41. elasticsearch9/_async/client/text_structure.py +664 -0
  42. elasticsearch9/_async/client/transform.py +922 -0
  43. elasticsearch9/_async/client/utils.py +48 -0
  44. elasticsearch9/_async/client/watcher.py +894 -0
  45. elasticsearch9/_async/client/xpack.py +134 -0
  46. elasticsearch9/_async/helpers.py +596 -0
  47. elasticsearch9/_otel.py +110 -0
  48. elasticsearch9/_sync/__init__.py +16 -0
  49. elasticsearch9/_sync/client/__init__.py +6529 -0
  50. elasticsearch9/_sync/client/_base.py +430 -0
  51. elasticsearch9/_sync/client/async_search.py +637 -0
  52. elasticsearch9/_sync/client/autoscaling.py +252 -0
  53. elasticsearch9/_sync/client/cat.py +2995 -0
  54. elasticsearch9/_sync/client/ccr.py +1043 -0
  55. elasticsearch9/_sync/client/cluster.py +1223 -0
  56. elasticsearch9/_sync/client/connector.py +1978 -0
  57. elasticsearch9/_sync/client/dangling_indices.py +192 -0
  58. elasticsearch9/_sync/client/enrich.py +291 -0
  59. elasticsearch9/_sync/client/eql.py +359 -0
  60. elasticsearch9/_sync/client/esql.py +490 -0
  61. elasticsearch9/_sync/client/features.py +130 -0
  62. elasticsearch9/_sync/client/fleet.py +658 -0
  63. elasticsearch9/_sync/client/graph.py +113 -0
  64. elasticsearch9/_sync/client/ilm.py +668 -0
  65. elasticsearch9/_sync/client/indices.py +5582 -0
  66. elasticsearch9/_sync/client/inference.py +2247 -0
  67. elasticsearch9/_sync/client/ingest.py +766 -0
  68. elasticsearch9/_sync/client/license.py +400 -0
  69. elasticsearch9/_sync/client/logstash.py +176 -0
  70. elasticsearch9/_sync/client/migration.py +160 -0
  71. elasticsearch9/_sync/client/ml.py +5835 -0
  72. elasticsearch9/_sync/client/monitoring.py +100 -0
  73. elasticsearch9/_sync/client/nodes.py +543 -0
  74. elasticsearch9/_sync/client/query_rules.py +485 -0
  75. elasticsearch9/_sync/client/rollup.py +616 -0
  76. elasticsearch9/_sync/client/search_application.py +574 -0
  77. elasticsearch9/_sync/client/searchable_snapshots.py +313 -0
  78. elasticsearch9/_sync/client/security.py +4688 -0
  79. elasticsearch9/_sync/client/shutdown.py +268 -0
  80. elasticsearch9/_sync/client/simulate.py +145 -0
  81. elasticsearch9/_sync/client/slm.py +559 -0
  82. elasticsearch9/_sync/client/snapshot.py +1338 -0
  83. elasticsearch9/_sync/client/sql.py +469 -0
  84. elasticsearch9/_sync/client/ssl.py +76 -0
  85. elasticsearch9/_sync/client/synonyms.py +413 -0
  86. elasticsearch9/_sync/client/tasks.py +295 -0
  87. elasticsearch9/_sync/client/text_structure.py +664 -0
  88. elasticsearch9/_sync/client/transform.py +922 -0
  89. elasticsearch9/_sync/client/utils.py +475 -0
  90. elasticsearch9/_sync/client/watcher.py +894 -0
  91. elasticsearch9/_sync/client/xpack.py +134 -0
  92. elasticsearch9/_utils.py +34 -0
  93. elasticsearch9/_version.py +18 -0
  94. elasticsearch9/client.py +126 -0
  95. elasticsearch9/compat.py +79 -0
  96. elasticsearch9/dsl/__init__.py +203 -0
  97. elasticsearch9/dsl/_async/__init__.py +16 -0
  98. elasticsearch9/dsl/_async/document.py +522 -0
  99. elasticsearch9/dsl/_async/faceted_search.py +50 -0
  100. elasticsearch9/dsl/_async/index.py +639 -0
  101. elasticsearch9/dsl/_async/mapping.py +49 -0
  102. elasticsearch9/dsl/_async/search.py +237 -0
  103. elasticsearch9/dsl/_async/update_by_query.py +47 -0
  104. elasticsearch9/dsl/_sync/__init__.py +16 -0
  105. elasticsearch9/dsl/_sync/document.py +514 -0
  106. elasticsearch9/dsl/_sync/faceted_search.py +50 -0
  107. elasticsearch9/dsl/_sync/index.py +597 -0
  108. elasticsearch9/dsl/_sync/mapping.py +49 -0
  109. elasticsearch9/dsl/_sync/search.py +230 -0
  110. elasticsearch9/dsl/_sync/update_by_query.py +45 -0
  111. elasticsearch9/dsl/aggs.py +3734 -0
  112. elasticsearch9/dsl/analysis.py +341 -0
  113. elasticsearch9/dsl/async_connections.py +37 -0
  114. elasticsearch9/dsl/connections.py +142 -0
  115. elasticsearch9/dsl/document.py +20 -0
  116. elasticsearch9/dsl/document_base.py +444 -0
  117. elasticsearch9/dsl/exceptions.py +32 -0
  118. elasticsearch9/dsl/faceted_search.py +28 -0
  119. elasticsearch9/dsl/faceted_search_base.py +489 -0
  120. elasticsearch9/dsl/field.py +4392 -0
  121. elasticsearch9/dsl/function.py +180 -0
  122. elasticsearch9/dsl/index.py +23 -0
  123. elasticsearch9/dsl/index_base.py +178 -0
  124. elasticsearch9/dsl/mapping.py +19 -0
  125. elasticsearch9/dsl/mapping_base.py +219 -0
  126. elasticsearch9/dsl/query.py +2822 -0
  127. elasticsearch9/dsl/response/__init__.py +388 -0
  128. elasticsearch9/dsl/response/aggs.py +100 -0
  129. elasticsearch9/dsl/response/hit.py +53 -0
  130. elasticsearch9/dsl/search.py +20 -0
  131. elasticsearch9/dsl/search_base.py +1053 -0
  132. elasticsearch9/dsl/serializer.py +34 -0
  133. elasticsearch9/dsl/types.py +6453 -0
  134. elasticsearch9/dsl/update_by_query.py +19 -0
  135. elasticsearch9/dsl/update_by_query_base.py +149 -0
  136. elasticsearch9/dsl/utils.py +687 -0
  137. elasticsearch9/dsl/wrappers.py +144 -0
  138. elasticsearch9/exceptions.py +133 -0
  139. elasticsearch9/helpers/__init__.py +41 -0
  140. elasticsearch9/helpers/actions.py +875 -0
  141. elasticsearch9/helpers/errors.py +40 -0
  142. elasticsearch9/helpers/vectorstore/__init__.py +62 -0
  143. elasticsearch9/helpers/vectorstore/_async/__init__.py +16 -0
  144. elasticsearch9/helpers/vectorstore/_async/_utils.py +39 -0
  145. elasticsearch9/helpers/vectorstore/_async/embedding_service.py +89 -0
  146. elasticsearch9/helpers/vectorstore/_async/strategies.py +487 -0
  147. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +421 -0
  148. elasticsearch9/helpers/vectorstore/_sync/__init__.py +16 -0
  149. elasticsearch9/helpers/vectorstore/_sync/_utils.py +39 -0
  150. elasticsearch9/helpers/vectorstore/_sync/embedding_service.py +89 -0
  151. elasticsearch9/helpers/vectorstore/_sync/strategies.py +487 -0
  152. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +421 -0
  153. elasticsearch9/helpers/vectorstore/_utils.py +116 -0
  154. elasticsearch9/py.typed +0 -0
  155. elasticsearch9/serializer.py +250 -0
  156. elasticsearch9-9.0.0.dist-info/METADATA +175 -0
  157. elasticsearch9-9.0.0.dist-info/RECORD +160 -0
  158. elasticsearch9-9.0.0.dist-info/WHEEL +4 -0
  159. elasticsearch9-9.0.0.dist-info/licenses/LICENSE +176 -0
  160. elasticsearch9-9.0.0.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,313 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import typing as t
19
+
20
+ from elastic_transport import ObjectApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import (
24
+ SKIP_IN_PATH,
25
+ Stability,
26
+ _quote,
27
+ _rewrite_parameters,
28
+ _stability_warning,
29
+ )
30
+
31
+
32
+ class SearchableSnapshotsClient(NamespacedClient):
33
+
34
+ @_rewrite_parameters()
35
+ @_stability_warning(Stability.EXPERIMENTAL)
36
+ def cache_stats(
37
+ self,
38
+ *,
39
+ node_id: t.Optional[t.Union[str, t.Sequence[str]]] = None,
40
+ error_trace: t.Optional[bool] = None,
41
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
42
+ human: t.Optional[bool] = None,
43
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
44
+ pretty: t.Optional[bool] = None,
45
+ ) -> ObjectApiResponse[t.Any]:
46
+ """
47
+ .. raw:: html
48
+
49
+ <p>Get cache statistics.
50
+ Get statistics about the shared cache for partially mounted indices.</p>
51
+
52
+
53
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-searchable-snapshots-cache-stats>`_
54
+
55
+ :param node_id: The names of the nodes in the cluster to target.
56
+ :param master_timeout:
57
+ """
58
+ __path_parts: t.Dict[str, str]
59
+ if node_id not in SKIP_IN_PATH:
60
+ __path_parts = {"node_id": _quote(node_id)}
61
+ __path = f'/_searchable_snapshots/{__path_parts["node_id"]}/cache/stats'
62
+ else:
63
+ __path_parts = {}
64
+ __path = "/_searchable_snapshots/cache/stats"
65
+ __query: t.Dict[str, t.Any] = {}
66
+ if error_trace is not None:
67
+ __query["error_trace"] = error_trace
68
+ if filter_path is not None:
69
+ __query["filter_path"] = filter_path
70
+ if human is not None:
71
+ __query["human"] = human
72
+ if master_timeout is not None:
73
+ __query["master_timeout"] = master_timeout
74
+ if pretty is not None:
75
+ __query["pretty"] = pretty
76
+ __headers = {"accept": "application/json"}
77
+ return self.perform_request( # type: ignore[return-value]
78
+ "GET",
79
+ __path,
80
+ params=__query,
81
+ headers=__headers,
82
+ endpoint_id="searchable_snapshots.cache_stats",
83
+ path_parts=__path_parts,
84
+ )
85
+
86
+ @_rewrite_parameters()
87
+ @_stability_warning(Stability.EXPERIMENTAL)
88
+ def clear_cache(
89
+ self,
90
+ *,
91
+ index: t.Optional[t.Union[str, t.Sequence[str]]] = None,
92
+ allow_no_indices: t.Optional[bool] = None,
93
+ error_trace: t.Optional[bool] = None,
94
+ expand_wildcards: t.Optional[
95
+ t.Union[
96
+ t.Sequence[
97
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]]
98
+ ],
99
+ t.Union[str, t.Literal["all", "closed", "hidden", "none", "open"]],
100
+ ]
101
+ ] = None,
102
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
103
+ human: t.Optional[bool] = None,
104
+ ignore_unavailable: t.Optional[bool] = None,
105
+ pretty: t.Optional[bool] = None,
106
+ ) -> ObjectApiResponse[t.Any]:
107
+ """
108
+ .. raw:: html
109
+
110
+ <p>Clear the cache.
111
+ Clear indices and data streams from the shared cache for partially mounted indices.</p>
112
+
113
+
114
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-searchable-snapshots-clear-cache>`_
115
+
116
+ :param index: A comma-separated list of data streams, indices, and aliases to
117
+ clear from the cache. It supports wildcards (`*`).
118
+ :param allow_no_indices: Whether to ignore if a wildcard indices expression resolves
119
+ into no concrete indices. (This includes `_all` string or when no indices
120
+ have been specified)
121
+ :param expand_wildcards: Whether to expand wildcard expression to concrete indices
122
+ that are open, closed or both.
123
+ :param ignore_unavailable: Whether specified concrete indices should be ignored
124
+ when unavailable (missing or closed)
125
+ """
126
+ __path_parts: t.Dict[str, str]
127
+ if index not in SKIP_IN_PATH:
128
+ __path_parts = {"index": _quote(index)}
129
+ __path = f'/{__path_parts["index"]}/_searchable_snapshots/cache/clear'
130
+ else:
131
+ __path_parts = {}
132
+ __path = "/_searchable_snapshots/cache/clear"
133
+ __query: t.Dict[str, t.Any] = {}
134
+ if allow_no_indices is not None:
135
+ __query["allow_no_indices"] = allow_no_indices
136
+ if error_trace is not None:
137
+ __query["error_trace"] = error_trace
138
+ if expand_wildcards is not None:
139
+ __query["expand_wildcards"] = expand_wildcards
140
+ if filter_path is not None:
141
+ __query["filter_path"] = filter_path
142
+ if human is not None:
143
+ __query["human"] = human
144
+ if ignore_unavailable is not None:
145
+ __query["ignore_unavailable"] = ignore_unavailable
146
+ if pretty is not None:
147
+ __query["pretty"] = pretty
148
+ __headers = {"accept": "application/json"}
149
+ return self.perform_request( # type: ignore[return-value]
150
+ "POST",
151
+ __path,
152
+ params=__query,
153
+ headers=__headers,
154
+ endpoint_id="searchable_snapshots.clear_cache",
155
+ path_parts=__path_parts,
156
+ )
157
+
158
+ @_rewrite_parameters(
159
+ body_fields=(
160
+ "index",
161
+ "ignore_index_settings",
162
+ "index_settings",
163
+ "renamed_index",
164
+ ),
165
+ )
166
+ def mount(
167
+ self,
168
+ *,
169
+ repository: str,
170
+ snapshot: str,
171
+ index: t.Optional[str] = None,
172
+ error_trace: t.Optional[bool] = None,
173
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
174
+ human: t.Optional[bool] = None,
175
+ ignore_index_settings: t.Optional[t.Sequence[str]] = None,
176
+ index_settings: t.Optional[t.Mapping[str, t.Any]] = None,
177
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
178
+ pretty: t.Optional[bool] = None,
179
+ renamed_index: t.Optional[str] = None,
180
+ storage: t.Optional[str] = None,
181
+ wait_for_completion: t.Optional[bool] = None,
182
+ body: t.Optional[t.Dict[str, t.Any]] = None,
183
+ ) -> ObjectApiResponse[t.Any]:
184
+ """
185
+ .. raw:: html
186
+
187
+ <p>Mount a snapshot.
188
+ Mount a snapshot as a searchable snapshot index.
189
+ Do not use this API for snapshots managed by index lifecycle management (ILM).
190
+ Manually mounting ILM-managed snapshots can interfere with ILM processes.</p>
191
+
192
+
193
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-searchable-snapshots-mount>`_
194
+
195
+ :param repository: The name of the repository containing the snapshot of the
196
+ index to mount.
197
+ :param snapshot: The name of the snapshot of the index to mount.
198
+ :param index: The name of the index contained in the snapshot whose data is to
199
+ be mounted. If no `renamed_index` is specified, this name will also be used
200
+ to create the new index.
201
+ :param ignore_index_settings: The names of settings that should be removed from
202
+ the index when it is mounted.
203
+ :param index_settings: The settings that should be added to the index when it
204
+ is mounted.
205
+ :param master_timeout: The period to wait for the master node. If the master
206
+ node is not available before the timeout expires, the request fails and returns
207
+ an error. To indicate that the request should never timeout, set it to `-1`.
208
+ :param renamed_index: The name of the index that will be created.
209
+ :param storage: The mount option for the searchable snapshot index.
210
+ :param wait_for_completion: If true, the request blocks until the operation is
211
+ complete.
212
+ """
213
+ if repository in SKIP_IN_PATH:
214
+ raise ValueError("Empty value passed for parameter 'repository'")
215
+ if snapshot in SKIP_IN_PATH:
216
+ raise ValueError("Empty value passed for parameter 'snapshot'")
217
+ if index is None and body is None:
218
+ raise ValueError("Empty value passed for parameter 'index'")
219
+ __path_parts: t.Dict[str, str] = {
220
+ "repository": _quote(repository),
221
+ "snapshot": _quote(snapshot),
222
+ }
223
+ __path = (
224
+ f'/_snapshot/{__path_parts["repository"]}/{__path_parts["snapshot"]}/_mount'
225
+ )
226
+ __query: t.Dict[str, t.Any] = {}
227
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
228
+ if error_trace is not None:
229
+ __query["error_trace"] = error_trace
230
+ if filter_path is not None:
231
+ __query["filter_path"] = filter_path
232
+ if human is not None:
233
+ __query["human"] = human
234
+ if master_timeout is not None:
235
+ __query["master_timeout"] = master_timeout
236
+ if pretty is not None:
237
+ __query["pretty"] = pretty
238
+ if storage is not None:
239
+ __query["storage"] = storage
240
+ if wait_for_completion is not None:
241
+ __query["wait_for_completion"] = wait_for_completion
242
+ if not __body:
243
+ if index is not None:
244
+ __body["index"] = index
245
+ if ignore_index_settings is not None:
246
+ __body["ignore_index_settings"] = ignore_index_settings
247
+ if index_settings is not None:
248
+ __body["index_settings"] = index_settings
249
+ if renamed_index is not None:
250
+ __body["renamed_index"] = renamed_index
251
+ __headers = {"accept": "application/json", "content-type": "application/json"}
252
+ return self.perform_request( # type: ignore[return-value]
253
+ "POST",
254
+ __path,
255
+ params=__query,
256
+ headers=__headers,
257
+ body=__body,
258
+ endpoint_id="searchable_snapshots.mount",
259
+ path_parts=__path_parts,
260
+ )
261
+
262
+ @_rewrite_parameters()
263
+ def stats(
264
+ self,
265
+ *,
266
+ index: t.Optional[t.Union[str, t.Sequence[str]]] = None,
267
+ error_trace: t.Optional[bool] = None,
268
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
269
+ human: t.Optional[bool] = None,
270
+ level: t.Optional[
271
+ t.Union[str, t.Literal["cluster", "indices", "shards"]]
272
+ ] = None,
273
+ pretty: t.Optional[bool] = None,
274
+ ) -> ObjectApiResponse[t.Any]:
275
+ """
276
+ .. raw:: html
277
+
278
+ <p>Get searchable snapshot statistics.</p>
279
+
280
+
281
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-searchable-snapshots-stats>`_
282
+
283
+ :param index: A comma-separated list of data streams and indices to retrieve
284
+ statistics for.
285
+ :param level: Return stats aggregated at cluster, index or shard level
286
+ """
287
+ __path_parts: t.Dict[str, str]
288
+ if index not in SKIP_IN_PATH:
289
+ __path_parts = {"index": _quote(index)}
290
+ __path = f'/{__path_parts["index"]}/_searchable_snapshots/stats'
291
+ else:
292
+ __path_parts = {}
293
+ __path = "/_searchable_snapshots/stats"
294
+ __query: t.Dict[str, t.Any] = {}
295
+ if error_trace is not None:
296
+ __query["error_trace"] = error_trace
297
+ if filter_path is not None:
298
+ __query["filter_path"] = filter_path
299
+ if human is not None:
300
+ __query["human"] = human
301
+ if level is not None:
302
+ __query["level"] = level
303
+ if pretty is not None:
304
+ __query["pretty"] = pretty
305
+ __headers = {"accept": "application/json"}
306
+ return self.perform_request( # type: ignore[return-value]
307
+ "GET",
308
+ __path,
309
+ params=__query,
310
+ headers=__headers,
311
+ endpoint_id="searchable_snapshots.stats",
312
+ path_parts=__path_parts,
313
+ )