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,574 @@
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 SearchApplicationClient(NamespacedClient):
33
+
34
+ @_rewrite_parameters()
35
+ @_stability_warning(Stability.BETA)
36
+ async def delete(
37
+ self,
38
+ *,
39
+ name: str,
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
+ pretty: t.Optional[bool] = None,
44
+ ) -> ObjectApiResponse[t.Any]:
45
+ """
46
+ .. raw:: html
47
+
48
+ <p>Delete a search application.</p>
49
+ <p>Remove a search application and its associated alias. Indices attached to the search application are not removed.</p>
50
+
51
+
52
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-delete>`_
53
+
54
+ :param name: The name of the search application to delete.
55
+ """
56
+ if name in SKIP_IN_PATH:
57
+ raise ValueError("Empty value passed for parameter 'name'")
58
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
59
+ __path = f'/_application/search_application/{__path_parts["name"]}'
60
+ __query: t.Dict[str, t.Any] = {}
61
+ if error_trace is not None:
62
+ __query["error_trace"] = error_trace
63
+ if filter_path is not None:
64
+ __query["filter_path"] = filter_path
65
+ if human is not None:
66
+ __query["human"] = human
67
+ if pretty is not None:
68
+ __query["pretty"] = pretty
69
+ __headers = {"accept": "application/json"}
70
+ return await self.perform_request( # type: ignore[return-value]
71
+ "DELETE",
72
+ __path,
73
+ params=__query,
74
+ headers=__headers,
75
+ endpoint_id="search_application.delete",
76
+ path_parts=__path_parts,
77
+ )
78
+
79
+ @_rewrite_parameters()
80
+ @_stability_warning(Stability.EXPERIMENTAL)
81
+ async def delete_behavioral_analytics(
82
+ self,
83
+ *,
84
+ name: str,
85
+ error_trace: t.Optional[bool] = None,
86
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
87
+ human: t.Optional[bool] = None,
88
+ pretty: t.Optional[bool] = None,
89
+ ) -> ObjectApiResponse[t.Any]:
90
+ """
91
+ .. raw:: html
92
+
93
+ <p>Delete a behavioral analytics collection.
94
+ The associated data stream is also deleted.</p>
95
+
96
+
97
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-delete-behavioral-analytics>`_
98
+
99
+ :param name: The name of the analytics collection to be deleted
100
+ """
101
+ if name in SKIP_IN_PATH:
102
+ raise ValueError("Empty value passed for parameter 'name'")
103
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
104
+ __path = f'/_application/analytics/{__path_parts["name"]}'
105
+ __query: t.Dict[str, t.Any] = {}
106
+ if error_trace is not None:
107
+ __query["error_trace"] = error_trace
108
+ if filter_path is not None:
109
+ __query["filter_path"] = filter_path
110
+ if human is not None:
111
+ __query["human"] = human
112
+ if pretty is not None:
113
+ __query["pretty"] = pretty
114
+ __headers = {"accept": "application/json"}
115
+ return await self.perform_request( # type: ignore[return-value]
116
+ "DELETE",
117
+ __path,
118
+ params=__query,
119
+ headers=__headers,
120
+ endpoint_id="search_application.delete_behavioral_analytics",
121
+ path_parts=__path_parts,
122
+ )
123
+
124
+ @_rewrite_parameters()
125
+ @_stability_warning(Stability.BETA)
126
+ async def get(
127
+ self,
128
+ *,
129
+ name: str,
130
+ error_trace: t.Optional[bool] = None,
131
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
132
+ human: t.Optional[bool] = None,
133
+ pretty: t.Optional[bool] = None,
134
+ ) -> ObjectApiResponse[t.Any]:
135
+ """
136
+ .. raw:: html
137
+
138
+ <p>Get search application details.</p>
139
+
140
+
141
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-get>`_
142
+
143
+ :param name: The name of the search application
144
+ """
145
+ if name in SKIP_IN_PATH:
146
+ raise ValueError("Empty value passed for parameter 'name'")
147
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
148
+ __path = f'/_application/search_application/{__path_parts["name"]}'
149
+ __query: t.Dict[str, t.Any] = {}
150
+ if error_trace is not None:
151
+ __query["error_trace"] = error_trace
152
+ if filter_path is not None:
153
+ __query["filter_path"] = filter_path
154
+ if human is not None:
155
+ __query["human"] = human
156
+ if pretty is not None:
157
+ __query["pretty"] = pretty
158
+ __headers = {"accept": "application/json"}
159
+ return await self.perform_request( # type: ignore[return-value]
160
+ "GET",
161
+ __path,
162
+ params=__query,
163
+ headers=__headers,
164
+ endpoint_id="search_application.get",
165
+ path_parts=__path_parts,
166
+ )
167
+
168
+ @_rewrite_parameters()
169
+ @_stability_warning(Stability.EXPERIMENTAL)
170
+ async def get_behavioral_analytics(
171
+ self,
172
+ *,
173
+ name: t.Optional[t.Sequence[str]] = None,
174
+ error_trace: t.Optional[bool] = None,
175
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
176
+ human: t.Optional[bool] = None,
177
+ pretty: t.Optional[bool] = None,
178
+ ) -> ObjectApiResponse[t.Any]:
179
+ """
180
+ .. raw:: html
181
+
182
+ <p>Get behavioral analytics collections.</p>
183
+
184
+
185
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-get-behavioral-analytics>`_
186
+
187
+ :param name: A list of analytics collections to limit the returned information
188
+ """
189
+ __path_parts: t.Dict[str, str]
190
+ if name not in SKIP_IN_PATH:
191
+ __path_parts = {"name": _quote(name)}
192
+ __path = f'/_application/analytics/{__path_parts["name"]}'
193
+ else:
194
+ __path_parts = {}
195
+ __path = "/_application/analytics"
196
+ __query: t.Dict[str, t.Any] = {}
197
+ if error_trace is not None:
198
+ __query["error_trace"] = error_trace
199
+ if filter_path is not None:
200
+ __query["filter_path"] = filter_path
201
+ if human is not None:
202
+ __query["human"] = human
203
+ if pretty is not None:
204
+ __query["pretty"] = pretty
205
+ __headers = {"accept": "application/json"}
206
+ return await self.perform_request( # type: ignore[return-value]
207
+ "GET",
208
+ __path,
209
+ params=__query,
210
+ headers=__headers,
211
+ endpoint_id="search_application.get_behavioral_analytics",
212
+ path_parts=__path_parts,
213
+ )
214
+
215
+ @_rewrite_parameters(
216
+ parameter_aliases={"from": "from_"},
217
+ )
218
+ @_stability_warning(Stability.BETA)
219
+ async def list(
220
+ self,
221
+ *,
222
+ error_trace: t.Optional[bool] = None,
223
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
224
+ from_: t.Optional[int] = None,
225
+ human: t.Optional[bool] = None,
226
+ pretty: t.Optional[bool] = None,
227
+ q: t.Optional[str] = None,
228
+ size: t.Optional[int] = None,
229
+ ) -> ObjectApiResponse[t.Any]:
230
+ """
231
+ .. raw:: html
232
+
233
+ <p>Get search applications.
234
+ Get information about search applications.</p>
235
+
236
+
237
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-get-behavioral-analytics>`_
238
+
239
+ :param from_: Starting offset.
240
+ :param q: Query in the Lucene query string syntax.
241
+ :param size: Specifies a max number of results to get.
242
+ """
243
+ __path_parts: t.Dict[str, str] = {}
244
+ __path = "/_application/search_application"
245
+ __query: t.Dict[str, t.Any] = {}
246
+ if error_trace is not None:
247
+ __query["error_trace"] = error_trace
248
+ if filter_path is not None:
249
+ __query["filter_path"] = filter_path
250
+ if from_ is not None:
251
+ __query["from"] = from_
252
+ if human is not None:
253
+ __query["human"] = human
254
+ if pretty is not None:
255
+ __query["pretty"] = pretty
256
+ if q is not None:
257
+ __query["q"] = q
258
+ if size is not None:
259
+ __query["size"] = size
260
+ __headers = {"accept": "application/json"}
261
+ return await self.perform_request( # type: ignore[return-value]
262
+ "GET",
263
+ __path,
264
+ params=__query,
265
+ headers=__headers,
266
+ endpoint_id="search_application.list",
267
+ path_parts=__path_parts,
268
+ )
269
+
270
+ @_rewrite_parameters(
271
+ body_name="payload",
272
+ )
273
+ @_stability_warning(Stability.EXPERIMENTAL)
274
+ async def post_behavioral_analytics_event(
275
+ self,
276
+ *,
277
+ collection_name: str,
278
+ event_type: t.Union[str, t.Literal["page_view", "search", "search_click"]],
279
+ payload: t.Optional[t.Any] = None,
280
+ body: t.Optional[t.Any] = None,
281
+ debug: t.Optional[bool] = None,
282
+ error_trace: t.Optional[bool] = None,
283
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
284
+ human: t.Optional[bool] = None,
285
+ pretty: t.Optional[bool] = None,
286
+ ) -> ObjectApiResponse[t.Any]:
287
+ """
288
+ .. raw:: html
289
+
290
+ <p>Create a behavioral analytics collection event.</p>
291
+
292
+
293
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-post-behavioral-analytics-event>`_
294
+
295
+ :param collection_name: The name of the behavioral analytics collection.
296
+ :param event_type: The analytics event type.
297
+ :param payload:
298
+ :param debug: Whether the response type has to include more details
299
+ """
300
+ if collection_name in SKIP_IN_PATH:
301
+ raise ValueError("Empty value passed for parameter 'collection_name'")
302
+ if event_type in SKIP_IN_PATH:
303
+ raise ValueError("Empty value passed for parameter 'event_type'")
304
+ if payload is None and body is None:
305
+ raise ValueError(
306
+ "Empty value passed for parameters 'payload' and 'body', one of them should be set."
307
+ )
308
+ elif payload is not None and body is not None:
309
+ raise ValueError("Cannot set both 'payload' and 'body'")
310
+ __path_parts: t.Dict[str, str] = {
311
+ "collection_name": _quote(collection_name),
312
+ "event_type": _quote(event_type),
313
+ }
314
+ __path = f'/_application/analytics/{__path_parts["collection_name"]}/event/{__path_parts["event_type"]}'
315
+ __query: t.Dict[str, t.Any] = {}
316
+ if debug is not None:
317
+ __query["debug"] = debug
318
+ if error_trace is not None:
319
+ __query["error_trace"] = error_trace
320
+ if filter_path is not None:
321
+ __query["filter_path"] = filter_path
322
+ if human is not None:
323
+ __query["human"] = human
324
+ if pretty is not None:
325
+ __query["pretty"] = pretty
326
+ __body = payload if payload is not None else body
327
+ __headers = {"accept": "application/json", "content-type": "application/json"}
328
+ return await self.perform_request( # type: ignore[return-value]
329
+ "POST",
330
+ __path,
331
+ params=__query,
332
+ headers=__headers,
333
+ body=__body,
334
+ endpoint_id="search_application.post_behavioral_analytics_event",
335
+ path_parts=__path_parts,
336
+ )
337
+
338
+ @_rewrite_parameters(
339
+ body_name="search_application",
340
+ )
341
+ @_stability_warning(Stability.BETA)
342
+ async def put(
343
+ self,
344
+ *,
345
+ name: str,
346
+ search_application: t.Optional[t.Mapping[str, t.Any]] = None,
347
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
348
+ create: t.Optional[bool] = None,
349
+ error_trace: t.Optional[bool] = None,
350
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
351
+ human: t.Optional[bool] = None,
352
+ pretty: t.Optional[bool] = None,
353
+ ) -> ObjectApiResponse[t.Any]:
354
+ """
355
+ .. raw:: html
356
+
357
+ <p>Create or update a search application.</p>
358
+
359
+
360
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-put>`_
361
+
362
+ :param name: The name of the search application to be created or updated.
363
+ :param search_application:
364
+ :param create: If `true`, this request cannot replace or update existing Search
365
+ Applications.
366
+ """
367
+ if name in SKIP_IN_PATH:
368
+ raise ValueError("Empty value passed for parameter 'name'")
369
+ if search_application is None and body is None:
370
+ raise ValueError(
371
+ "Empty value passed for parameters 'search_application' and 'body', one of them should be set."
372
+ )
373
+ elif search_application is not None and body is not None:
374
+ raise ValueError("Cannot set both 'search_application' and 'body'")
375
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
376
+ __path = f'/_application/search_application/{__path_parts["name"]}'
377
+ __query: t.Dict[str, t.Any] = {}
378
+ if create is not None:
379
+ __query["create"] = create
380
+ if error_trace is not None:
381
+ __query["error_trace"] = error_trace
382
+ if filter_path is not None:
383
+ __query["filter_path"] = filter_path
384
+ if human is not None:
385
+ __query["human"] = human
386
+ if pretty is not None:
387
+ __query["pretty"] = pretty
388
+ __body = search_application if search_application is not None else body
389
+ __headers = {"accept": "application/json", "content-type": "application/json"}
390
+ return await self.perform_request( # type: ignore[return-value]
391
+ "PUT",
392
+ __path,
393
+ params=__query,
394
+ headers=__headers,
395
+ body=__body,
396
+ endpoint_id="search_application.put",
397
+ path_parts=__path_parts,
398
+ )
399
+
400
+ @_rewrite_parameters()
401
+ @_stability_warning(Stability.EXPERIMENTAL)
402
+ async def put_behavioral_analytics(
403
+ self,
404
+ *,
405
+ name: str,
406
+ error_trace: t.Optional[bool] = None,
407
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
408
+ human: t.Optional[bool] = None,
409
+ pretty: t.Optional[bool] = None,
410
+ ) -> ObjectApiResponse[t.Any]:
411
+ """
412
+ .. raw:: html
413
+
414
+ <p>Create a behavioral analytics collection.</p>
415
+
416
+
417
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-put-behavioral-analytics>`_
418
+
419
+ :param name: The name of the analytics collection to be created or updated.
420
+ """
421
+ if name in SKIP_IN_PATH:
422
+ raise ValueError("Empty value passed for parameter 'name'")
423
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
424
+ __path = f'/_application/analytics/{__path_parts["name"]}'
425
+ __query: t.Dict[str, t.Any] = {}
426
+ if error_trace is not None:
427
+ __query["error_trace"] = error_trace
428
+ if filter_path is not None:
429
+ __query["filter_path"] = filter_path
430
+ if human is not None:
431
+ __query["human"] = human
432
+ if pretty is not None:
433
+ __query["pretty"] = pretty
434
+ __headers = {"accept": "application/json"}
435
+ return await self.perform_request( # type: ignore[return-value]
436
+ "PUT",
437
+ __path,
438
+ params=__query,
439
+ headers=__headers,
440
+ endpoint_id="search_application.put_behavioral_analytics",
441
+ path_parts=__path_parts,
442
+ )
443
+
444
+ @_rewrite_parameters(
445
+ body_fields=("params",),
446
+ ignore_deprecated_options={"params"},
447
+ )
448
+ @_stability_warning(Stability.EXPERIMENTAL)
449
+ async def render_query(
450
+ self,
451
+ *,
452
+ name: str,
453
+ error_trace: t.Optional[bool] = None,
454
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
455
+ human: t.Optional[bool] = None,
456
+ params: t.Optional[t.Mapping[str, t.Any]] = None,
457
+ pretty: t.Optional[bool] = None,
458
+ body: t.Optional[t.Dict[str, t.Any]] = None,
459
+ ) -> ObjectApiResponse[t.Any]:
460
+ """
461
+ .. raw:: html
462
+
463
+ <p>Render a search application query.
464
+ Generate an Elasticsearch query using the specified query parameters and the search template associated with the search application or a default template if none is specified.
465
+ If a parameter used in the search template is not specified in <code>params</code>, the parameter's default value will be used.
466
+ The API returns the specific Elasticsearch query that would be generated and run by calling the search application search API.</p>
467
+ <p>You must have <code>read</code> privileges on the backing alias of the search application.</p>
468
+
469
+
470
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-render-query>`_
471
+
472
+ :param name: The name of the search application to render teh query for.
473
+ :param params:
474
+ """
475
+ if name in SKIP_IN_PATH:
476
+ raise ValueError("Empty value passed for parameter 'name'")
477
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
478
+ __path = (
479
+ f'/_application/search_application/{__path_parts["name"]}/_render_query'
480
+ )
481
+ __query: t.Dict[str, t.Any] = {}
482
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
483
+ if error_trace is not None:
484
+ __query["error_trace"] = error_trace
485
+ if filter_path is not None:
486
+ __query["filter_path"] = filter_path
487
+ if human is not None:
488
+ __query["human"] = human
489
+ if pretty is not None:
490
+ __query["pretty"] = pretty
491
+ if not __body:
492
+ if params is not None:
493
+ __body["params"] = params
494
+ if not __body:
495
+ __body = None # type: ignore[assignment]
496
+ __headers = {"accept": "application/json"}
497
+ if __body is not None:
498
+ __headers["content-type"] = "application/json"
499
+ return await self.perform_request( # type: ignore[return-value]
500
+ "POST",
501
+ __path,
502
+ params=__query,
503
+ headers=__headers,
504
+ body=__body,
505
+ endpoint_id="search_application.render_query",
506
+ path_parts=__path_parts,
507
+ )
508
+
509
+ @_rewrite_parameters(
510
+ body_fields=("params",),
511
+ ignore_deprecated_options={"params"},
512
+ )
513
+ @_stability_warning(Stability.BETA)
514
+ async def search(
515
+ self,
516
+ *,
517
+ name: str,
518
+ error_trace: t.Optional[bool] = None,
519
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
520
+ human: t.Optional[bool] = None,
521
+ params: t.Optional[t.Mapping[str, t.Any]] = None,
522
+ pretty: t.Optional[bool] = None,
523
+ typed_keys: t.Optional[bool] = None,
524
+ body: t.Optional[t.Dict[str, t.Any]] = None,
525
+ ) -> ObjectApiResponse[t.Any]:
526
+ """
527
+ .. raw:: html
528
+
529
+ <p>Run a search application search.
530
+ Generate and run an Elasticsearch query that uses the specified query parameteter and the search template associated with the search application or default template.
531
+ Unspecified template parameters are assigned their default values if applicable.</p>
532
+
533
+
534
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-search-application-search>`_
535
+
536
+ :param name: The name of the search application to be searched.
537
+ :param params: Query parameters specific to this request, which will override
538
+ any defaults specified in the template.
539
+ :param typed_keys: Determines whether aggregation names are prefixed by their
540
+ respective types in the response.
541
+ """
542
+ if name in SKIP_IN_PATH:
543
+ raise ValueError("Empty value passed for parameter 'name'")
544
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
545
+ __path = f'/_application/search_application/{__path_parts["name"]}/_search'
546
+ __query: t.Dict[str, t.Any] = {}
547
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
548
+ if error_trace is not None:
549
+ __query["error_trace"] = error_trace
550
+ if filter_path is not None:
551
+ __query["filter_path"] = filter_path
552
+ if human is not None:
553
+ __query["human"] = human
554
+ if pretty is not None:
555
+ __query["pretty"] = pretty
556
+ if typed_keys is not None:
557
+ __query["typed_keys"] = typed_keys
558
+ if not __body:
559
+ if params is not None:
560
+ __body["params"] = params
561
+ if not __body:
562
+ __body = None # type: ignore[assignment]
563
+ __headers = {"accept": "application/json"}
564
+ if __body is not None:
565
+ __headers["content-type"] = "application/json"
566
+ return await self.perform_request( # type: ignore[return-value]
567
+ "POST",
568
+ __path,
569
+ params=__query,
570
+ headers=__headers,
571
+ body=__body,
572
+ endpoint_id="search_application.search",
573
+ path_parts=__path_parts,
574
+ )