elasticsearch 8.11.1__py3-none-any.whl → 8.12.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.
- elasticsearch/_async/client/__init__.py +493 -347
- elasticsearch/_async/client/async_search.py +108 -72
- elasticsearch/_async/client/autoscaling.py +13 -8
- elasticsearch/_async/client/cat.py +26 -26
- elasticsearch/_async/client/ccr.py +178 -117
- elasticsearch/_async/client/cluster.py +56 -48
- elasticsearch/_async/client/dangling_indices.py +3 -3
- elasticsearch/_async/client/enrich.py +15 -13
- elasticsearch/_async/client/eql.py +53 -36
- elasticsearch/_async/client/esql.py +99 -0
- elasticsearch/_async/client/features.py +2 -2
- elasticsearch/_async/client/fleet.py +111 -71
- elasticsearch/_async/client/graph.py +13 -11
- elasticsearch/_async/client/ilm.py +33 -27
- elasticsearch/_async/client/indices.py +326 -227
- elasticsearch/_async/client/inference.py +212 -0
- elasticsearch/_async/client/ingest.py +28 -24
- elasticsearch/_async/client/license.py +15 -13
- elasticsearch/_async/client/logstash.py +13 -10
- elasticsearch/_async/client/migration.py +3 -3
- elasticsearch/_async/client/ml.py +758 -538
- elasticsearch/_async/client/monitoring.py +10 -5
- elasticsearch/_async/client/nodes.py +13 -11
- elasticsearch/_async/client/query_ruleset.py +12 -10
- elasticsearch/_async/client/rollup.py +59 -46
- elasticsearch/_async/client/search_application.py +23 -16
- elasticsearch/_async/client/searchable_snapshots.py +23 -16
- elasticsearch/_async/client/security.py +391 -289
- elasticsearch/_async/client/shutdown.py +18 -14
- elasticsearch/_async/client/slm.py +23 -21
- elasticsearch/_async/client/snapshot.py +91 -65
- elasticsearch/_async/client/sql.py +81 -58
- elasticsearch/_async/client/ssl.py +1 -1
- elasticsearch/_async/client/synonyms.py +23 -19
- elasticsearch/_async/client/tasks.py +3 -3
- elasticsearch/_async/client/text_structure.py +10 -5
- elasticsearch/_async/client/transform.py +111 -75
- elasticsearch/_async/client/watcher.py +77 -55
- elasticsearch/_async/client/xpack.py +2 -2
- elasticsearch/_async/helpers.py +1 -1
- elasticsearch/_sync/client/__init__.py +493 -347
- elasticsearch/_sync/client/async_search.py +108 -72
- elasticsearch/_sync/client/autoscaling.py +13 -8
- elasticsearch/_sync/client/cat.py +26 -26
- elasticsearch/_sync/client/ccr.py +178 -117
- elasticsearch/_sync/client/cluster.py +56 -48
- elasticsearch/_sync/client/dangling_indices.py +3 -3
- elasticsearch/_sync/client/enrich.py +15 -13
- elasticsearch/_sync/client/eql.py +53 -36
- elasticsearch/_sync/client/esql.py +99 -0
- elasticsearch/_sync/client/features.py +2 -2
- elasticsearch/_sync/client/fleet.py +111 -71
- elasticsearch/_sync/client/graph.py +13 -11
- elasticsearch/_sync/client/ilm.py +33 -27
- elasticsearch/_sync/client/indices.py +326 -227
- elasticsearch/_sync/client/inference.py +212 -0
- elasticsearch/_sync/client/ingest.py +28 -24
- elasticsearch/_sync/client/license.py +15 -13
- elasticsearch/_sync/client/logstash.py +13 -10
- elasticsearch/_sync/client/migration.py +3 -3
- elasticsearch/_sync/client/ml.py +758 -538
- elasticsearch/_sync/client/monitoring.py +10 -5
- elasticsearch/_sync/client/nodes.py +13 -11
- elasticsearch/_sync/client/query_ruleset.py +12 -10
- elasticsearch/_sync/client/rollup.py +59 -46
- elasticsearch/_sync/client/search_application.py +23 -16
- elasticsearch/_sync/client/searchable_snapshots.py +23 -16
- elasticsearch/_sync/client/security.py +391 -289
- elasticsearch/_sync/client/shutdown.py +18 -14
- elasticsearch/_sync/client/slm.py +23 -21
- elasticsearch/_sync/client/snapshot.py +91 -65
- elasticsearch/_sync/client/sql.py +81 -58
- elasticsearch/_sync/client/ssl.py +1 -1
- elasticsearch/_sync/client/synonyms.py +23 -19
- elasticsearch/_sync/client/tasks.py +3 -3
- elasticsearch/_sync/client/text_structure.py +10 -5
- elasticsearch/_sync/client/transform.py +111 -75
- elasticsearch/_sync/client/utils.py +34 -10
- elasticsearch/_sync/client/watcher.py +77 -55
- elasticsearch/_sync/client/xpack.py +2 -2
- elasticsearch/_version.py +1 -1
- elasticsearch/client.py +2 -0
- elasticsearch/helpers/actions.py +1 -1
- {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/METADATA +2 -3
- elasticsearch-8.12.0.dist-info/RECORD +103 -0
- elasticsearch-8.11.1.dist-info/RECORD +0 -99
- {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/LICENSE +0 -0
- {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/NOTICE +0 -0
- {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/WHEEL +0 -0
- {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/top_level.txt +0 -0
|
@@ -25,31 +25,30 @@ from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
|
|
|
25
25
|
|
|
26
26
|
class SqlClient(NamespacedClient):
|
|
27
27
|
@_rewrite_parameters(
|
|
28
|
-
body_fields=
|
|
28
|
+
body_fields=("cursor",),
|
|
29
29
|
)
|
|
30
30
|
def clear_cursor(
|
|
31
31
|
self,
|
|
32
32
|
*,
|
|
33
|
-
cursor: str,
|
|
33
|
+
cursor: t.Optional[str] = None,
|
|
34
34
|
error_trace: t.Optional[bool] = None,
|
|
35
35
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
36
36
|
human: t.Optional[bool] = None,
|
|
37
37
|
pretty: t.Optional[bool] = None,
|
|
38
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
38
39
|
) -> ObjectApiResponse[t.Any]:
|
|
39
40
|
"""
|
|
40
41
|
Clears the SQL cursor
|
|
41
42
|
|
|
42
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
43
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/clear-sql-cursor-api.html>`_
|
|
43
44
|
|
|
44
45
|
:param cursor: Cursor to clear.
|
|
45
46
|
"""
|
|
46
|
-
if cursor is None:
|
|
47
|
+
if cursor is None and body is None:
|
|
47
48
|
raise ValueError("Empty value passed for parameter 'cursor'")
|
|
48
49
|
__path = "/_sql/close"
|
|
49
|
-
__body: t.Dict[str, t.Any] = {}
|
|
50
50
|
__query: t.Dict[str, t.Any] = {}
|
|
51
|
-
if
|
|
52
|
-
__body["cursor"] = cursor
|
|
51
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
53
52
|
if error_trace is not None:
|
|
54
53
|
__query["error_trace"] = error_trace
|
|
55
54
|
if filter_path is not None:
|
|
@@ -58,6 +57,9 @@ class SqlClient(NamespacedClient):
|
|
|
58
57
|
__query["human"] = human
|
|
59
58
|
if pretty is not None:
|
|
60
59
|
__query["pretty"] = pretty
|
|
60
|
+
if not __body:
|
|
61
|
+
if cursor is not None:
|
|
62
|
+
__body["cursor"] = cursor
|
|
61
63
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
62
64
|
return self.perform_request( # type: ignore[return-value]
|
|
63
65
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -77,7 +79,7 @@ class SqlClient(NamespacedClient):
|
|
|
77
79
|
Deletes an async SQL search or a stored synchronous SQL search. If the search
|
|
78
80
|
is still running, the API cancels it.
|
|
79
81
|
|
|
80
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
82
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-async-sql-search-api.html>`_
|
|
81
83
|
|
|
82
84
|
:param id: Identifier for the search.
|
|
83
85
|
"""
|
|
@@ -118,7 +120,7 @@ class SqlClient(NamespacedClient):
|
|
|
118
120
|
Returns the current status and available results for an async SQL search or stored
|
|
119
121
|
synchronous SQL search
|
|
120
122
|
|
|
121
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
123
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-async-sql-search-api.html>`_
|
|
122
124
|
|
|
123
125
|
:param id: Identifier for the search.
|
|
124
126
|
:param delimiter: Separator for CSV results. The API only supports this parameter
|
|
@@ -170,7 +172,7 @@ class SqlClient(NamespacedClient):
|
|
|
170
172
|
Returns the current status of an async SQL search or a stored synchronous SQL
|
|
171
173
|
search
|
|
172
174
|
|
|
173
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
175
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-async-sql-search-status-api.html>`_
|
|
174
176
|
|
|
175
177
|
:param id: Identifier for the search.
|
|
176
178
|
"""
|
|
@@ -192,7 +194,24 @@ class SqlClient(NamespacedClient):
|
|
|
192
194
|
)
|
|
193
195
|
|
|
194
196
|
@_rewrite_parameters(
|
|
195
|
-
body_fields=
|
|
197
|
+
body_fields=(
|
|
198
|
+
"catalog",
|
|
199
|
+
"columnar",
|
|
200
|
+
"cursor",
|
|
201
|
+
"fetch_size",
|
|
202
|
+
"field_multi_value_leniency",
|
|
203
|
+
"filter",
|
|
204
|
+
"index_using_frozen",
|
|
205
|
+
"keep_alive",
|
|
206
|
+
"keep_on_completion",
|
|
207
|
+
"page_timeout",
|
|
208
|
+
"params",
|
|
209
|
+
"query",
|
|
210
|
+
"request_timeout",
|
|
211
|
+
"runtime_mappings",
|
|
212
|
+
"time_zone",
|
|
213
|
+
"wait_for_completion_timeout",
|
|
214
|
+
),
|
|
196
215
|
ignore_deprecated_options={"params", "request_timeout"},
|
|
197
216
|
)
|
|
198
217
|
def query(
|
|
@@ -223,11 +242,12 @@ class SqlClient(NamespacedClient):
|
|
|
223
242
|
wait_for_completion_timeout: t.Optional[
|
|
224
243
|
t.Union["t.Literal[-1]", "t.Literal[0]", str]
|
|
225
244
|
] = None,
|
|
245
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
226
246
|
) -> ObjectApiResponse[t.Any]:
|
|
227
247
|
"""
|
|
228
248
|
Executes a SQL request
|
|
229
249
|
|
|
230
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
250
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/sql-search-api.html>`_
|
|
231
251
|
|
|
232
252
|
:param catalog: Default catalog (cluster) for queries. If unspecified, the queries
|
|
233
253
|
execute on the data in the local cluster only.
|
|
@@ -261,62 +281,63 @@ class SqlClient(NamespacedClient):
|
|
|
261
281
|
the search doesn’t finish within this period, the search becomes async.
|
|
262
282
|
"""
|
|
263
283
|
__path = "/_sql"
|
|
264
|
-
__body: t.Dict[str, t.Any] = {}
|
|
265
284
|
__query: t.Dict[str, t.Any] = {}
|
|
266
|
-
if
|
|
267
|
-
__body["catalog"] = catalog
|
|
268
|
-
if columnar is not None:
|
|
269
|
-
__body["columnar"] = columnar
|
|
270
|
-
if cursor is not None:
|
|
271
|
-
__body["cursor"] = cursor
|
|
285
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
272
286
|
if error_trace is not None:
|
|
273
287
|
__query["error_trace"] = error_trace
|
|
274
|
-
if fetch_size is not None:
|
|
275
|
-
__body["fetch_size"] = fetch_size
|
|
276
|
-
if field_multi_value_leniency is not None:
|
|
277
|
-
__body["field_multi_value_leniency"] = field_multi_value_leniency
|
|
278
|
-
if filter is not None:
|
|
279
|
-
__body["filter"] = filter
|
|
280
288
|
if filter_path is not None:
|
|
281
289
|
__query["filter_path"] = filter_path
|
|
282
290
|
if format is not None:
|
|
283
291
|
__query["format"] = format
|
|
284
292
|
if human is not None:
|
|
285
293
|
__query["human"] = human
|
|
286
|
-
if index_using_frozen is not None:
|
|
287
|
-
__body["index_using_frozen"] = index_using_frozen
|
|
288
|
-
if keep_alive is not None:
|
|
289
|
-
__body["keep_alive"] = keep_alive
|
|
290
|
-
if keep_on_completion is not None:
|
|
291
|
-
__body["keep_on_completion"] = keep_on_completion
|
|
292
|
-
if page_timeout is not None:
|
|
293
|
-
__body["page_timeout"] = page_timeout
|
|
294
|
-
if params is not None:
|
|
295
|
-
__body["params"] = params
|
|
296
294
|
if pretty is not None:
|
|
297
295
|
__query["pretty"] = pretty
|
|
298
|
-
if
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
296
|
+
if not __body:
|
|
297
|
+
if catalog is not None:
|
|
298
|
+
__body["catalog"] = catalog
|
|
299
|
+
if columnar is not None:
|
|
300
|
+
__body["columnar"] = columnar
|
|
301
|
+
if cursor is not None:
|
|
302
|
+
__body["cursor"] = cursor
|
|
303
|
+
if fetch_size is not None:
|
|
304
|
+
__body["fetch_size"] = fetch_size
|
|
305
|
+
if field_multi_value_leniency is not None:
|
|
306
|
+
__body["field_multi_value_leniency"] = field_multi_value_leniency
|
|
307
|
+
if filter is not None:
|
|
308
|
+
__body["filter"] = filter
|
|
309
|
+
if index_using_frozen is not None:
|
|
310
|
+
__body["index_using_frozen"] = index_using_frozen
|
|
311
|
+
if keep_alive is not None:
|
|
312
|
+
__body["keep_alive"] = keep_alive
|
|
313
|
+
if keep_on_completion is not None:
|
|
314
|
+
__body["keep_on_completion"] = keep_on_completion
|
|
315
|
+
if page_timeout is not None:
|
|
316
|
+
__body["page_timeout"] = page_timeout
|
|
317
|
+
if params is not None:
|
|
318
|
+
__body["params"] = params
|
|
319
|
+
if query is not None:
|
|
320
|
+
__body["query"] = query
|
|
321
|
+
if request_timeout is not None:
|
|
322
|
+
__body["request_timeout"] = request_timeout
|
|
323
|
+
if runtime_mappings is not None:
|
|
324
|
+
__body["runtime_mappings"] = runtime_mappings
|
|
325
|
+
if time_zone is not None:
|
|
326
|
+
__body["time_zone"] = time_zone
|
|
327
|
+
if wait_for_completion_timeout is not None:
|
|
328
|
+
__body["wait_for_completion_timeout"] = wait_for_completion_timeout
|
|
308
329
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
309
330
|
return self.perform_request( # type: ignore[return-value]
|
|
310
331
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
311
332
|
)
|
|
312
333
|
|
|
313
334
|
@_rewrite_parameters(
|
|
314
|
-
body_fields=
|
|
335
|
+
body_fields=("query", "fetch_size", "filter", "time_zone"),
|
|
315
336
|
)
|
|
316
337
|
def translate(
|
|
317
338
|
self,
|
|
318
339
|
*,
|
|
319
|
-
query: str,
|
|
340
|
+
query: t.Optional[str] = None,
|
|
320
341
|
error_trace: t.Optional[bool] = None,
|
|
321
342
|
fetch_size: t.Optional[int] = None,
|
|
322
343
|
filter: t.Optional[t.Mapping[str, t.Any]] = None,
|
|
@@ -324,38 +345,40 @@ class SqlClient(NamespacedClient):
|
|
|
324
345
|
human: t.Optional[bool] = None,
|
|
325
346
|
pretty: t.Optional[bool] = None,
|
|
326
347
|
time_zone: t.Optional[str] = None,
|
|
348
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
327
349
|
) -> ObjectApiResponse[t.Any]:
|
|
328
350
|
"""
|
|
329
351
|
Translates SQL into Elasticsearch queries
|
|
330
352
|
|
|
331
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
353
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/sql-translate-api.html>`_
|
|
332
354
|
|
|
333
355
|
:param query: SQL query to run.
|
|
334
356
|
:param fetch_size: The maximum number of rows (or entries) to return in one response.
|
|
335
357
|
:param filter: Elasticsearch query DSL for additional filtering.
|
|
336
358
|
:param time_zone: ISO-8601 time zone ID for the search.
|
|
337
359
|
"""
|
|
338
|
-
if query is None:
|
|
360
|
+
if query is None and body is None:
|
|
339
361
|
raise ValueError("Empty value passed for parameter 'query'")
|
|
340
362
|
__path = "/_sql/translate"
|
|
341
|
-
__body: t.Dict[str, t.Any] = {}
|
|
342
363
|
__query: t.Dict[str, t.Any] = {}
|
|
343
|
-
if
|
|
344
|
-
__body["query"] = query
|
|
364
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
345
365
|
if error_trace is not None:
|
|
346
366
|
__query["error_trace"] = error_trace
|
|
347
|
-
if fetch_size is not None:
|
|
348
|
-
__body["fetch_size"] = fetch_size
|
|
349
|
-
if filter is not None:
|
|
350
|
-
__body["filter"] = filter
|
|
351
367
|
if filter_path is not None:
|
|
352
368
|
__query["filter_path"] = filter_path
|
|
353
369
|
if human is not None:
|
|
354
370
|
__query["human"] = human
|
|
355
371
|
if pretty is not None:
|
|
356
372
|
__query["pretty"] = pretty
|
|
357
|
-
if
|
|
358
|
-
|
|
373
|
+
if not __body:
|
|
374
|
+
if query is not None:
|
|
375
|
+
__body["query"] = query
|
|
376
|
+
if fetch_size is not None:
|
|
377
|
+
__body["fetch_size"] = fetch_size
|
|
378
|
+
if filter is not None:
|
|
379
|
+
__body["filter"] = filter
|
|
380
|
+
if time_zone is not None:
|
|
381
|
+
__body["time_zone"] = time_zone
|
|
359
382
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
360
383
|
return self.perform_request( # type: ignore[return-value]
|
|
361
384
|
"POST", __path, params=__query, headers=__headers, body=__body
|
|
@@ -37,7 +37,7 @@ class SslClient(NamespacedClient):
|
|
|
37
37
|
Retrieves information about the X.509 certificates used to encrypt communications
|
|
38
38
|
in the cluster.
|
|
39
39
|
|
|
40
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
40
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/security-api-ssl.html>`_
|
|
41
41
|
"""
|
|
42
42
|
__path = "/_ssl/certificates"
|
|
43
43
|
__query: t.Dict[str, t.Any] = {}
|
|
@@ -37,7 +37,7 @@ class SynonymsClient(NamespacedClient):
|
|
|
37
37
|
"""
|
|
38
38
|
Deletes a synonym set
|
|
39
39
|
|
|
40
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
40
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-synonyms-set.html>`_
|
|
41
41
|
|
|
42
42
|
:param id: The id of the synonyms set to be deleted
|
|
43
43
|
"""
|
|
@@ -72,7 +72,7 @@ class SynonymsClient(NamespacedClient):
|
|
|
72
72
|
"""
|
|
73
73
|
Deletes a synonym rule in a synonym set
|
|
74
74
|
|
|
75
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
75
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/delete-synonym-rule.html>`_
|
|
76
76
|
|
|
77
77
|
:param set_id: The id of the synonym set to be updated
|
|
78
78
|
:param rule_id: The id of the synonym rule to be deleted
|
|
@@ -113,7 +113,7 @@ class SynonymsClient(NamespacedClient):
|
|
|
113
113
|
"""
|
|
114
114
|
Retrieves a synonym set
|
|
115
115
|
|
|
116
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
116
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-synonyms-set.html>`_
|
|
117
117
|
|
|
118
118
|
:param id: "The id of the synonyms set to be retrieved
|
|
119
119
|
:param from_: Starting offset for query rules to be retrieved
|
|
@@ -154,7 +154,7 @@ class SynonymsClient(NamespacedClient):
|
|
|
154
154
|
"""
|
|
155
155
|
Retrieves a synonym rule from a synonym set
|
|
156
156
|
|
|
157
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
157
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-synonym-rule.html>`_
|
|
158
158
|
|
|
159
159
|
:param set_id: The id of the synonym set to retrieve the synonym rule from
|
|
160
160
|
:param rule_id: The id of the synonym rule to retrieve
|
|
@@ -194,7 +194,7 @@ class SynonymsClient(NamespacedClient):
|
|
|
194
194
|
"""
|
|
195
195
|
Retrieves a summary of all defined synonym sets
|
|
196
196
|
|
|
197
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
197
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/list-synonyms-sets.html>`_
|
|
198
198
|
|
|
199
199
|
:param from_: Starting offset
|
|
200
200
|
:param size: specifies a max number of results to get
|
|
@@ -219,35 +219,34 @@ class SynonymsClient(NamespacedClient):
|
|
|
219
219
|
)
|
|
220
220
|
|
|
221
221
|
@_rewrite_parameters(
|
|
222
|
-
body_fields=
|
|
222
|
+
body_fields=("synonyms_set",),
|
|
223
223
|
)
|
|
224
224
|
def put_synonym(
|
|
225
225
|
self,
|
|
226
226
|
*,
|
|
227
227
|
id: str,
|
|
228
|
-
synonyms_set: t.Sequence[t.Mapping[str, t.Any]],
|
|
228
|
+
synonyms_set: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
|
|
229
229
|
error_trace: t.Optional[bool] = None,
|
|
230
230
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
231
231
|
human: t.Optional[bool] = None,
|
|
232
232
|
pretty: t.Optional[bool] = None,
|
|
233
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
233
234
|
) -> ObjectApiResponse[t.Any]:
|
|
234
235
|
"""
|
|
235
236
|
Creates or updates a synonyms set
|
|
236
237
|
|
|
237
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
238
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-synonyms-set.html>`_
|
|
238
239
|
|
|
239
240
|
:param id: The id of the synonyms set to be created or updated
|
|
240
241
|
:param synonyms_set: The synonym set information to update
|
|
241
242
|
"""
|
|
242
243
|
if id in SKIP_IN_PATH:
|
|
243
244
|
raise ValueError("Empty value passed for parameter 'id'")
|
|
244
|
-
if synonyms_set is None:
|
|
245
|
+
if synonyms_set is None and body is None:
|
|
245
246
|
raise ValueError("Empty value passed for parameter 'synonyms_set'")
|
|
246
247
|
__path = f"/_synonyms/{_quote(id)}"
|
|
247
|
-
__body: t.Dict[str, t.Any] = {}
|
|
248
248
|
__query: t.Dict[str, t.Any] = {}
|
|
249
|
-
if
|
|
250
|
-
__body["synonyms_set"] = synonyms_set
|
|
249
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
251
250
|
if error_trace is not None:
|
|
252
251
|
__query["error_trace"] = error_trace
|
|
253
252
|
if filter_path is not None:
|
|
@@ -256,29 +255,33 @@ class SynonymsClient(NamespacedClient):
|
|
|
256
255
|
__query["human"] = human
|
|
257
256
|
if pretty is not None:
|
|
258
257
|
__query["pretty"] = pretty
|
|
258
|
+
if not __body:
|
|
259
|
+
if synonyms_set is not None:
|
|
260
|
+
__body["synonyms_set"] = synonyms_set
|
|
259
261
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
260
262
|
return self.perform_request( # type: ignore[return-value]
|
|
261
263
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
262
264
|
)
|
|
263
265
|
|
|
264
266
|
@_rewrite_parameters(
|
|
265
|
-
body_fields=
|
|
267
|
+
body_fields=("synonyms",),
|
|
266
268
|
)
|
|
267
269
|
def put_synonym_rule(
|
|
268
270
|
self,
|
|
269
271
|
*,
|
|
270
272
|
set_id: str,
|
|
271
273
|
rule_id: str,
|
|
272
|
-
synonyms: t.Sequence[str],
|
|
274
|
+
synonyms: t.Optional[t.Sequence[str]] = None,
|
|
273
275
|
error_trace: t.Optional[bool] = None,
|
|
274
276
|
filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
|
|
275
277
|
human: t.Optional[bool] = None,
|
|
276
278
|
pretty: t.Optional[bool] = None,
|
|
279
|
+
body: t.Optional[t.Dict[str, t.Any]] = None,
|
|
277
280
|
) -> ObjectApiResponse[t.Any]:
|
|
278
281
|
"""
|
|
279
282
|
Creates or updates a synonym rule in a synonym set
|
|
280
283
|
|
|
281
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
284
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/put-synonym-rule.html>`_
|
|
282
285
|
|
|
283
286
|
:param set_id: The id of the synonym set to be updated with the synonym rule
|
|
284
287
|
:param rule_id: The id of the synonym rule to be updated or created
|
|
@@ -288,13 +291,11 @@ class SynonymsClient(NamespacedClient):
|
|
|
288
291
|
raise ValueError("Empty value passed for parameter 'set_id'")
|
|
289
292
|
if rule_id in SKIP_IN_PATH:
|
|
290
293
|
raise ValueError("Empty value passed for parameter 'rule_id'")
|
|
291
|
-
if synonyms is None:
|
|
294
|
+
if synonyms is None and body is None:
|
|
292
295
|
raise ValueError("Empty value passed for parameter 'synonyms'")
|
|
293
296
|
__path = f"/_synonyms/{_quote(set_id)}/{_quote(rule_id)}"
|
|
294
|
-
__body: t.Dict[str, t.Any] = {}
|
|
295
297
|
__query: t.Dict[str, t.Any] = {}
|
|
296
|
-
if
|
|
297
|
-
__body["synonyms"] = synonyms
|
|
298
|
+
__body: t.Dict[str, t.Any] = body if body is not None else {}
|
|
298
299
|
if error_trace is not None:
|
|
299
300
|
__query["error_trace"] = error_trace
|
|
300
301
|
if filter_path is not None:
|
|
@@ -303,6 +304,9 @@ class SynonymsClient(NamespacedClient):
|
|
|
303
304
|
__query["human"] = human
|
|
304
305
|
if pretty is not None:
|
|
305
306
|
__query["pretty"] = pretty
|
|
307
|
+
if not __body:
|
|
308
|
+
if synonyms is not None:
|
|
309
|
+
__body["synonyms"] = synonyms
|
|
306
310
|
__headers = {"accept": "application/json", "content-type": "application/json"}
|
|
307
311
|
return self.perform_request( # type: ignore[return-value]
|
|
308
312
|
"PUT", __path, params=__query, headers=__headers, body=__body
|
|
@@ -41,7 +41,7 @@ class TasksClient(NamespacedClient):
|
|
|
41
41
|
"""
|
|
42
42
|
Cancels a task, if it can be cancelled through an API.
|
|
43
43
|
|
|
44
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
44
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/tasks.html>`_
|
|
45
45
|
|
|
46
46
|
:param task_id: ID of the task.
|
|
47
47
|
:param actions: Comma-separated list or wildcard expression of actions used to
|
|
@@ -92,7 +92,7 @@ class TasksClient(NamespacedClient):
|
|
|
92
92
|
"""
|
|
93
93
|
Returns information about a task.
|
|
94
94
|
|
|
95
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
95
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/tasks.html>`_
|
|
96
96
|
|
|
97
97
|
:param task_id: ID of the task.
|
|
98
98
|
:param timeout: Period to wait for a response. If no response is received before
|
|
@@ -145,7 +145,7 @@ class TasksClient(NamespacedClient):
|
|
|
145
145
|
"""
|
|
146
146
|
Returns a list of tasks.
|
|
147
147
|
|
|
148
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
148
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/tasks.html>`_
|
|
149
149
|
|
|
150
150
|
:param actions: Comma-separated list or wildcard expression of actions used to
|
|
151
151
|
limit the request.
|
|
@@ -30,7 +30,8 @@ class TextStructureClient(NamespacedClient):
|
|
|
30
30
|
def find_structure(
|
|
31
31
|
self,
|
|
32
32
|
*,
|
|
33
|
-
text_files: t.Sequence[t.Any],
|
|
33
|
+
text_files: t.Optional[t.Sequence[t.Any]] = None,
|
|
34
|
+
body: t.Optional[t.Sequence[t.Any]] = None,
|
|
34
35
|
charset: t.Optional[str] = None,
|
|
35
36
|
column_names: t.Optional[str] = None,
|
|
36
37
|
delimiter: t.Optional[str] = None,
|
|
@@ -50,7 +51,7 @@ class TextStructureClient(NamespacedClient):
|
|
|
50
51
|
Finds the structure of a text file. The text file must contain data that is suitable
|
|
51
52
|
to be ingested into Elasticsearch.
|
|
52
53
|
|
|
53
|
-
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.
|
|
54
|
+
`<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/find-structure.html>`_
|
|
54
55
|
|
|
55
56
|
:param text_files:
|
|
56
57
|
:param charset: The text’s character set. It must be a character set that is
|
|
@@ -116,8 +117,12 @@ class TextStructureClient(NamespacedClient):
|
|
|
116
117
|
the file
|
|
117
118
|
:param timestamp_format: The Java time format of the timestamp field in the text.
|
|
118
119
|
"""
|
|
119
|
-
if text_files is None:
|
|
120
|
-
raise ValueError(
|
|
120
|
+
if text_files is None and body is None:
|
|
121
|
+
raise ValueError(
|
|
122
|
+
"Empty value passed for parameters 'text_files' and 'body', one of them should be set."
|
|
123
|
+
)
|
|
124
|
+
elif text_files is not None and body is not None:
|
|
125
|
+
raise ValueError("Cannot set both 'text_files' and 'body'")
|
|
121
126
|
__path = "/_text_structure/find_structure"
|
|
122
127
|
__query: t.Dict[str, t.Any] = {}
|
|
123
128
|
if charset is not None:
|
|
@@ -148,7 +153,7 @@ class TextStructureClient(NamespacedClient):
|
|
|
148
153
|
__query["timestamp_field"] = timestamp_field
|
|
149
154
|
if timestamp_format is not None:
|
|
150
155
|
__query["timestamp_format"] = timestamp_format
|
|
151
|
-
__body = text_files
|
|
156
|
+
__body = text_files if text_files is not None else body
|
|
152
157
|
__headers = {
|
|
153
158
|
"accept": "application/json",
|
|
154
159
|
"content-type": "application/x-ndjson",
|