elasticsearch 8.19.0__py3-none-any.whl → 8.19.1__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 (35) hide show
  1. elasticsearch/_async/client/__init__.py +12 -6
  2. elasticsearch/_async/client/cat.py +124 -10
  3. elasticsearch/_async/client/cluster.py +7 -2
  4. elasticsearch/_async/client/esql.py +16 -6
  5. elasticsearch/_async/client/indices.py +1 -1
  6. elasticsearch/_async/client/inference.py +112 -4
  7. elasticsearch/_async/client/snapshot.py +262 -112
  8. elasticsearch/_async/client/sql.py +1 -1
  9. elasticsearch/_async/client/transform.py +60 -0
  10. elasticsearch/_sync/client/__init__.py +12 -6
  11. elasticsearch/_sync/client/cat.py +124 -10
  12. elasticsearch/_sync/client/cluster.py +7 -2
  13. elasticsearch/_sync/client/esql.py +16 -6
  14. elasticsearch/_sync/client/indices.py +1 -1
  15. elasticsearch/_sync/client/inference.py +112 -4
  16. elasticsearch/_sync/client/snapshot.py +262 -112
  17. elasticsearch/_sync/client/sql.py +1 -1
  18. elasticsearch/_sync/client/transform.py +60 -0
  19. elasticsearch/_version.py +1 -1
  20. elasticsearch/dsl/_async/document.py +84 -0
  21. elasticsearch/dsl/_sync/document.py +84 -0
  22. elasticsearch/dsl/aggs.py +20 -0
  23. elasticsearch/dsl/document_base.py +43 -0
  24. elasticsearch/dsl/field.py +49 -10
  25. elasticsearch/dsl/response/aggs.py +1 -1
  26. elasticsearch/dsl/types.py +140 -11
  27. elasticsearch/dsl/utils.py +1 -1
  28. elasticsearch/esql/__init__.py +2 -1
  29. elasticsearch/esql/esql.py +85 -34
  30. elasticsearch/esql/functions.py +37 -25
  31. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.1.dist-info}/METADATA +1 -3
  32. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.1.dist-info}/RECORD +35 -35
  33. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.1.dist-info}/WHEEL +0 -0
  34. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.1.dist-info}/licenses/LICENSE +0 -0
  35. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.1.dist-info}/licenses/NOTICE +0 -0
@@ -698,6 +698,7 @@ class Elasticsearch(BaseClient):
698
698
  <li>JavaScript: Check out <code>client.helpers.*</code></li>
699
699
  <li>.NET: Check out <code>BulkAllObservable</code></li>
700
700
  <li>PHP: Check out bulk indexing.</li>
701
+ <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
701
702
  </ul>
702
703
  <p><strong>Submitting bulk requests with cURL</strong></p>
703
704
  <p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
@@ -1414,7 +1415,7 @@ class Elasticsearch(BaseClient):
1414
1415
  )
1415
1416
 
1416
1417
  @_rewrite_parameters(
1417
- body_fields=("max_docs", "query", "slice"),
1418
+ body_fields=("max_docs", "query", "slice", "sort"),
1418
1419
  parameter_aliases={"from": "from_"},
1419
1420
  )
1420
1421
  def delete_by_query(
@@ -1458,7 +1459,12 @@ class Elasticsearch(BaseClient):
1458
1459
  ] = None,
1459
1460
  slice: t.Optional[t.Mapping[str, t.Any]] = None,
1460
1461
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
1461
- sort: t.Optional[t.Sequence[str]] = None,
1462
+ sort: t.Optional[
1463
+ t.Union[
1464
+ t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
1465
+ t.Union[str, t.Mapping[str, t.Any]],
1466
+ ]
1467
+ ] = None,
1462
1468
  stats: t.Optional[t.Sequence[str]] = None,
1463
1469
  terminate_after: t.Optional[int] = None,
1464
1470
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1590,7 +1596,7 @@ class Elasticsearch(BaseClient):
1590
1596
  :param slice: Slice the request manually using the provided slice ID and total
1591
1597
  number of slices.
1592
1598
  :param slices: The number of slices this task should be divided into.
1593
- :param sort: A comma-separated list of `<field>:<direction>` pairs.
1599
+ :param sort: A sort object that specifies the order of deleted documents.
1594
1600
  :param stats: The specific `tag` of the request for logging and statistical purposes.
1595
1601
  :param terminate_after: The maximum number of documents to collect for each shard.
1596
1602
  If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1680,8 +1686,6 @@ class Elasticsearch(BaseClient):
1680
1686
  __query["search_type"] = search_type
1681
1687
  if slices is not None:
1682
1688
  __query["slices"] = slices
1683
- if sort is not None:
1684
- __query["sort"] = sort
1685
1689
  if stats is not None:
1686
1690
  __query["stats"] = stats
1687
1691
  if terminate_after is not None:
@@ -1701,6 +1705,8 @@ class Elasticsearch(BaseClient):
1701
1705
  __body["query"] = query
1702
1706
  if slice is not None:
1703
1707
  __body["slice"] = slice
1708
+ if sort is not None:
1709
+ __body["sort"] = sort
1704
1710
  __headers = {"accept": "application/json", "content-type": "application/json"}
1705
1711
  return self.perform_request( # type: ignore[return-value]
1706
1712
  "POST",
@@ -6008,7 +6014,7 @@ class Elasticsearch(BaseClient):
6008
6014
  doc: t.Optional[t.Mapping[str, t.Any]] = None,
6009
6015
  error_trace: t.Optional[bool] = None,
6010
6016
  field_statistics: t.Optional[bool] = None,
6011
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6017
+ fields: t.Optional[t.Sequence[str]] = None,
6012
6018
  filter: t.Optional[t.Mapping[str, t.Any]] = None,
6013
6019
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6014
6020
  human: t.Optional[bool] = None,
@@ -47,7 +47,34 @@ class CatClient(NamespacedClient):
47
47
  ] = None,
48
48
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
49
49
  format: t.Optional[str] = None,
50
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
50
+ h: t.Optional[
51
+ t.Union[
52
+ t.Sequence[
53
+ t.Union[
54
+ str,
55
+ t.Literal[
56
+ "alias",
57
+ "filter",
58
+ "index",
59
+ "is_write_index",
60
+ "routing.index",
61
+ "routing.search",
62
+ ],
63
+ ]
64
+ ],
65
+ t.Union[
66
+ str,
67
+ t.Literal[
68
+ "alias",
69
+ "filter",
70
+ "index",
71
+ "is_write_index",
72
+ "routing.index",
73
+ "routing.search",
74
+ ],
75
+ ],
76
+ ]
77
+ ] = None,
51
78
  help: t.Optional[bool] = None,
52
79
  human: t.Optional[bool] = None,
53
80
  local: t.Optional[bool] = None,
@@ -74,7 +101,8 @@ class CatClient(NamespacedClient):
74
101
  values, such as `open,hidden`.
75
102
  :param format: Specifies the format to return the columnar data in, can be set
76
103
  to `text`, `json`, `cbor`, `yaml`, or `smile`.
77
- :param h: List of columns to appear in the response. Supports simple wildcards.
104
+ :param h: A comma-separated list of columns names to display. It supports simple
105
+ wildcards.
78
106
  :param help: When set to `true` will output available columns. This option can't
79
107
  be combined with any other query string option.
80
108
  :param local: If `true`, the request computes the list of selected nodes from
@@ -137,7 +165,48 @@ class CatClient(NamespacedClient):
137
165
  error_trace: t.Optional[bool] = None,
138
166
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
139
167
  format: t.Optional[str] = None,
140
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
168
+ h: t.Optional[
169
+ t.Union[
170
+ t.Sequence[
171
+ t.Union[
172
+ str,
173
+ t.Literal[
174
+ "disk.avail",
175
+ "disk.indices",
176
+ "disk.indices.forecast",
177
+ "disk.percent",
178
+ "disk.total",
179
+ "disk.used",
180
+ "host",
181
+ "ip",
182
+ "node",
183
+ "node.role",
184
+ "shards",
185
+ "shards.undesired",
186
+ "write_load.forecast",
187
+ ],
188
+ ]
189
+ ],
190
+ t.Union[
191
+ str,
192
+ t.Literal[
193
+ "disk.avail",
194
+ "disk.indices",
195
+ "disk.indices.forecast",
196
+ "disk.percent",
197
+ "disk.total",
198
+ "disk.used",
199
+ "host",
200
+ "ip",
201
+ "node",
202
+ "node.role",
203
+ "shards",
204
+ "shards.undesired",
205
+ "write_load.forecast",
206
+ ],
207
+ ],
208
+ ]
209
+ ] = None,
141
210
  help: t.Optional[bool] = None,
142
211
  human: t.Optional[bool] = None,
143
212
  local: t.Optional[bool] = None,
@@ -161,7 +230,8 @@ class CatClient(NamespacedClient):
161
230
  :param bytes: The unit used to display byte values.
162
231
  :param format: Specifies the format to return the columnar data in, can be set
163
232
  to `text`, `json`, `cbor`, `yaml`, or `smile`.
164
- :param h: List of columns to appear in the response. Supports simple wildcards.
233
+ :param h: A comma-separated list of columns names to display. It supports simple
234
+ wildcards.
165
235
  :param help: When set to `true` will output available columns. This option can't
166
236
  be combined with any other query string option.
167
237
  :param local: If `true`, the request computes the list of selected nodes from
@@ -224,7 +294,36 @@ class CatClient(NamespacedClient):
224
294
  error_trace: t.Optional[bool] = None,
225
295
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
226
296
  format: t.Optional[str] = None,
227
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
297
+ h: t.Optional[
298
+ t.Union[
299
+ t.Sequence[
300
+ t.Union[
301
+ str,
302
+ t.Literal[
303
+ "alias_count",
304
+ "included_in",
305
+ "mapping_count",
306
+ "metadata_count",
307
+ "name",
308
+ "settings_count",
309
+ "version",
310
+ ],
311
+ ]
312
+ ],
313
+ t.Union[
314
+ str,
315
+ t.Literal[
316
+ "alias_count",
317
+ "included_in",
318
+ "mapping_count",
319
+ "metadata_count",
320
+ "name",
321
+ "settings_count",
322
+ "version",
323
+ ],
324
+ ],
325
+ ]
326
+ ] = None,
228
327
  help: t.Optional[bool] = None,
229
328
  human: t.Optional[bool] = None,
230
329
  local: t.Optional[bool] = None,
@@ -249,7 +348,8 @@ class CatClient(NamespacedClient):
249
348
  If it is omitted, all component templates are returned.
250
349
  :param format: Specifies the format to return the columnar data in, can be set
251
350
  to `text`, `json`, `cbor`, `yaml`, or `smile`.
252
- :param h: List of columns to appear in the response. Supports simple wildcards.
351
+ :param h: A comma-separated list of columns names to display. It supports simple
352
+ wildcards.
253
353
  :param help: When set to `true` will output available columns. This option can't
254
354
  be combined with any other query string option.
255
355
  :param local: If `true`, the request computes the list of selected nodes from
@@ -310,7 +410,12 @@ class CatClient(NamespacedClient):
310
410
  error_trace: t.Optional[bool] = None,
311
411
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
312
412
  format: t.Optional[str] = None,
313
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
413
+ h: t.Optional[
414
+ t.Union[
415
+ t.Sequence[t.Union[str, t.Literal["count", "epoch", "timestamp"]]],
416
+ t.Union[str, t.Literal["count", "epoch", "timestamp"]],
417
+ ]
418
+ ] = None,
314
419
  help: t.Optional[bool] = None,
315
420
  human: t.Optional[bool] = None,
316
421
  pretty: t.Optional[bool] = None,
@@ -334,7 +439,8 @@ class CatClient(NamespacedClient):
334
439
  and indices, omit this parameter or use `*` or `_all`.
335
440
  :param format: Specifies the format to return the columnar data in, can be set
336
441
  to `text`, `json`, `cbor`, `yaml`, or `smile`.
337
- :param h: List of columns to appear in the response. Supports simple wildcards.
442
+ :param h: A comma-separated list of columns names to display. It supports simple
443
+ wildcards.
338
444
  :param help: When set to `true` will output available columns. This option can't
339
445
  be combined with any other query string option.
340
446
  :param s: List of columns that determine how the table should be sorted. Sorting
@@ -389,7 +495,14 @@ class CatClient(NamespacedClient):
389
495
  error_trace: t.Optional[bool] = None,
390
496
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
391
497
  format: t.Optional[str] = None,
392
- h: t.Optional[t.Union[str, t.Sequence[str]]] = None,
498
+ h: t.Optional[
499
+ t.Union[
500
+ t.Sequence[
501
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]]
502
+ ],
503
+ t.Union[str, t.Literal["field", "host", "id", "ip", "node", "size"]],
504
+ ]
505
+ ] = None,
393
506
  help: t.Optional[bool] = None,
394
507
  human: t.Optional[bool] = None,
395
508
  pretty: t.Optional[bool] = None,
@@ -412,7 +525,8 @@ class CatClient(NamespacedClient):
412
525
  :param bytes: The unit used to display byte values.
413
526
  :param format: Specifies the format to return the columnar data in, can be set
414
527
  to `text`, `json`, `cbor`, `yaml`, or `smile`.
415
- :param h: List of columns to appear in the response. Supports simple wildcards.
528
+ :param h: A comma-separated list of columns names to display. It supports simple
529
+ wildcards.
416
530
  :param help: When set to `true` will output available columns. This option can't
417
531
  be combined with any other query string option.
418
532
  :param s: List of columns that determine how the table should be sorted. Sorting
@@ -373,8 +373,13 @@ class ClusterClient(NamespacedClient):
373
373
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/cluster-get-settings.html>`_
374
374
 
375
375
  :param flat_settings: If `true`, returns settings in flat format.
376
- :param include_defaults: If `true`, returns default cluster settings from the
377
- local node.
376
+ :param include_defaults: If `true`, also returns default values for all other
377
+ cluster settings, reflecting the values in the `elasticsearch.yml` file of
378
+ one of the nodes in the cluster. If the nodes in your cluster do not all
379
+ have the same values in their `elasticsearch.yml` config files then the values
380
+ returned by this API may vary from invocation to invocation and may not reflect
381
+ the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
382
+ API to fetch the settings for each individual node in your cluster.
378
383
  :param master_timeout: Period to wait for a connection to the master node. If
379
384
  no response is received before the timeout expires, the request fails and
380
385
  returns an error.
@@ -22,6 +22,9 @@ from elastic_transport import ObjectApiResponse
22
22
  from ._base import NamespacedClient
23
23
  from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
24
24
 
25
+ if t.TYPE_CHECKING:
26
+ from elasticsearch.esql import ESQLBase
27
+
25
28
 
26
29
  class EsqlClient(NamespacedClient):
27
30
 
@@ -44,7 +47,7 @@ class EsqlClient(NamespacedClient):
44
47
  def async_query(
45
48
  self,
46
49
  *,
47
- query: t.Optional[str] = None,
50
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
48
51
  allow_partial_results: t.Optional[bool] = None,
49
52
  columnar: t.Optional[bool] = None,
50
53
  delimiter: t.Optional[str] = None,
@@ -107,7 +110,12 @@ class EsqlClient(NamespacedClient):
107
110
  which has the name of all the columns.
108
111
  :param filter: Specify a Query DSL query in the filter parameter to filter the
109
112
  set of documents that an ES|QL query runs on.
110
- :param format: A short version of the Accept header, for example `json` or `yaml`.
113
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
114
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
115
+ other metadata fields from the response. For async requests, nothing will
116
+ be returned if the async query doesn't finish within the timeout. The query
117
+ ID and running status are available in the `X-Elasticsearch-Async-Id` and
118
+ `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
111
119
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
112
120
  query, the response will include an extra `_clusters` object with information
113
121
  about the clusters that participated in the search along with info such as
@@ -161,7 +169,7 @@ class EsqlClient(NamespacedClient):
161
169
  __query["pretty"] = pretty
162
170
  if not __body:
163
171
  if query is not None:
164
- __body["query"] = query
172
+ __body["query"] = str(query)
165
173
  if columnar is not None:
166
174
  __body["columnar"] = columnar
167
175
  if filter is not None:
@@ -399,7 +407,7 @@ class EsqlClient(NamespacedClient):
399
407
  def query(
400
408
  self,
401
409
  *,
402
- query: t.Optional[str] = None,
410
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
403
411
  allow_partial_results: t.Optional[bool] = None,
404
412
  columnar: t.Optional[bool] = None,
405
413
  delimiter: t.Optional[str] = None,
@@ -456,7 +464,9 @@ class EsqlClient(NamespacedClient):
456
464
  `all_columns` which has the name of all columns.
457
465
  :param filter: Specify a Query DSL query in the filter parameter to filter the
458
466
  set of documents that an ES|QL query runs on.
459
- :param format: A short version of the Accept header, e.g. json, yaml.
467
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
468
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
469
+ other metadata fields from the response.
460
470
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
461
471
  query, the response will include an extra `_clusters` object with information
462
472
  about the clusters that participated in the search along with info such as
@@ -496,7 +506,7 @@ class EsqlClient(NamespacedClient):
496
506
  __query["pretty"] = pretty
497
507
  if not __body:
498
508
  if query is not None:
499
- __body["query"] = query
509
+ __body["query"] = str(query)
500
510
  if columnar is not None:
501
511
  __body["columnar"] = columnar
502
512
  if filter is not None:
@@ -4581,7 +4581,7 @@ class IndicesClient(NamespacedClient):
4581
4581
  .. raw:: html
4582
4582
 
4583
4583
  <p>Roll over to a new index.
4584
- TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.</p>
4584
+ TIP: We recommend using the index lifecycle rollover action to automate rollovers. However, Serverless does not support Index Lifecycle Management (ILM), so don't use this approach in the Serverless context.</p>
4585
4585
  <p>The rollover API creates a new index for a data stream or index alias.
4586
4586
  The API behavior depends on the rollover target.</p>
4587
4587
  <p><strong>Roll over a data stream</strong></p>
@@ -391,21 +391,23 @@ class InferenceClient(NamespacedClient):
391
391
  <ul>
392
392
  <li>AlibabaCloud AI Search (<code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
393
393
  <li>Amazon Bedrock (<code>completion</code>, <code>text_embedding</code>)</li>
394
+ <li>Amazon SageMaker (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code>)</li>
394
395
  <li>Anthropic (<code>completion</code>)</li>
395
396
  <li>Azure AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
396
397
  <li>Azure OpenAI (<code>completion</code>, <code>text_embedding</code>)</li>
397
398
  <li>Cohere (<code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
398
- <li>DeepSeek (<code>completion</code>, <code>chat_completion</code>)</li>
399
+ <li>DeepSeek (<code>chat_completion</code>, <code>completion</code>)</li>
399
400
  <li>Elasticsearch (<code>rerank</code>, <code>sparse_embedding</code>, <code>text_embedding</code> - this service is for built-in models and models uploaded through Eland)</li>
400
401
  <li>ELSER (<code>sparse_embedding</code>)</li>
401
402
  <li>Google AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
402
- <li>Google Vertex AI (<code>rerank</code>, <code>text_embedding</code>)</li>
403
+ <li>Google Vertex AI (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
403
404
  <li>Hugging Face (<code>chat_completion</code>, <code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
405
+ <li>JinaAI (<code>rerank</code>, <code>text_embedding</code>)</li>
406
+ <li>Llama (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
404
407
  <li>Mistral (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
405
408
  <li>OpenAI (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
406
- <li>VoyageAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409
+ <li>VoyageAI (<code>rerank</code>, <code>text_embedding</code>)</li>
407
410
  <li>Watsonx inference integration (<code>text_embedding</code>)</li>
408
- <li>JinaAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409
411
  </ul>
410
412
 
411
413
 
@@ -659,6 +661,112 @@ class InferenceClient(NamespacedClient):
659
661
  path_parts=__path_parts,
660
662
  )
661
663
 
664
+ @_rewrite_parameters(
665
+ body_fields=(
666
+ "service",
667
+ "service_settings",
668
+ "chunking_settings",
669
+ "task_settings",
670
+ ),
671
+ )
672
+ def put_amazonsagemaker(
673
+ self,
674
+ *,
675
+ task_type: t.Union[
676
+ str,
677
+ t.Literal[
678
+ "chat_completion",
679
+ "completion",
680
+ "rerank",
681
+ "sparse_embedding",
682
+ "text_embedding",
683
+ ],
684
+ ],
685
+ amazonsagemaker_inference_id: str,
686
+ service: t.Optional[t.Union[str, t.Literal["amazon_sagemaker"]]] = None,
687
+ service_settings: t.Optional[t.Mapping[str, t.Any]] = None,
688
+ chunking_settings: t.Optional[t.Mapping[str, t.Any]] = None,
689
+ error_trace: t.Optional[bool] = None,
690
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
691
+ human: t.Optional[bool] = None,
692
+ pretty: t.Optional[bool] = None,
693
+ task_settings: t.Optional[t.Mapping[str, t.Any]] = None,
694
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
695
+ body: t.Optional[t.Dict[str, t.Any]] = None,
696
+ ) -> ObjectApiResponse[t.Any]:
697
+ """
698
+ .. raw:: html
699
+
700
+ <p>Create an Amazon SageMaker inference endpoint.</p>
701
+ <p>Create an inference endpoint to perform an inference task with the <code>amazon_sagemaker</code> service.</p>
702
+
703
+
704
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-inference-put-amazonsagemaker>`_
705
+
706
+ :param task_type: The type of the inference task that the model will perform.
707
+ :param amazonsagemaker_inference_id: The unique identifier of the inference endpoint.
708
+ :param service: The type of service supported for the specified task type. In
709
+ this case, `amazon_sagemaker`.
710
+ :param service_settings: Settings used to install the inference model. These
711
+ settings are specific to the `amazon_sagemaker` service and `service_settings.api`
712
+ you specified.
713
+ :param chunking_settings: The chunking configuration object.
714
+ :param task_settings: Settings to configure the inference task. These settings
715
+ are specific to the task type and `service_settings.api` you specified.
716
+ :param timeout: Specifies the amount of time to wait for the inference endpoint
717
+ to be created.
718
+ """
719
+ if task_type in SKIP_IN_PATH:
720
+ raise ValueError("Empty value passed for parameter 'task_type'")
721
+ if amazonsagemaker_inference_id in SKIP_IN_PATH:
722
+ raise ValueError(
723
+ "Empty value passed for parameter 'amazonsagemaker_inference_id'"
724
+ )
725
+ if service is None and body is None:
726
+ raise ValueError("Empty value passed for parameter 'service'")
727
+ if service_settings is None and body is None:
728
+ raise ValueError("Empty value passed for parameter 'service_settings'")
729
+ __path_parts: t.Dict[str, str] = {
730
+ "task_type": _quote(task_type),
731
+ "amazonsagemaker_inference_id": _quote(amazonsagemaker_inference_id),
732
+ }
733
+ __path = f'/_inference/{__path_parts["task_type"]}/{__path_parts["amazonsagemaker_inference_id"]}'
734
+ __query: t.Dict[str, t.Any] = {}
735
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
736
+ if error_trace is not None:
737
+ __query["error_trace"] = error_trace
738
+ if filter_path is not None:
739
+ __query["filter_path"] = filter_path
740
+ if human is not None:
741
+ __query["human"] = human
742
+ if pretty is not None:
743
+ __query["pretty"] = pretty
744
+ if timeout is not None:
745
+ __query["timeout"] = timeout
746
+ if not __body:
747
+ if service is not None:
748
+ __body["service"] = service
749
+ if service_settings is not None:
750
+ __body["service_settings"] = service_settings
751
+ if chunking_settings is not None:
752
+ __body["chunking_settings"] = chunking_settings
753
+ if task_settings is not None:
754
+ __body["task_settings"] = task_settings
755
+ if not __body:
756
+ __body = None # type: ignore[assignment]
757
+ __headers = {"accept": "application/json"}
758
+ if __body is not None:
759
+ __headers["content-type"] = "application/json"
760
+ return self.perform_request( # type: ignore[return-value]
761
+ "PUT",
762
+ __path,
763
+ params=__query,
764
+ headers=__headers,
765
+ body=__body,
766
+ endpoint_id="inference.put_amazonsagemaker",
767
+ path_parts=__path_parts,
768
+ )
769
+
662
770
  @_rewrite_parameters(
663
771
  body_fields=(
664
772
  "service",