elasticsearch 9.1.0__py3-none-any.whl → 9.1.2__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 (54) hide show
  1. elasticsearch/_async/client/__init__.py +21 -6
  2. elasticsearch/_async/client/cat.py +1091 -51
  3. elasticsearch/_async/client/cluster.py +7 -2
  4. elasticsearch/_async/client/connector.py +3 -3
  5. elasticsearch/_async/client/esql.py +20 -6
  6. elasticsearch/_async/client/indices.py +27 -13
  7. elasticsearch/_async/client/inference.py +16 -5
  8. elasticsearch/_async/client/logstash.py +3 -1
  9. elasticsearch/_async/client/nodes.py +2 -2
  10. elasticsearch/_async/client/shutdown.py +5 -15
  11. elasticsearch/_async/client/sql.py +1 -1
  12. elasticsearch/_async/client/streams.py +186 -0
  13. elasticsearch/_async/client/transform.py +60 -0
  14. elasticsearch/_async/client/watcher.py +1 -5
  15. elasticsearch/_async/helpers.py +58 -9
  16. elasticsearch/_sync/client/__init__.py +21 -6
  17. elasticsearch/_sync/client/cat.py +1091 -51
  18. elasticsearch/_sync/client/cluster.py +7 -2
  19. elasticsearch/_sync/client/connector.py +3 -3
  20. elasticsearch/_sync/client/esql.py +20 -6
  21. elasticsearch/_sync/client/indices.py +27 -13
  22. elasticsearch/_sync/client/inference.py +16 -5
  23. elasticsearch/_sync/client/logstash.py +3 -1
  24. elasticsearch/_sync/client/nodes.py +2 -2
  25. elasticsearch/_sync/client/shutdown.py +5 -15
  26. elasticsearch/_sync/client/sql.py +1 -1
  27. elasticsearch/_sync/client/streams.py +186 -0
  28. elasticsearch/_sync/client/transform.py +60 -0
  29. elasticsearch/_sync/client/watcher.py +1 -5
  30. elasticsearch/_version.py +2 -1
  31. elasticsearch/client.py +2 -0
  32. elasticsearch/compat.py +43 -1
  33. elasticsearch/dsl/__init__.py +28 -0
  34. elasticsearch/dsl/_async/document.py +84 -0
  35. elasticsearch/dsl/_sync/document.py +84 -0
  36. elasticsearch/dsl/aggs.py +97 -0
  37. elasticsearch/dsl/document_base.py +57 -0
  38. elasticsearch/dsl/field.py +43 -11
  39. elasticsearch/dsl/query.py +5 -1
  40. elasticsearch/dsl/response/__init__.py +3 -0
  41. elasticsearch/dsl/response/aggs.py +1 -1
  42. elasticsearch/dsl/types.py +273 -24
  43. elasticsearch/dsl/utils.py +1 -1
  44. elasticsearch/esql/__init__.py +2 -1
  45. elasticsearch/esql/esql.py +85 -34
  46. elasticsearch/esql/functions.py +37 -25
  47. elasticsearch/helpers/__init__.py +10 -1
  48. elasticsearch/helpers/actions.py +106 -33
  49. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/METADATA +2 -4
  50. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/RECORD +53 -52
  51. elasticsearch/esql/esql1.py1 +0 -307
  52. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/WHEEL +0 -0
  53. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/licenses/LICENSE +0 -0
  54. {elasticsearch-9.1.0.dist-info → elasticsearch-9.1.2.dist-info}/licenses/NOTICE +0 -0
@@ -374,8 +374,13 @@ class ClusterClient(NamespacedClient):
374
374
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-get-settings>`_
375
375
 
376
376
  :param flat_settings: If `true`, returns settings in flat format.
377
- :param include_defaults: If `true`, returns default cluster settings from the
378
- local node.
377
+ :param include_defaults: If `true`, also returns default values for all other
378
+ cluster settings, reflecting the values in the `elasticsearch.yml` file of
379
+ one of the nodes in the cluster. If the nodes in your cluster do not all
380
+ have the same values in their `elasticsearch.yml` config files then the values
381
+ returned by this API may vary from invocation to invocation and may not reflect
382
+ the values that Elasticsearch uses in all situations. Use the `GET _nodes/settings`
383
+ API to fetch the settings for each individual node in your cluster.
379
384
  :param master_timeout: Period to wait for a connection to the master node. If
380
385
  no response is received before the timeout expires, the request fails and
381
386
  returns an error.
@@ -103,7 +103,7 @@ class ConnectorClient(NamespacedClient):
103
103
 
104
104
  :param connector_id: The unique identifier of the connector to be deleted
105
105
  :param delete_sync_jobs: A flag indicating if associated sync jobs should be
106
- also removed. Defaults to false.
106
+ also removed.
107
107
  :param hard: A flag indicating if the connector should be hard deleted.
108
108
  """
109
109
  if connector_id in SKIP_IN_PATH:
@@ -360,7 +360,7 @@ class ConnectorClient(NamespacedClient):
360
360
 
361
361
  :param connector_name: A comma-separated list of connector names to fetch connector
362
362
  documents for
363
- :param from_: Starting offset (default: 0)
363
+ :param from_: Starting offset
364
364
  :param include_deleted: A flag to indicate if the desired connector should be
365
365
  fetched, even if it was soft-deleted.
366
366
  :param index_name: A comma-separated list of connector index names to fetch connector
@@ -955,7 +955,7 @@ class ConnectorClient(NamespacedClient):
955
955
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-connector-sync-job-list>`_
956
956
 
957
957
  :param connector_id: A connector id to fetch connector sync jobs for
958
- :param from_: Starting offset (default: 0)
958
+ :param from_: Starting offset
959
959
  :param job_type: A comma-separated list of job types to fetch the sync jobs for
960
960
  :param size: Specifies a max number of results to get
961
961
  :param status: A sync job status to fetch connector sync jobs for
@@ -28,6 +28,9 @@ from .utils import (
28
28
  _stability_warning,
29
29
  )
30
30
 
31
+ if t.TYPE_CHECKING:
32
+ from elasticsearch.esql import ESQLBase
33
+
31
34
 
32
35
  class EsqlClient(NamespacedClient):
33
36
 
@@ -50,7 +53,7 @@ class EsqlClient(NamespacedClient):
50
53
  def async_query(
51
54
  self,
52
55
  *,
53
- query: t.Optional[str] = None,
56
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
54
57
  allow_partial_results: t.Optional[bool] = None,
55
58
  columnar: t.Optional[bool] = None,
56
59
  delimiter: t.Optional[str] = None,
@@ -111,7 +114,12 @@ class EsqlClient(NamespacedClient):
111
114
  which has the name of all the columns.
112
115
  :param filter: Specify a Query DSL query in the filter parameter to filter the
113
116
  set of documents that an ES|QL query runs on.
114
- :param format: A short version of the Accept header, for example `json` or `yaml`.
117
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
118
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
119
+ other metadata fields from the response. For async requests, nothing will
120
+ be returned if the async query doesn't finish within the timeout. The query
121
+ ID and running status are available in the `X-Elasticsearch-Async-Id` and
122
+ `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
115
123
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
116
124
  query, the response will include an extra `_clusters` object with information
117
125
  about the clusters that participated in the search along with info such as
@@ -165,7 +173,7 @@ class EsqlClient(NamespacedClient):
165
173
  __query["pretty"] = pretty
166
174
  if not __body:
167
175
  if query is not None:
168
- __body["query"] = query
176
+ __body["query"] = str(query)
169
177
  if columnar is not None:
170
178
  __body["columnar"] = columnar
171
179
  if filter is not None:
@@ -405,6 +413,8 @@ class EsqlClient(NamespacedClient):
405
413
  Returns an object extended information about a running ES|QL query.</p>
406
414
 
407
415
 
416
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-get-query>`_
417
+
408
418
  :param id: The query ID
409
419
  """
410
420
  if id in SKIP_IN_PATH:
@@ -446,6 +456,8 @@ class EsqlClient(NamespacedClient):
446
456
  <p>Get running ES|QL queries information.
447
457
  Returns an object containing IDs and other information about the running ES|QL queries.</p>
448
458
 
459
+
460
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-esql-list-queries>`_
449
461
  """
450
462
  __path_parts: t.Dict[str, str] = {}
451
463
  __path = "/_query/queries"
@@ -484,7 +496,7 @@ class EsqlClient(NamespacedClient):
484
496
  def query(
485
497
  self,
486
498
  *,
487
- query: t.Optional[str] = None,
499
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
488
500
  allow_partial_results: t.Optional[bool] = None,
489
501
  columnar: t.Optional[bool] = None,
490
502
  delimiter: t.Optional[str] = None,
@@ -539,7 +551,9 @@ class EsqlClient(NamespacedClient):
539
551
  `all_columns` which has the name of all columns.
540
552
  :param filter: Specify a Query DSL query in the filter parameter to filter the
541
553
  set of documents that an ES|QL query runs on.
542
- :param format: A short version of the Accept header, e.g. json, yaml.
554
+ :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
555
+ `tsv`, and `txt` formats will return results in a tabular format, excluding
556
+ other metadata fields from the response.
543
557
  :param include_ccs_metadata: When set to `true` and performing a cross-cluster
544
558
  query, the response will include an extra `_clusters` object with information
545
559
  about the clusters that participated in the search along with info such as
@@ -579,7 +593,7 @@ class EsqlClient(NamespacedClient):
579
593
  __query["pretty"] = pretty
580
594
  if not __body:
581
595
  if query is not None:
582
- __body["query"] = query
596
+ __body["query"] = str(query)
583
597
  if columnar is not None:
584
598
  __body["columnar"] = columnar
585
599
  if filter is not None:
@@ -812,11 +812,7 @@ class IndicesClient(NamespacedClient):
812
812
  raise ValueError("Empty value passed for parameter 'source'")
813
813
  if dest in SKIP_IN_PATH:
814
814
  raise ValueError("Empty value passed for parameter 'dest'")
815
- if create_from is None and body is None:
816
- raise ValueError(
817
- "Empty value passed for parameters 'create_from' and 'body', one of them should be set."
818
- )
819
- elif create_from is not None and body is not None:
815
+ if create_from is not None and body is not None:
820
816
  raise ValueError("Cannot set both 'create_from' and 'body'")
821
817
  __path_parts: t.Dict[str, str] = {
822
818
  "source": _quote(source),
@@ -833,7 +829,11 @@ class IndicesClient(NamespacedClient):
833
829
  if pretty is not None:
834
830
  __query["pretty"] = pretty
835
831
  __body = create_from if create_from is not None else body
836
- __headers = {"accept": "application/json", "content-type": "application/json"}
832
+ if not __body:
833
+ __body = None
834
+ __headers = {"accept": "application/json"}
835
+ if __body is not None:
836
+ __headers["content-type"] = "application/json"
837
837
  return self.perform_request( # type: ignore[return-value]
838
838
  "PUT",
839
839
  __path,
@@ -1208,7 +1208,7 @@ class IndicesClient(NamespacedClient):
1208
1208
  Removes the data stream options from a data stream.</p>
1209
1209
 
1210
1210
 
1211
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
1211
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-delete-data-stream-options>`_
1212
1212
 
1213
1213
  :param name: A comma-separated list of data streams of which the data stream
1214
1214
  options will be deleted; use `*` to get all data streams
@@ -2568,7 +2568,7 @@ class IndicesClient(NamespacedClient):
2568
2568
  <p>Get the data stream options configuration of one or more data streams.</p>
2569
2569
 
2570
2570
 
2571
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
2571
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-options>`_
2572
2572
 
2573
2573
  :param name: Comma-separated list of data streams to limit the request. Supports
2574
2574
  wildcards (`*`). To target all data streams, omit this parameter or use `*`
@@ -3684,7 +3684,7 @@ class IndicesClient(NamespacedClient):
3684
3684
  Update the data stream options of the specified data streams.</p>
3685
3685
 
3686
3686
 
3687
- `<https://www.elastic.co/guide/en/elasticsearch/reference/9.1/index.html>`_
3687
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-options>`_
3688
3688
 
3689
3689
  :param name: Comma-separated list of data streams used to limit the request.
3690
3690
  Supports wildcards (`*`). To target all data streams use `*` or `_all`.
@@ -4051,7 +4051,7 @@ class IndicesClient(NamespacedClient):
4051
4051
  <li>Change a field's mapping using reindexing</li>
4052
4052
  <li>Rename a field using a field alias</li>
4053
4053
  </ul>
4054
- <p>Learn how to use the update mapping API with practical examples in the <a href="https://www.elastic.co/docs//manage-data/data-store/mapping/update-mappings-examples">Update mapping API examples</a> guide.</p>
4054
+ <p>Learn how to use the update mapping API with practical examples in the <a href="https://www.elastic.co/docs/manage-data/data-store/mapping/update-mappings-examples">Update mapping API examples</a> guide.</p>
4055
4055
 
4056
4056
 
4057
4057
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-mapping>`_
@@ -4549,6 +4549,7 @@ class IndicesClient(NamespacedClient):
4549
4549
  For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
4550
4550
  <p>By default, Elasticsearch periodically refreshes indices every second, but only on indices that have received one search request or more in the last 30 seconds.
4551
4551
  You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4552
+ <p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
4552
4553
  <p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
4553
4554
  <p>Refreshes are resource-intensive.
4554
4555
  To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -5414,7 +5415,9 @@ class IndicesClient(NamespacedClient):
5414
5415
  path_parts=__path_parts,
5415
5416
  )
5416
5417
 
5417
- @_rewrite_parameters()
5418
+ @_rewrite_parameters(
5419
+ body_name="index_template",
5420
+ )
5418
5421
  def simulate_index_template(
5419
5422
  self,
5420
5423
  *,
@@ -5425,6 +5428,8 @@ class IndicesClient(NamespacedClient):
5425
5428
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5426
5429
  human: t.Optional[bool] = None,
5427
5430
  include_defaults: t.Optional[bool] = None,
5431
+ index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5432
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
5428
5433
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
5429
5434
  pretty: t.Optional[bool] = None,
5430
5435
  ) -> ObjectApiResponse[t.Any]:
@@ -5444,12 +5449,15 @@ class IndicesClient(NamespacedClient):
5444
5449
  only be dry-run added if new or can also replace an existing one
5445
5450
  :param include_defaults: If true, returns all relevant default configurations
5446
5451
  for the index template.
5452
+ :param index_template:
5447
5453
  :param master_timeout: Period to wait for a connection to the master node. If
5448
5454
  no response is received before the timeout expires, the request fails and
5449
5455
  returns an error.
5450
5456
  """
5451
5457
  if name in SKIP_IN_PATH:
5452
5458
  raise ValueError("Empty value passed for parameter 'name'")
5459
+ if index_template is not None and body is not None:
5460
+ raise ValueError("Cannot set both 'index_template' and 'body'")
5453
5461
  __path_parts: t.Dict[str, str] = {"name": _quote(name)}
5454
5462
  __path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
5455
5463
  __query: t.Dict[str, t.Any] = {}
@@ -5469,12 +5477,18 @@ class IndicesClient(NamespacedClient):
5469
5477
  __query["master_timeout"] = master_timeout
5470
5478
  if pretty is not None:
5471
5479
  __query["pretty"] = pretty
5480
+ __body = index_template if index_template is not None else body
5481
+ if not __body:
5482
+ __body = None
5472
5483
  __headers = {"accept": "application/json"}
5484
+ if __body is not None:
5485
+ __headers["content-type"] = "application/json"
5473
5486
  return self.perform_request( # type: ignore[return-value]
5474
5487
  "POST",
5475
5488
  __path,
5476
5489
  params=__query,
5477
5490
  headers=__headers,
5491
+ body=__body,
5478
5492
  endpoint_id="indices.simulate_index_template",
5479
5493
  path_parts=__path_parts,
5480
5494
  )
@@ -5823,8 +5837,8 @@ class IndicesClient(NamespacedClient):
5823
5837
  are requested).
5824
5838
  :param include_unloaded_segments: If true, the response includes information
5825
5839
  from segments that are not loaded into memory.
5826
- :param level: Indicates whether statistics are aggregated at the cluster, index,
5827
- or shard level.
5840
+ :param level: Indicates whether statistics are aggregated at the cluster, indices,
5841
+ or shards level.
5828
5842
  """
5829
5843
  __path_parts: t.Dict[str, str]
5830
5844
  if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH:
@@ -396,17 +396,18 @@ class InferenceClient(NamespacedClient):
396
396
  <li>Azure AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
397
397
  <li>Azure OpenAI (<code>completion</code>, <code>text_embedding</code>)</li>
398
398
  <li>Cohere (<code>completion</code>, <code>rerank</code>, <code>text_embedding</code>)</li>
399
- <li>DeepSeek (<code>completion</code>, <code>chat_completion</code>)</li>
399
+ <li>DeepSeek (<code>chat_completion</code>, <code>completion</code>)</li>
400
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>
401
401
  <li>ELSER (<code>sparse_embedding</code>)</li>
402
402
  <li>Google AI Studio (<code>completion</code>, <code>text_embedding</code>)</li>
403
- <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>
404
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>
405
407
  <li>Mistral (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
406
408
  <li>OpenAI (<code>chat_completion</code>, <code>completion</code>, <code>text_embedding</code>)</li>
407
- <li>VoyageAI (<code>text_embedding</code>, <code>rerank</code>)</li>
409
+ <li>VoyageAI (<code>rerank</code>, <code>text_embedding</code>)</li>
408
410
  <li>Watsonx inference integration (<code>text_embedding</code>)</li>
409
- <li>JinaAI (<code>text_embedding</code>, <code>rerank</code>)</li>
410
411
  </ul>
411
412
 
412
413
 
@@ -2503,7 +2504,7 @@ class InferenceClient(NamespacedClient):
2503
2504
  )
2504
2505
 
2505
2506
  @_rewrite_parameters(
2506
- body_fields=("input", "task_settings"),
2507
+ body_fields=("input", "input_type", "task_settings"),
2507
2508
  )
2508
2509
  def text_embedding(
2509
2510
  self,
@@ -2513,6 +2514,7 @@ class InferenceClient(NamespacedClient):
2513
2514
  error_trace: t.Optional[bool] = None,
2514
2515
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2515
2516
  human: t.Optional[bool] = None,
2517
+ input_type: t.Optional[str] = None,
2516
2518
  pretty: t.Optional[bool] = None,
2517
2519
  task_settings: t.Optional[t.Any] = None,
2518
2520
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -2528,6 +2530,13 @@ class InferenceClient(NamespacedClient):
2528
2530
 
2529
2531
  :param inference_id: The inference Id
2530
2532
  :param input: Inference input. Either a string or an array of strings.
2533
+ :param input_type: The input data type for the text embedding model. Possible
2534
+ values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not
2535
+ all services support all values. Unsupported values will trigger a validation
2536
+ exception. Accepted values depend on the configured inference service, refer
2537
+ to the relevant service-specific documentation for more info. > info > The
2538
+ `input_type` parameter specified on the root level of the request body will
2539
+ take precedence over the `input_type` parameter specified in `task_settings`.
2531
2540
  :param task_settings: Optional task settings
2532
2541
  :param timeout: Specifies the amount of time to wait for the inference request
2533
2542
  to complete.
@@ -2553,6 +2562,8 @@ class InferenceClient(NamespacedClient):
2553
2562
  if not __body:
2554
2563
  if input is not None:
2555
2564
  __body["input"] = input
2565
+ if input_type is not None:
2566
+ __body["input_type"] = input_type
2556
2567
  if task_settings is not None:
2557
2568
  __body["task_settings"] = task_settings
2558
2569
  if not __body:
@@ -141,7 +141,9 @@ class LogstashClient(NamespacedClient):
141
141
 
142
142
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-logstash-put-pipeline>`_
143
143
 
144
- :param id: An identifier for the pipeline.
144
+ :param id: An identifier for the pipeline. Pipeline IDs must begin with a letter
145
+ or underscore and contain only letters, underscores, dashes, hyphens and
146
+ numbers.
145
147
  :param pipeline:
146
148
  """
147
149
  if id in SKIP_IN_PATH:
@@ -404,8 +404,8 @@ class NodesClient(NamespacedClient):
404
404
  are requested).
405
405
  :param include_unloaded_segments: If `true`, the response includes information
406
406
  from segments that are not loaded into memory.
407
- :param level: Indicates whether statistics are aggregated at the cluster, index,
408
- or shard level.
407
+ :param level: Indicates whether statistics are aggregated at the node, indices,
408
+ or shards level.
409
409
  :param timeout: Period to wait for a response. If no response is received before
410
410
  the timeout expires, the request fails and returns an error.
411
411
  :param types: A comma-separated list of document types for the indexing index
@@ -33,13 +33,9 @@ class ShutdownClient(NamespacedClient):
33
33
  error_trace: t.Optional[bool] = None,
34
34
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
35
35
  human: t.Optional[bool] = None,
36
- master_timeout: t.Optional[
37
- t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
38
- ] = None,
36
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
39
37
  pretty: t.Optional[bool] = None,
40
- timeout: t.Optional[
41
- t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
42
- ] = None,
38
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
43
39
  ) -> ObjectApiResponse[t.Any]:
44
40
  """
45
41
  .. raw:: html
@@ -97,9 +93,7 @@ class ShutdownClient(NamespacedClient):
97
93
  error_trace: t.Optional[bool] = None,
98
94
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
99
95
  human: t.Optional[bool] = None,
100
- master_timeout: t.Optional[
101
- t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
102
- ] = None,
96
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
103
97
  pretty: t.Optional[bool] = None,
104
98
  ) -> ObjectApiResponse[t.Any]:
105
99
  """
@@ -162,14 +156,10 @@ class ShutdownClient(NamespacedClient):
162
156
  error_trace: t.Optional[bool] = None,
163
157
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
164
158
  human: t.Optional[bool] = None,
165
- master_timeout: t.Optional[
166
- t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
167
- ] = None,
159
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
168
160
  pretty: t.Optional[bool] = None,
169
161
  target_node_name: t.Optional[str] = None,
170
- timeout: t.Optional[
171
- t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
172
- ] = None,
162
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
173
163
  body: t.Optional[t.Dict[str, t.Any]] = None,
174
164
  ) -> ObjectApiResponse[t.Any]:
175
165
  """
@@ -283,7 +283,7 @@ class SqlClient(NamespacedClient):
283
283
  keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
284
284
  keep_on_completion: t.Optional[bool] = None,
285
285
  page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
286
- params: t.Optional[t.Mapping[str, t.Any]] = None,
286
+ params: t.Optional[t.Sequence[t.Any]] = None,
287
287
  pretty: t.Optional[bool] = None,
288
288
  query: t.Optional[str] = None,
289
289
  request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -0,0 +1,186 @@
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, TextApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import (
24
+ Stability,
25
+ _rewrite_parameters,
26
+ _stability_warning,
27
+ )
28
+
29
+
30
+ class StreamsClient(NamespacedClient):
31
+
32
+ @_rewrite_parameters()
33
+ @_stability_warning(Stability.EXPERIMENTAL)
34
+ def logs_disable(
35
+ self,
36
+ *,
37
+ error_trace: t.Optional[bool] = None,
38
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
39
+ human: t.Optional[bool] = None,
40
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
41
+ pretty: t.Optional[bool] = None,
42
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
43
+ ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
44
+ """
45
+ .. raw:: html
46
+
47
+ <p>Disable logs stream.</p>
48
+ <p>Turn off the logs stream feature for this cluster.</p>
49
+
50
+
51
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
52
+
53
+ :param master_timeout: The period to wait for a connection to the master node.
54
+ If no response is received before the timeout expires, the request fails
55
+ and returns an error.
56
+ :param timeout: The period to wait for a response. If no response is received
57
+ before the timeout expires, the request fails and returns an error.
58
+ """
59
+ __path_parts: t.Dict[str, str] = {}
60
+ __path = "/_streams/logs/_disable"
61
+ __query: t.Dict[str, t.Any] = {}
62
+ if error_trace is not None:
63
+ __query["error_trace"] = error_trace
64
+ if filter_path is not None:
65
+ __query["filter_path"] = filter_path
66
+ if human is not None:
67
+ __query["human"] = human
68
+ if master_timeout is not None:
69
+ __query["master_timeout"] = master_timeout
70
+ if pretty is not None:
71
+ __query["pretty"] = pretty
72
+ if timeout is not None:
73
+ __query["timeout"] = timeout
74
+ __headers = {"accept": "application/json,text/plain"}
75
+ return self.perform_request( # type: ignore[return-value]
76
+ "POST",
77
+ __path,
78
+ params=__query,
79
+ headers=__headers,
80
+ endpoint_id="streams.logs_disable",
81
+ path_parts=__path_parts,
82
+ )
83
+
84
+ @_rewrite_parameters()
85
+ @_stability_warning(Stability.EXPERIMENTAL)
86
+ def logs_enable(
87
+ self,
88
+ *,
89
+ error_trace: t.Optional[bool] = None,
90
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
91
+ human: t.Optional[bool] = None,
92
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
93
+ pretty: t.Optional[bool] = None,
94
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
95
+ ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
96
+ """
97
+ .. raw:: html
98
+
99
+ <p>Enable logs stream.</p>
100
+ <p>Turn on the logs stream feature for this cluster.</p>
101
+ <p>NOTE: To protect existing data, this feature can be turned on only if the
102
+ cluster does not have existing indices or data streams that match the pattern <code>logs|logs.*</code>.
103
+ If those indices or data streams exist, a <code>409 - Conflict</code> response and error is returned.</p>
104
+
105
+
106
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
107
+
108
+ :param master_timeout: The period to wait for a connection to the master node.
109
+ If no response is received before the timeout expires, the request fails
110
+ and returns an error.
111
+ :param timeout: The period to wait for a response. If no response is received
112
+ before the timeout expires, the request fails and returns an error.
113
+ """
114
+ __path_parts: t.Dict[str, str] = {}
115
+ __path = "/_streams/logs/_enable"
116
+ __query: t.Dict[str, t.Any] = {}
117
+ if error_trace is not None:
118
+ __query["error_trace"] = error_trace
119
+ if filter_path is not None:
120
+ __query["filter_path"] = filter_path
121
+ if human is not None:
122
+ __query["human"] = human
123
+ if master_timeout is not None:
124
+ __query["master_timeout"] = master_timeout
125
+ if pretty is not None:
126
+ __query["pretty"] = pretty
127
+ if timeout is not None:
128
+ __query["timeout"] = timeout
129
+ __headers = {"accept": "application/json,text/plain"}
130
+ return self.perform_request( # type: ignore[return-value]
131
+ "POST",
132
+ __path,
133
+ params=__query,
134
+ headers=__headers,
135
+ endpoint_id="streams.logs_enable",
136
+ path_parts=__path_parts,
137
+ )
138
+
139
+ @_rewrite_parameters()
140
+ @_stability_warning(Stability.EXPERIMENTAL)
141
+ def status(
142
+ self,
143
+ *,
144
+ error_trace: t.Optional[bool] = None,
145
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
146
+ human: t.Optional[bool] = None,
147
+ master_timeout: t.Optional[
148
+ t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
149
+ ] = None,
150
+ pretty: t.Optional[bool] = None,
151
+ ) -> ObjectApiResponse[t.Any]:
152
+ """
153
+ .. raw:: html
154
+
155
+ <p>Get the status of streams.</p>
156
+ <p>Get the current status for all types of streams.</p>
157
+
158
+
159
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
160
+
161
+ :param master_timeout: Period to wait for a connection to the master node. If
162
+ no response is received before the timeout expires, the request fails and
163
+ returns an error.
164
+ """
165
+ __path_parts: t.Dict[str, str] = {}
166
+ __path = "/_streams/status"
167
+ __query: t.Dict[str, t.Any] = {}
168
+ if error_trace is not None:
169
+ __query["error_trace"] = error_trace
170
+ if filter_path is not None:
171
+ __query["filter_path"] = filter_path
172
+ if human is not None:
173
+ __query["human"] = human
174
+ if master_timeout is not None:
175
+ __query["master_timeout"] = master_timeout
176
+ if pretty is not None:
177
+ __query["pretty"] = pretty
178
+ __headers = {"accept": "application/json"}
179
+ return self.perform_request( # type: ignore[return-value]
180
+ "GET",
181
+ __path,
182
+ params=__query,
183
+ headers=__headers,
184
+ endpoint_id="streams.status",
185
+ path_parts=__path_parts,
186
+ )
@@ -602,6 +602,66 @@ class TransformClient(NamespacedClient):
602
602
  path_parts=__path_parts,
603
603
  )
604
604
 
605
+ @_rewrite_parameters()
606
+ def set_upgrade_mode(
607
+ self,
608
+ *,
609
+ enabled: t.Optional[bool] = None,
610
+ error_trace: t.Optional[bool] = None,
611
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
612
+ human: t.Optional[bool] = None,
613
+ pretty: t.Optional[bool] = None,
614
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
615
+ ) -> ObjectApiResponse[t.Any]:
616
+ """
617
+ .. raw:: html
618
+
619
+ <p>Set upgrade_mode for transform indices.
620
+ Sets a cluster wide upgrade_mode setting that prepares transform
621
+ indices for an upgrade.
622
+ When upgrading your cluster, in some circumstances you must restart your
623
+ nodes and reindex your transform indices. In those circumstances,
624
+ there must be no transforms running. You can close the transforms,
625
+ do the upgrade, then open all the transforms again. Alternatively,
626
+ you can use this API to temporarily halt tasks associated with the transforms
627
+ and prevent new transforms from opening. You can also use this API
628
+ during upgrades that do not require you to reindex your transform
629
+ indices, though stopping transforms is not a requirement in that case.
630
+ You can see the current value for the upgrade_mode setting by using the get
631
+ transform info API.</p>
632
+
633
+
634
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-transform-set-upgrade-mode>`_
635
+
636
+ :param enabled: When `true`, it enables `upgrade_mode` which temporarily halts
637
+ all transform tasks and prohibits new transform tasks from starting.
638
+ :param timeout: The time to wait for the request to be completed.
639
+ """
640
+ __path_parts: t.Dict[str, str] = {}
641
+ __path = "/_transform/set_upgrade_mode"
642
+ __query: t.Dict[str, t.Any] = {}
643
+ if enabled is not None:
644
+ __query["enabled"] = enabled
645
+ if error_trace is not None:
646
+ __query["error_trace"] = error_trace
647
+ if filter_path is not None:
648
+ __query["filter_path"] = filter_path
649
+ if human is not None:
650
+ __query["human"] = human
651
+ if pretty is not None:
652
+ __query["pretty"] = pretty
653
+ if timeout is not None:
654
+ __query["timeout"] = timeout
655
+ __headers = {"accept": "application/json"}
656
+ return self.perform_request( # type: ignore[return-value]
657
+ "POST",
658
+ __path,
659
+ params=__query,
660
+ headers=__headers,
661
+ endpoint_id="transform.set_upgrade_mode",
662
+ path_parts=__path_parts,
663
+ )
664
+
605
665
  @_rewrite_parameters(
606
666
  parameter_aliases={"from": "from_"},
607
667
  )