elasticsearch 9.1.1__py3-none-any.whl → 9.2.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 (76) hide show
  1. elasticsearch/_async/client/__init__.py +96 -44
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/cat.py +489 -26
  4. elasticsearch/_async/client/cluster.py +9 -8
  5. elasticsearch/_async/client/connector.py +3 -3
  6. elasticsearch/_async/client/eql.py +7 -0
  7. elasticsearch/_async/client/esql.py +26 -3
  8. elasticsearch/_async/client/fleet.py +1 -5
  9. elasticsearch/_async/client/graph.py +1 -5
  10. elasticsearch/_async/client/ilm.py +2 -10
  11. elasticsearch/_async/client/indices.py +181 -37
  12. elasticsearch/_async/client/inference.py +291 -124
  13. elasticsearch/_async/client/ingest.py +8 -0
  14. elasticsearch/_async/client/license.py +4 -2
  15. elasticsearch/_async/client/logstash.py +3 -1
  16. elasticsearch/_async/client/ml.py +2 -2
  17. elasticsearch/_async/client/nodes.py +3 -5
  18. elasticsearch/_async/client/project.py +67 -0
  19. elasticsearch/_async/client/security.py +39 -0
  20. elasticsearch/_async/client/shutdown.py +5 -15
  21. elasticsearch/_async/client/simulate.py +8 -0
  22. elasticsearch/_async/client/slm.py +1 -5
  23. elasticsearch/_async/client/snapshot.py +20 -10
  24. elasticsearch/_async/client/sql.py +7 -0
  25. elasticsearch/_async/client/streams.py +185 -0
  26. elasticsearch/_async/client/watcher.py +1 -5
  27. elasticsearch/_async/helpers.py +74 -12
  28. elasticsearch/_sync/client/__init__.py +96 -44
  29. elasticsearch/_sync/client/async_search.py +7 -0
  30. elasticsearch/_sync/client/cat.py +489 -26
  31. elasticsearch/_sync/client/cluster.py +9 -8
  32. elasticsearch/_sync/client/connector.py +3 -3
  33. elasticsearch/_sync/client/eql.py +7 -0
  34. elasticsearch/_sync/client/esql.py +26 -3
  35. elasticsearch/_sync/client/fleet.py +1 -5
  36. elasticsearch/_sync/client/graph.py +1 -5
  37. elasticsearch/_sync/client/ilm.py +2 -10
  38. elasticsearch/_sync/client/indices.py +181 -37
  39. elasticsearch/_sync/client/inference.py +291 -124
  40. elasticsearch/_sync/client/ingest.py +8 -0
  41. elasticsearch/_sync/client/license.py +4 -2
  42. elasticsearch/_sync/client/logstash.py +3 -1
  43. elasticsearch/_sync/client/ml.py +2 -2
  44. elasticsearch/_sync/client/nodes.py +3 -5
  45. elasticsearch/_sync/client/project.py +67 -0
  46. elasticsearch/_sync/client/security.py +39 -0
  47. elasticsearch/_sync/client/shutdown.py +5 -15
  48. elasticsearch/_sync/client/simulate.py +8 -0
  49. elasticsearch/_sync/client/slm.py +1 -5
  50. elasticsearch/_sync/client/snapshot.py +20 -10
  51. elasticsearch/_sync/client/sql.py +7 -0
  52. elasticsearch/_sync/client/streams.py +185 -0
  53. elasticsearch/_sync/client/watcher.py +1 -5
  54. elasticsearch/_version.py +2 -1
  55. elasticsearch/client.py +4 -0
  56. elasticsearch/compat.py +30 -1
  57. elasticsearch/dsl/__init__.py +28 -0
  58. elasticsearch/dsl/_async/document.py +2 -1
  59. elasticsearch/dsl/_sync/document.py +2 -1
  60. elasticsearch/dsl/aggs.py +97 -0
  61. elasticsearch/dsl/document_base.py +53 -13
  62. elasticsearch/dsl/field.py +21 -2
  63. elasticsearch/dsl/pydantic.py +152 -0
  64. elasticsearch/dsl/query.py +5 -1
  65. elasticsearch/dsl/response/__init__.py +3 -0
  66. elasticsearch/dsl/search_base.py +5 -1
  67. elasticsearch/dsl/types.py +226 -14
  68. elasticsearch/esql/esql.py +331 -41
  69. elasticsearch/esql/functions.py +88 -0
  70. elasticsearch/helpers/__init__.py +10 -1
  71. elasticsearch/helpers/actions.py +106 -33
  72. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +27 -5
  73. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +76 -71
  74. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
  75. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
  76. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/NOTICE +0 -0
@@ -580,6 +580,7 @@ class IngestClient(NamespacedClient):
580
580
  body_fields=(
581
581
  "deprecated",
582
582
  "description",
583
+ "field_access_pattern",
583
584
  "meta",
584
585
  "on_failure",
585
586
  "processors",
@@ -594,6 +595,9 @@ class IngestClient(NamespacedClient):
594
595
  deprecated: t.Optional[bool] = None,
595
596
  description: t.Optional[str] = None,
596
597
  error_trace: t.Optional[bool] = None,
598
+ field_access_pattern: t.Optional[
599
+ t.Union[str, t.Literal["classic", "flexible"]]
600
+ ] = None,
597
601
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
598
602
  human: t.Optional[bool] = None,
599
603
  if_version: t.Optional[int] = None,
@@ -621,6 +625,8 @@ class IngestClient(NamespacedClient):
621
625
  or updating a non-deprecated index template, Elasticsearch will emit a deprecation
622
626
  warning.
623
627
  :param description: Description of the ingest pipeline.
628
+ :param field_access_pattern: Controls how processors in this pipeline should
629
+ read and write data on a document's source.
624
630
  :param if_version: Required version for optimistic concurrency control for pipeline
625
631
  updates
626
632
  :param master_timeout: Period to wait for a connection to the master node. If
@@ -667,6 +673,8 @@ class IngestClient(NamespacedClient):
667
673
  __body["deprecated"] = deprecated
668
674
  if description is not None:
669
675
  __body["description"] = description
676
+ if field_access_pattern is not None:
677
+ __body["field_access_pattern"] = field_access_pattern
670
678
  if meta is not None:
671
679
  __body["_meta"] = meta
672
680
  if on_failure is not None:
@@ -104,8 +104,10 @@ class LicenseClient(NamespacedClient):
104
104
  license types. If `false`, this parameter returns platinum for both platinum
105
105
  and enterprise license types. This behavior is maintained for backwards compatibility.
106
106
  This parameter is deprecated and will always be set to true in 8.x.
107
- :param local: Specifies whether to retrieve local information. The default value
108
- is `false`, which means the information is retrieved from the master node.
107
+ :param local: Specifies whether to retrieve local information. From 9.2 onwards
108
+ the default value is `true`, which means the information is retrieved from
109
+ the responding node. In earlier versions the default is `false`, which means
110
+ the information is retrieved from the elected master node.
109
111
  """
110
112
  __path_parts: t.Dict[str, str] = {}
111
113
  __path = "/_license"
@@ -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:
@@ -2390,7 +2390,7 @@ class MlClient(NamespacedClient):
2390
2390
  exclude_interim: t.Optional[bool] = None,
2391
2391
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2392
2392
  human: t.Optional[bool] = None,
2393
- overall_score: t.Optional[t.Union[float, str]] = None,
2393
+ overall_score: t.Optional[float] = None,
2394
2394
  pretty: t.Optional[bool] = None,
2395
2395
  start: t.Optional[t.Union[str, t.Any]] = None,
2396
2396
  top_n: t.Optional[int] = None,
@@ -5716,7 +5716,7 @@ class MlClient(NamespacedClient):
5716
5716
  <p>Validate an anomaly detection job.</p>
5717
5717
 
5718
5718
 
5719
- `<https://www.elastic.co/guide/en/machine-learning/9.1/ml-jobs.html>`_
5719
+ `<https://www.elastic.co/guide/en/machine-learning/9.2/ml-jobs.html>`_
5720
5720
 
5721
5721
  :param analysis_config:
5722
5722
  :param analysis_limits:
@@ -368,9 +368,7 @@ class NodesClient(NamespacedClient):
368
368
  human: t.Optional[bool] = None,
369
369
  include_segment_file_sizes: t.Optional[bool] = None,
370
370
  include_unloaded_segments: t.Optional[bool] = None,
371
- level: t.Optional[
372
- t.Union[str, t.Literal["cluster", "indices", "shards"]]
373
- ] = None,
371
+ level: t.Optional[t.Union[str, t.Literal["indices", "node", "shards"]]] = None,
374
372
  pretty: t.Optional[bool] = None,
375
373
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
376
374
  types: t.Optional[t.Sequence[str]] = None,
@@ -404,8 +402,8 @@ class NodesClient(NamespacedClient):
404
402
  are requested).
405
403
  :param include_unloaded_segments: If `true`, the response includes information
406
404
  from segments that are not loaded into memory.
407
- :param level: Indicates whether statistics are aggregated at the cluster, index,
408
- or shard level.
405
+ :param level: Indicates whether statistics are aggregated at the node, indices,
406
+ or shards level.
409
407
  :param timeout: Period to wait for a response. If no response is received before
410
408
  the timeout expires, the request fails and returns an error.
411
409
  :param types: A comma-separated list of document types for the indexing index
@@ -0,0 +1,67 @@
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
+ Stability,
25
+ _rewrite_parameters,
26
+ _stability_warning,
27
+ )
28
+
29
+
30
+ class ProjectClient(NamespacedClient):
31
+
32
+ @_rewrite_parameters()
33
+ @_stability_warning(Stability.EXPERIMENTAL)
34
+ def tags(
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
+ pretty: t.Optional[bool] = None,
41
+ ) -> ObjectApiResponse[t.Any]:
42
+ """
43
+ .. raw:: html
44
+
45
+ <p>Return tags defined for the project</p>
46
+
47
+ """
48
+ __path_parts: t.Dict[str, str] = {}
49
+ __path = "/_project/tags"
50
+ __query: t.Dict[str, t.Any] = {}
51
+ if error_trace is not None:
52
+ __query["error_trace"] = error_trace
53
+ if filter_path is not None:
54
+ __query["filter_path"] = filter_path
55
+ if human is not None:
56
+ __query["human"] = human
57
+ if pretty is not None:
58
+ __query["pretty"] = pretty
59
+ __headers = {"accept": "application/json"}
60
+ return self.perform_request( # type: ignore[return-value]
61
+ "GET",
62
+ __path,
63
+ params=__query,
64
+ headers=__headers,
65
+ endpoint_id="project.tags",
66
+ path_parts=__path_parts,
67
+ )
@@ -2052,6 +2052,45 @@ class SecurityClient(NamespacedClient):
2052
2052
  path_parts=__path_parts,
2053
2053
  )
2054
2054
 
2055
+ @_rewrite_parameters()
2056
+ def get_stats(
2057
+ self,
2058
+ *,
2059
+ error_trace: t.Optional[bool] = None,
2060
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2061
+ human: t.Optional[bool] = None,
2062
+ pretty: t.Optional[bool] = None,
2063
+ ) -> ObjectApiResponse[t.Any]:
2064
+ """
2065
+ .. raw:: html
2066
+
2067
+ <p>Get security stats.</p>
2068
+ <p>Gather security usage statistics from all node(s) within the cluster.</p>
2069
+
2070
+
2071
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-security-get-stats>`_
2072
+ """
2073
+ __path_parts: t.Dict[str, str] = {}
2074
+ __path = "/_security/stats"
2075
+ __query: t.Dict[str, t.Any] = {}
2076
+ if error_trace is not None:
2077
+ __query["error_trace"] = error_trace
2078
+ if filter_path is not None:
2079
+ __query["filter_path"] = filter_path
2080
+ if human is not None:
2081
+ __query["human"] = human
2082
+ if pretty is not None:
2083
+ __query["pretty"] = pretty
2084
+ __headers = {"accept": "application/json"}
2085
+ return self.perform_request( # type: ignore[return-value]
2086
+ "GET",
2087
+ __path,
2088
+ params=__query,
2089
+ headers=__headers,
2090
+ endpoint_id="security.get_stats",
2091
+ path_parts=__path_parts,
2092
+ )
2093
+
2055
2094
  @_rewrite_parameters(
2056
2095
  body_fields=(
2057
2096
  "grant_type",
@@ -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
  """
@@ -56,6 +56,7 @@ class SimulateClient(NamespacedClient):
56
56
  t.Mapping[str, t.Mapping[str, t.Any]]
57
57
  ] = None,
58
58
  mapping_addition: t.Optional[t.Mapping[str, t.Any]] = None,
59
+ merge_type: t.Optional[t.Union[str, t.Literal["index", "template"]]] = None,
59
60
  pipeline: t.Optional[str] = None,
60
61
  pipeline_substitutions: t.Optional[
61
62
  t.Mapping[str, t.Mapping[str, t.Any]]
@@ -93,6 +94,11 @@ class SimulateClient(NamespacedClient):
93
94
  :param index_template_substitutions: A map of index template names to substitute
94
95
  index template definition objects.
95
96
  :param mapping_addition:
97
+ :param merge_type: The mapping merge type if mapping overrides are being provided
98
+ in mapping_addition. The allowed values are one of index or template. The
99
+ index option merges mappings the way they would be merged into an existing
100
+ index. The template option merges mappings the way they would be merged into
101
+ a template.
96
102
  :param pipeline: The pipeline to use as the default pipeline. This value can
97
103
  be used to override the default pipeline of the index.
98
104
  :param pipeline_substitutions: Pipelines to test. If you don’t specify the `pipeline`
@@ -116,6 +122,8 @@ class SimulateClient(NamespacedClient):
116
122
  __query["filter_path"] = filter_path
117
123
  if human is not None:
118
124
  __query["human"] = human
125
+ if merge_type is not None:
126
+ __query["merge_type"] = merge_type
119
127
  if pipeline is not None:
120
128
  __query["pipeline"] = pipeline
121
129
  if pretty is not None:
@@ -431,11 +431,7 @@ class SlmClient(NamespacedClient):
431
431
  __body["retention"] = retention
432
432
  if schedule is not None:
433
433
  __body["schedule"] = schedule
434
- if not __body:
435
- __body = None # type: ignore[assignment]
436
- __headers = {"accept": "application/json"}
437
- if __body is not None:
438
- __headers["content-type"] = "application/json"
434
+ __headers = {"accept": "application/json", "content-type": "application/json"}
439
435
  return self.perform_request( # type: ignore[return-value]
440
436
  "PUT",
441
437
  __path,
@@ -872,35 +872,40 @@ class SnapshotClient(NamespacedClient):
872
872
 
873
873
  :param name: The name of the repository.
874
874
  :param blob_count: The total number of blobs to write to the repository during
875
- the test. For realistic experiments, you should set it to at least `2000`.
875
+ the test. For realistic experiments, set this parameter to at least `2000`.
876
876
  :param concurrency: The number of operations to run concurrently during the test.
877
+ For realistic experiments, leave this parameter unset.
877
878
  :param detailed: Indicates whether to return detailed results, including timing
878
879
  information for every operation performed during the analysis. If false,
879
880
  it returns only a summary of the analysis.
880
881
  :param early_read_node_count: The number of nodes on which to perform an early
881
882
  read operation while writing each blob. Early read operations are only rarely
882
- performed.
883
+ performed. For realistic experiments, leave this parameter unset.
883
884
  :param max_blob_size: The maximum size of a blob to be written during the test.
884
- For realistic experiments, you should set it to at least `2gb`.
885
+ For realistic experiments, set this parameter to at least `2gb`.
885
886
  :param max_total_data_size: An upper limit on the total size of all the blobs
886
- written during the test. For realistic experiments, you should set it to
887
+ written during the test. For realistic experiments, set this parameter to
887
888
  at least `1tb`.
888
889
  :param rare_action_probability: The probability of performing a rare action such
889
- as an early read, an overwrite, or an aborted write on each blob.
890
+ as an early read, an overwrite, or an aborted write on each blob. For realistic
891
+ experiments, leave this parameter unset.
890
892
  :param rarely_abort_writes: Indicates whether to rarely cancel writes before
891
- they complete.
893
+ they complete. For realistic experiments, leave this parameter unset.
892
894
  :param read_node_count: The number of nodes on which to read a blob after writing.
895
+ For realistic experiments, leave this parameter unset.
893
896
  :param register_operation_count: The minimum number of linearizable register
894
- operations to perform in total. For realistic experiments, you should set
895
- it to at least `100`.
897
+ operations to perform in total. For realistic experiments, set this parameter
898
+ to at least `100`.
896
899
  :param seed: The seed for the pseudo-random number generator used to generate
897
900
  the list of operations performed during the test. To repeat the same set
898
901
  of operations in multiple experiments, use the same seed in each experiment.
899
902
  Note that the operations are performed concurrently so might not always happen
900
- in the same order on each run.
903
+ in the same order on each run. For realistic experiments, leave this parameter
904
+ unset.
901
905
  :param timeout: The period of time to wait for the test to complete. If no response
902
906
  is received before the timeout expires, the test is cancelled and returns
903
- an error.
907
+ an error. For realistic experiments, set this parameter sufficiently long
908
+ to allow the test to complete.
904
909
  """
905
910
  if name in SKIP_IN_PATH:
906
911
  raise ValueError("Empty value passed for parameter 'name'")
@@ -1266,6 +1271,11 @@ class SnapshotClient(NamespacedClient):
1266
1271
  <p>If you omit the <code>&lt;snapshot&gt;</code> request path parameter, the request retrieves information only for currently running snapshots.
1267
1272
  This usage is preferred.
1268
1273
  If needed, you can specify <code>&lt;repository&gt;</code> and <code>&lt;snapshot&gt;</code> to retrieve information for specific snapshots, even if they're not currently running.</p>
1274
+ <p>Note that the stats will not be available for any shard snapshots in an ongoing snapshot completed by a node that (even momentarily) left the cluster.
1275
+ Loading the stats from the repository is an expensive operation (see the WARNING below).
1276
+ Therefore the stats values for such shards will be -1 even though the &quot;stage&quot; value will be &quot;DONE&quot;, in order to minimize latency.
1277
+ A &quot;description&quot; field will be present for a shard snapshot completed by a departed node explaining why the shard snapshot's stats results are invalid.
1278
+ Consequently, the total stats for the index will be less than expected due to the missing values from these shards.</p>
1269
1279
  <p>WARNING: Using the API to return the status of any snapshots other than currently running snapshots can be expensive.
1270
1280
  The API requires a read from the repository for each shard in each snapshot.
1271
1281
  For example, if you have 100 snapshots with 1,000 shards each, an API request that includes all snapshots will require 100,000 reads (100 snapshots x 1,000 shards).</p>
@@ -285,6 +285,7 @@ class SqlClient(NamespacedClient):
285
285
  page_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
286
286
  params: t.Optional[t.Sequence[t.Any]] = None,
287
287
  pretty: t.Optional[bool] = None,
288
+ project_routing: t.Optional[str] = None,
288
289
  query: t.Optional[str] = None,
289
290
  request_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
290
291
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
@@ -332,6 +333,10 @@ class SqlClient(NamespacedClient):
332
333
  is no longer available. Subsequent scroll requests prolong the lifetime of
333
334
  the scroll cursor by the duration of `page_timeout` in the scroll request.
334
335
  :param params: The values for parameters in the query.
336
+ :param project_routing: Specifies a subset of projects to target for the search
337
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
338
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
339
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
335
340
  :param query: The SQL query to run.
336
341
  :param request_timeout: The timeout before the request fails.
337
342
  :param runtime_mappings: One or more runtime fields for the search request. These
@@ -357,6 +362,8 @@ class SqlClient(NamespacedClient):
357
362
  __query["human"] = human
358
363
  if pretty is not None:
359
364
  __query["pretty"] = pretty
365
+ if project_routing is not None:
366
+ __query["project_routing"] = project_routing
360
367
  if not __body:
361
368
  if allow_partial_search_results is not None:
362
369
  __body["allow_partial_search_results"] = allow_partial_search_results
@@ -0,0 +1,185 @@
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
+
19
+ import typing as t
20
+
21
+ from elastic_transport import ObjectApiResponse, TextApiResponse
22
+
23
+ from ._base import NamespacedClient
24
+ from .utils import (
25
+ Stability,
26
+ _rewrite_parameters,
27
+ _stability_warning,
28
+ )
29
+
30
+
31
+ class StreamsClient(NamespacedClient):
32
+
33
+ @_rewrite_parameters()
34
+ @_stability_warning(Stability.EXPERIMENTAL)
35
+ def logs_disable(
36
+ self,
37
+ *,
38
+ error_trace: t.Optional[bool] = None,
39
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
40
+ human: t.Optional[bool] = None,
41
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
42
+ pretty: t.Optional[bool] = None,
43
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
44
+ ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
45
+ """
46
+ .. raw:: html
47
+
48
+ <p>Disable logs stream.</p>
49
+ <p>Turn off the logs stream feature for this cluster.</p>
50
+
51
+
52
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
53
+
54
+ :param master_timeout: The period to wait for a connection to the master node.
55
+ If no response is received before the timeout expires, the request fails
56
+ and returns an error.
57
+ :param timeout: The period to wait for a response. If no response is received
58
+ before the timeout expires, the request fails and returns an error.
59
+ """
60
+ __path_parts: t.Dict[str, str] = {}
61
+ __path = "/_streams/logs/_disable"
62
+ __query: t.Dict[str, t.Any] = {}
63
+ if error_trace is not None:
64
+ __query["error_trace"] = error_trace
65
+ if filter_path is not None:
66
+ __query["filter_path"] = filter_path
67
+ if human is not None:
68
+ __query["human"] = human
69
+ if master_timeout is not None:
70
+ __query["master_timeout"] = master_timeout
71
+ if pretty is not None:
72
+ __query["pretty"] = pretty
73
+ if timeout is not None:
74
+ __query["timeout"] = timeout
75
+ __headers = {"accept": "application/json,text/plain"}
76
+ return self.perform_request( # type: ignore[return-value]
77
+ "POST",
78
+ __path,
79
+ params=__query,
80
+ headers=__headers,
81
+ endpoint_id="streams.logs_disable",
82
+ path_parts=__path_parts,
83
+ )
84
+
85
+ @_rewrite_parameters()
86
+ @_stability_warning(Stability.EXPERIMENTAL)
87
+ def logs_enable(
88
+ self,
89
+ *,
90
+ error_trace: t.Optional[bool] = None,
91
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
92
+ human: t.Optional[bool] = None,
93
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
94
+ pretty: t.Optional[bool] = None,
95
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
96
+ ) -> t.Union[ObjectApiResponse[t.Any], TextApiResponse]:
97
+ """
98
+ .. raw:: html
99
+
100
+ <p>Enable logs stream.</p>
101
+ <p>Turn on the logs stream feature for this cluster.</p>
102
+ <p>NOTE: To protect existing data, this feature can be turned on only if the
103
+ cluster does not have existing indices or data streams that match the pattern <code>logs|logs.*</code>.
104
+ If those indices or data streams exist, a <code>409 - Conflict</code> response and error is returned.</p>
105
+
106
+
107
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
108
+
109
+ :param master_timeout: The period to wait for a connection to the master node.
110
+ If no response is received before the timeout expires, the request fails
111
+ and returns an error.
112
+ :param timeout: The period to wait for a response. If no response is received
113
+ before the timeout expires, the request fails and returns an error.
114
+ """
115
+ __path_parts: t.Dict[str, str] = {}
116
+ __path = "/_streams/logs/_enable"
117
+ __query: t.Dict[str, t.Any] = {}
118
+ if error_trace is not None:
119
+ __query["error_trace"] = error_trace
120
+ if filter_path is not None:
121
+ __query["filter_path"] = filter_path
122
+ if human is not None:
123
+ __query["human"] = human
124
+ if master_timeout is not None:
125
+ __query["master_timeout"] = master_timeout
126
+ if pretty is not None:
127
+ __query["pretty"] = pretty
128
+ if timeout is not None:
129
+ __query["timeout"] = timeout
130
+ __headers = {"accept": "application/json,text/plain"}
131
+ return self.perform_request( # type: ignore[return-value]
132
+ "POST",
133
+ __path,
134
+ params=__query,
135
+ headers=__headers,
136
+ endpoint_id="streams.logs_enable",
137
+ path_parts=__path_parts,
138
+ )
139
+
140
+ @_rewrite_parameters()
141
+ @_stability_warning(Stability.EXPERIMENTAL)
142
+ def status(
143
+ self,
144
+ *,
145
+ error_trace: t.Optional[bool] = None,
146
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
147
+ human: t.Optional[bool] = None,
148
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
149
+ pretty: t.Optional[bool] = None,
150
+ ) -> ObjectApiResponse[t.Any]:
151
+ """
152
+ .. raw:: html
153
+
154
+ <p>Get the status of streams.</p>
155
+ <p>Get the current status for all types of streams.</p>
156
+
157
+
158
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
159
+
160
+ :param master_timeout: Period to wait for a connection to the master node. If
161
+ no response is received before the timeout expires, the request fails and
162
+ returns an error.
163
+ """
164
+ __path_parts: t.Dict[str, str] = {}
165
+ __path = "/_streams/status"
166
+ __query: t.Dict[str, t.Any] = {}
167
+ if error_trace is not None:
168
+ __query["error_trace"] = error_trace
169
+ if filter_path is not None:
170
+ __query["filter_path"] = filter_path
171
+ if human is not None:
172
+ __query["human"] = human
173
+ if master_timeout is not None:
174
+ __query["master_timeout"] = master_timeout
175
+ if pretty is not None:
176
+ __query["pretty"] = pretty
177
+ __headers = {"accept": "application/json"}
178
+ return self.perform_request( # type: ignore[return-value]
179
+ "GET",
180
+ __path,
181
+ params=__query,
182
+ headers=__headers,
183
+ endpoint_id="streams.status",
184
+ path_parts=__path_parts,
185
+ )
@@ -552,11 +552,7 @@ class WatcherClient(NamespacedClient):
552
552
  __body["transform"] = transform
553
553
  if trigger is not None:
554
554
  __body["trigger"] = trigger
555
- if not __body:
556
- __body = None # type: ignore[assignment]
557
- __headers = {"accept": "application/json"}
558
- if __body is not None:
559
- __headers["content-type"] = "application/json"
555
+ __headers = {"accept": "application/json", "content-type": "application/json"}
560
556
  return self.perform_request( # type: ignore[return-value]
561
557
  "PUT",
562
558
  __path,
elasticsearch/_version.py CHANGED
@@ -15,4 +15,5 @@
15
15
  # specific language governing permissions and limitations
16
16
  # under the License.
17
17
 
18
- __versionstr__ = "9.1.1"
18
+ __versionstr__ = "9.2.0"
19
+ __es_specification_commit__ = "2f74c26e0a1d66c42232ce2830652c01e8717f00"
elasticsearch/client.py CHANGED
@@ -47,6 +47,7 @@ from ._sync.client.migration import MigrationClient as MigrationClient # noqa:
47
47
  from ._sync.client.ml import MlClient as MlClient # noqa: F401
48
48
  from ._sync.client.monitoring import MonitoringClient as MonitoringClient # noqa: F401
49
49
  from ._sync.client.nodes import NodesClient as NodesClient # noqa: F401
50
+ from ._sync.client.project import ProjectClient as ProjectClient # noqa: F401
50
51
  from ._sync.client.query_rules import QueryRulesClient as QueryRulesClient # noqa: F401
51
52
  from ._sync.client.rollup import RollupClient as RollupClient # noqa: F401
52
53
  from ._sync.client.search_application import ( # noqa: F401
@@ -62,6 +63,7 @@ from ._sync.client.slm import SlmClient as SlmClient # noqa: F401
62
63
  from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401
63
64
  from ._sync.client.sql import SqlClient as SqlClient # noqa: F401
64
65
  from ._sync.client.ssl import SslClient as SslClient # noqa: F401
66
+ from ._sync.client.streams import StreamsClient as StreamsClient # noqa: F401
65
67
  from ._sync.client.synonyms import SynonymsClient as SynonymsClient # noqa: F401
66
68
  from ._sync.client.tasks import TasksClient as TasksClient # noqa: F401
67
69
  from ._sync.client.text_structure import ( # noqa: F401
@@ -105,6 +107,7 @@ __all__ = [
105
107
  "MlClient",
106
108
  "MonitoringClient",
107
109
  "NodesClient",
110
+ "ProjectClient",
108
111
  "RollupClient",
109
112
  "SearchApplicationClient",
110
113
  "SearchableSnapshotsClient",
@@ -115,6 +118,7 @@ __all__ = [
115
118
  "SnapshotClient",
116
119
  "SqlClient",
117
120
  "SslClient",
121
+ "StreamsClient",
118
122
  "TasksClient",
119
123
  "TextStructureClient",
120
124
  "TransformClient",