elasticsearch 9.1.3__py3-none-any.whl → 9.2.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 (60) hide show
  1. elasticsearch/_async/client/__init__.py +91 -24
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/autoscaling.py +7 -0
  4. elasticsearch/_async/client/cat.py +8 -1
  5. elasticsearch/_async/client/cluster.py +7 -7
  6. elasticsearch/_async/client/eql.py +7 -0
  7. elasticsearch/_async/client/esql.py +26 -3
  8. elasticsearch/_async/client/indices.py +153 -7
  9. elasticsearch/_async/client/inference.py +315 -42
  10. elasticsearch/_async/client/ingest.py +8 -0
  11. elasticsearch/_async/client/license.py +4 -2
  12. elasticsearch/_async/client/ml.py +2 -2
  13. elasticsearch/_async/client/nodes.py +2 -4
  14. elasticsearch/_async/client/project.py +68 -0
  15. elasticsearch/_async/client/security.py +39 -0
  16. elasticsearch/_async/client/shutdown.py +6 -0
  17. elasticsearch/_async/client/simulate.py +8 -0
  18. elasticsearch/_async/client/snapshot.py +20 -10
  19. elasticsearch/_async/client/sql.py +7 -0
  20. elasticsearch/_async/client/streams.py +2 -3
  21. elasticsearch/_async/helpers.py +28 -15
  22. elasticsearch/_sync/client/__init__.py +91 -24
  23. elasticsearch/_sync/client/async_search.py +7 -0
  24. elasticsearch/_sync/client/autoscaling.py +7 -0
  25. elasticsearch/_sync/client/cat.py +8 -1
  26. elasticsearch/_sync/client/cluster.py +7 -7
  27. elasticsearch/_sync/client/eql.py +7 -0
  28. elasticsearch/_sync/client/esql.py +26 -3
  29. elasticsearch/_sync/client/indices.py +153 -7
  30. elasticsearch/_sync/client/inference.py +315 -42
  31. elasticsearch/_sync/client/ingest.py +8 -0
  32. elasticsearch/_sync/client/license.py +4 -2
  33. elasticsearch/_sync/client/ml.py +2 -2
  34. elasticsearch/_sync/client/nodes.py +2 -4
  35. elasticsearch/_sync/client/project.py +68 -0
  36. elasticsearch/_sync/client/security.py +39 -0
  37. elasticsearch/_sync/client/shutdown.py +6 -0
  38. elasticsearch/_sync/client/simulate.py +8 -0
  39. elasticsearch/_sync/client/snapshot.py +20 -10
  40. elasticsearch/_sync/client/sql.py +7 -0
  41. elasticsearch/_sync/client/streams.py +2 -3
  42. elasticsearch/_version.py +2 -2
  43. elasticsearch/client.py +2 -0
  44. elasticsearch/compat.py +2 -15
  45. elasticsearch/dsl/_async/document.py +2 -1
  46. elasticsearch/dsl/_sync/document.py +2 -1
  47. elasticsearch/dsl/document_base.py +38 -13
  48. elasticsearch/dsl/field.py +8 -0
  49. elasticsearch/dsl/pydantic.py +152 -0
  50. elasticsearch/dsl/query.py +5 -1
  51. elasticsearch/dsl/search_base.py +5 -1
  52. elasticsearch/dsl/types.py +37 -9
  53. elasticsearch/esql/esql.py +331 -41
  54. elasticsearch/esql/functions.py +88 -0
  55. elasticsearch/helpers/actions.py +1 -1
  56. {elasticsearch-9.1.3.dist-info → elasticsearch-9.2.1.dist-info}/METADATA +26 -4
  57. {elasticsearch-9.1.3.dist-info → elasticsearch-9.2.1.dist-info}/RECORD +60 -57
  58. {elasticsearch-9.1.3.dist-info → elasticsearch-9.2.1.dist-info}/WHEEL +0 -0
  59. {elasticsearch-9.1.3.dist-info → elasticsearch-9.2.1.dist-info}/licenses/LICENSE +0 -0
  60. {elasticsearch-9.1.3.dist-info → elasticsearch-9.2.1.dist-info}/licenses/NOTICE +0 -0
@@ -40,6 +40,7 @@ class EsqlClient(NamespacedClient):
40
40
  "columnar",
41
41
  "filter",
42
42
  "include_ccs_metadata",
43
+ "include_execution_metadata",
43
44
  "keep_alive",
44
45
  "keep_on_completion",
45
46
  "locale",
@@ -71,6 +72,7 @@ class EsqlClient(NamespacedClient):
71
72
  ] = None,
72
73
  human: t.Optional[bool] = None,
73
74
  include_ccs_metadata: t.Optional[bool] = None,
75
+ include_execution_metadata: t.Optional[bool] = None,
74
76
  keep_alive: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
75
77
  keep_on_completion: t.Optional[bool] = None,
76
78
  locale: t.Optional[str] = None,
@@ -120,7 +122,11 @@ class EsqlClient(NamespacedClient):
120
122
  be returned if the async query doesn't finish within the timeout. The query
121
123
  ID and running status are available in the `X-Elasticsearch-Async-Id` and
122
124
  `X-Elasticsearch-Async-Is-Running` HTTP headers of the response, respectively.
123
- :param include_ccs_metadata: When set to `true` and performing a cross-cluster
125
+ :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project
126
+ query, the response will include an extra `_clusters` object with information
127
+ about the clusters that participated in the search along with info such as
128
+ shards count.
129
+ :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
124
130
  query, the response will include an extra `_clusters` object with information
125
131
  about the clusters that participated in the search along with info such as
126
132
  shards count.
@@ -180,6 +186,8 @@ class EsqlClient(NamespacedClient):
180
186
  __body["filter"] = filter
181
187
  if include_ccs_metadata is not None:
182
188
  __body["include_ccs_metadata"] = include_ccs_metadata
189
+ if include_execution_metadata is not None:
190
+ __body["include_execution_metadata"] = include_execution_metadata
183
191
  if keep_alive is not None:
184
192
  __body["keep_alive"] = keep_alive
185
193
  if keep_on_completion is not None:
@@ -486,6 +494,7 @@ class EsqlClient(NamespacedClient):
486
494
  "columnar",
487
495
  "filter",
488
496
  "include_ccs_metadata",
497
+ "include_execution_metadata",
489
498
  "locale",
490
499
  "params",
491
500
  "profile",
@@ -514,8 +523,16 @@ class EsqlClient(NamespacedClient):
514
523
  ] = None,
515
524
  human: t.Optional[bool] = None,
516
525
  include_ccs_metadata: t.Optional[bool] = None,
526
+ include_execution_metadata: t.Optional[bool] = None,
517
527
  locale: t.Optional[str] = None,
518
- params: t.Optional[t.Sequence[t.Union[None, bool, float, int, str]]] = None,
528
+ params: t.Optional[
529
+ t.Sequence[
530
+ t.Union[
531
+ t.Sequence[t.Union[None, bool, float, int, str]],
532
+ t.Union[None, bool, float, int, str],
533
+ ]
534
+ ]
535
+ ] = None,
519
536
  pretty: t.Optional[bool] = None,
520
537
  profile: t.Optional[bool] = None,
521
538
  tables: t.Optional[
@@ -554,7 +571,11 @@ class EsqlClient(NamespacedClient):
554
571
  :param format: A short version of the Accept header, e.g. json, yaml. `csv`,
555
572
  `tsv`, and `txt` formats will return results in a tabular format, excluding
556
573
  other metadata fields from the response.
557
- :param include_ccs_metadata: When set to `true` and performing a cross-cluster
574
+ :param include_ccs_metadata: When set to `true` and performing a cross-cluster/cross-project
575
+ query, the response will include an extra `_clusters` object with information
576
+ about the clusters that participated in the search along with info such as
577
+ shards count.
578
+ :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
558
579
  query, the response will include an extra `_clusters` object with information
559
580
  about the clusters that participated in the search along with info such as
560
581
  shards count.
@@ -600,6 +621,8 @@ class EsqlClient(NamespacedClient):
600
621
  __body["filter"] = filter
601
622
  if include_ccs_metadata is not None:
602
623
  __body["include_ccs_metadata"] = include_ccs_metadata
624
+ if include_execution_metadata is not None:
625
+ __body["include_execution_metadata"] = include_execution_metadata
603
626
  if locale is not None:
604
627
  __body["locale"] = locale
605
628
  if params is not None:
@@ -244,7 +244,6 @@ class IndicesClient(NamespacedClient):
244
244
  )
245
245
 
246
246
  @_rewrite_parameters()
247
- @_availability_warning(Stability.EXPERIMENTAL)
248
247
  async def cancel_migrate_reindex(
249
248
  self,
250
249
  *,
@@ -778,7 +777,6 @@ class IndicesClient(NamespacedClient):
778
777
  @_rewrite_parameters(
779
778
  body_name="create_from",
780
779
  )
781
- @_availability_warning(Stability.EXPERIMENTAL)
782
780
  async def create_from(
783
781
  self,
784
782
  *,
@@ -1389,6 +1387,7 @@ class IndicesClient(NamespacedClient):
1389
1387
  <p>NOTE: The total size of fields of the analyzed shards of the index in the response is usually smaller than the index <code>store_size</code> value because some small metadata files are ignored and some parts of data files might not be scanned by the API.
1390
1388
  Since stored fields are stored together in a compressed format, the sizes of stored fields are also estimates and can be inaccurate.
1391
1389
  The stored size of the <code>_id</code> field is likely underestimated while the <code>_source</code> field is overestimated.</p>
1390
+ <p>For usage examples see the External documentation or refer to <a href="https://www.elastic.co/docs/reference/elasticsearch/rest-apis/index-disk-usage">Analyze the index disk usage example</a> for an example.</p>
1392
1391
 
1393
1392
 
1394
1393
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-disk-usage>`_
@@ -2538,6 +2537,57 @@ class IndicesClient(NamespacedClient):
2538
2537
  path_parts=__path_parts,
2539
2538
  )
2540
2539
 
2540
+ @_rewrite_parameters()
2541
+ async def get_data_stream_mappings(
2542
+ self,
2543
+ *,
2544
+ name: t.Union[str, t.Sequence[str]],
2545
+ error_trace: t.Optional[bool] = None,
2546
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2547
+ human: t.Optional[bool] = None,
2548
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2549
+ pretty: t.Optional[bool] = None,
2550
+ ) -> ObjectApiResponse[t.Any]:
2551
+ """
2552
+ .. raw:: html
2553
+
2554
+ <p>Get data stream mappings.</p>
2555
+ <p>Get mapping information for one or more data streams.</p>
2556
+
2557
+
2558
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-get-data-stream-mappings>`_
2559
+
2560
+ :param name: A comma-separated list of data streams or data stream patterns.
2561
+ Supports wildcards (`*`).
2562
+ :param master_timeout: The period to wait for a connection to the master node.
2563
+ If no response is received before the timeout expires, the request fails
2564
+ and returns an error.
2565
+ """
2566
+ if name in SKIP_IN_PATH:
2567
+ raise ValueError("Empty value passed for parameter 'name'")
2568
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
2569
+ __path = f'/_data_stream/{__path_parts["name"]}/_mappings'
2570
+ __query: t.Dict[str, t.Any] = {}
2571
+ if error_trace is not None:
2572
+ __query["error_trace"] = error_trace
2573
+ if filter_path is not None:
2574
+ __query["filter_path"] = filter_path
2575
+ if human is not None:
2576
+ __query["human"] = human
2577
+ if master_timeout is not None:
2578
+ __query["master_timeout"] = master_timeout
2579
+ if pretty is not None:
2580
+ __query["pretty"] = pretty
2581
+ __headers = {"accept": "application/json"}
2582
+ return await self.perform_request( # type: ignore[return-value]
2583
+ "GET",
2584
+ __path,
2585
+ params=__query,
2586
+ headers=__headers,
2587
+ endpoint_id="indices.get_data_stream_mappings",
2588
+ path_parts=__path_parts,
2589
+ )
2590
+
2541
2591
  @_rewrite_parameters()
2542
2592
  async def get_data_stream_options(
2543
2593
  self,
@@ -2895,7 +2945,6 @@ class IndicesClient(NamespacedClient):
2895
2945
  )
2896
2946
 
2897
2947
  @_rewrite_parameters()
2898
- @_availability_warning(Stability.EXPERIMENTAL)
2899
2948
  async def get_migrate_reindex_status(
2900
2949
  self,
2901
2950
  *,
@@ -3111,7 +3160,6 @@ class IndicesClient(NamespacedClient):
3111
3160
  @_rewrite_parameters(
3112
3161
  body_name="reindex",
3113
3162
  )
3114
- @_availability_warning(Stability.EXPERIMENTAL)
3115
3163
  async def migrate_reindex(
3116
3164
  self,
3117
3165
  *,
@@ -3645,6 +3693,83 @@ class IndicesClient(NamespacedClient):
3645
3693
  path_parts=__path_parts,
3646
3694
  )
3647
3695
 
3696
+ @_rewrite_parameters(
3697
+ body_name="mappings",
3698
+ )
3699
+ async def put_data_stream_mappings(
3700
+ self,
3701
+ *,
3702
+ name: t.Union[str, t.Sequence[str]],
3703
+ mappings: t.Optional[t.Mapping[str, t.Any]] = None,
3704
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
3705
+ dry_run: t.Optional[bool] = None,
3706
+ error_trace: t.Optional[bool] = None,
3707
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3708
+ human: t.Optional[bool] = None,
3709
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3710
+ pretty: t.Optional[bool] = None,
3711
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3712
+ ) -> ObjectApiResponse[t.Any]:
3713
+ """
3714
+ .. raw:: html
3715
+
3716
+ <p>Update data stream mappings.</p>
3717
+ <p>This API can be used to override mappings on specific data streams. These overrides will take precedence over what
3718
+ is specified in the template that the data stream matches. The mapping change is only applied to new write indices
3719
+ that are created during rollover after this API is called. No indices are changed by this API.</p>
3720
+
3721
+
3722
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-put-data-stream-mappings>`_
3723
+
3724
+ :param name: A comma-separated list of data streams or data stream patterns.
3725
+ :param mappings:
3726
+ :param dry_run: If `true`, the request does not actually change the mappings
3727
+ on any data streams. Instead, it simulates changing the settings and reports
3728
+ back to the user what would have happened had these settings actually been
3729
+ applied.
3730
+ :param master_timeout: The period to wait for a connection to the master node.
3731
+ If no response is received before the timeout expires, the request fails
3732
+ and returns an error.
3733
+ :param timeout: The period to wait for a response. If no response is received
3734
+ before the timeout expires, the request fails and returns an error.
3735
+ """
3736
+ if name in SKIP_IN_PATH:
3737
+ raise ValueError("Empty value passed for parameter 'name'")
3738
+ if mappings is None and body is None:
3739
+ raise ValueError(
3740
+ "Empty value passed for parameters 'mappings' and 'body', one of them should be set."
3741
+ )
3742
+ elif mappings is not None and body is not None:
3743
+ raise ValueError("Cannot set both 'mappings' and 'body'")
3744
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
3745
+ __path = f'/_data_stream/{__path_parts["name"]}/_mappings'
3746
+ __query: t.Dict[str, t.Any] = {}
3747
+ if dry_run is not None:
3748
+ __query["dry_run"] = dry_run
3749
+ if error_trace is not None:
3750
+ __query["error_trace"] = error_trace
3751
+ if filter_path is not None:
3752
+ __query["filter_path"] = filter_path
3753
+ if human is not None:
3754
+ __query["human"] = human
3755
+ if master_timeout is not None:
3756
+ __query["master_timeout"] = master_timeout
3757
+ if pretty is not None:
3758
+ __query["pretty"] = pretty
3759
+ if timeout is not None:
3760
+ __query["timeout"] = timeout
3761
+ __body = mappings if mappings is not None else body
3762
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3763
+ return await self.perform_request( # type: ignore[return-value]
3764
+ "PUT",
3765
+ __path,
3766
+ params=__query,
3767
+ headers=__headers,
3768
+ body=__body,
3769
+ endpoint_id="indices.put_data_stream_mappings",
3770
+ path_parts=__path_parts,
3771
+ )
3772
+
3648
3773
  @_rewrite_parameters(
3649
3774
  body_fields=("failure_store",),
3650
3775
  )
@@ -4926,7 +5051,18 @@ class IndicesClient(NamespacedClient):
4926
5051
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4927
5052
  human: t.Optional[bool] = None,
4928
5053
  ignore_unavailable: t.Optional[bool] = None,
5054
+ mode: t.Optional[
5055
+ t.Union[
5056
+ t.Sequence[
5057
+ t.Union[
5058
+ str, t.Literal["logsdb", "lookup", "standard", "time_series"]
5059
+ ]
5060
+ ],
5061
+ t.Union[str, t.Literal["logsdb", "lookup", "standard", "time_series"]],
5062
+ ]
5063
+ ] = None,
4929
5064
  pretty: t.Optional[bool] = None,
5065
+ project_routing: t.Optional[str] = None,
4930
5066
  ) -> ObjectApiResponse[t.Any]:
4931
5067
  """
4932
5068
  .. raw:: html
@@ -4952,6 +5088,12 @@ class IndicesClient(NamespacedClient):
4952
5088
  as `open,hidden`.
4953
5089
  :param ignore_unavailable: If `false`, the request returns an error if it targets
4954
5090
  a missing or closed index.
5091
+ :param mode: Filter indices by index mode - standard, lookup, time_series, etc.
5092
+ Comma-separated list of IndexMode. Empty means no filter.
5093
+ :param project_routing: Specifies a subset of projects to target using project
5094
+ metadata tags in a subset of Lucene query syntax. Allowed Lucene queries:
5095
+ the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project
5096
+ _alias:_origin _alias:*pr* Supported in serverless only.
4955
5097
  """
4956
5098
  if name in SKIP_IN_PATH:
4957
5099
  raise ValueError("Empty value passed for parameter 'name'")
@@ -4970,8 +5112,12 @@ class IndicesClient(NamespacedClient):
4970
5112
  __query["human"] = human
4971
5113
  if ignore_unavailable is not None:
4972
5114
  __query["ignore_unavailable"] = ignore_unavailable
5115
+ if mode is not None:
5116
+ __query["mode"] = mode
4973
5117
  if pretty is not None:
4974
5118
  __query["pretty"] = pretty
5119
+ if project_routing is not None:
5120
+ __query["project_routing"] = project_routing
4975
5121
  __headers = {"accept": "application/json"}
4976
5122
  return await self.perform_request( # type: ignore[return-value]
4977
5123
  "GET",
@@ -5011,7 +5157,7 @@ class IndicesClient(NamespacedClient):
5011
5157
  .. raw:: html
5012
5158
 
5013
5159
  <p>Roll over to a new index.</p>
5014
- <p>TIP: It is recommended to use the index lifecycle rollover action to automate rollovers.</p>
5160
+ <p>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>
5015
5161
  <p>The rollover API creates a new index for a data stream or index alias.
5016
5162
  The API behavior depends on the rollover target.</p>
5017
5163
  <p><strong>Roll over a data stream</strong></p>
@@ -5984,8 +6130,8 @@ class IndicesClient(NamespacedClient):
5984
6130
  :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed.
5985
6131
  :param analyzer: Analyzer to use for the query string. This parameter can only
5986
6132
  be used when the `q` query string parameter is specified.
5987
- :param default_operator: The default operator for query string query: `AND` or
5988
- `OR`.
6133
+ :param default_operator: The default operator for query string query: `and` or
6134
+ `or`.
5989
6135
  :param df: Field to use as default where no field prefix is given in the query
5990
6136
  string. This parameter can only be used when the `q` query string parameter
5991
6137
  is specified.