elasticsearch 8.19.1__py3-none-any.whl → 8.19.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 (44) hide show
  1. elasticsearch/_async/client/__init__.py +27 -49
  2. elasticsearch/_async/client/cat.py +481 -25
  3. elasticsearch/_async/client/connector.py +3 -3
  4. elasticsearch/_async/client/fleet.py +1 -5
  5. elasticsearch/_async/client/graph.py +1 -5
  6. elasticsearch/_async/client/ilm.py +2 -10
  7. elasticsearch/_async/client/indices.py +158 -31
  8. elasticsearch/_async/client/inference.py +35 -121
  9. elasticsearch/_async/client/nodes.py +2 -2
  10. elasticsearch/_async/client/shutdown.py +5 -15
  11. elasticsearch/_async/client/slm.py +1 -5
  12. elasticsearch/_async/client/streams.py +185 -0
  13. elasticsearch/_async/client/watcher.py +1 -5
  14. elasticsearch/_async/helpers.py +58 -9
  15. elasticsearch/_sync/client/__init__.py +27 -49
  16. elasticsearch/_sync/client/cat.py +481 -25
  17. elasticsearch/_sync/client/connector.py +3 -3
  18. elasticsearch/_sync/client/fleet.py +1 -5
  19. elasticsearch/_sync/client/graph.py +1 -5
  20. elasticsearch/_sync/client/ilm.py +2 -10
  21. elasticsearch/_sync/client/indices.py +158 -31
  22. elasticsearch/_sync/client/inference.py +35 -121
  23. elasticsearch/_sync/client/nodes.py +2 -2
  24. elasticsearch/_sync/client/shutdown.py +5 -15
  25. elasticsearch/_sync/client/slm.py +1 -5
  26. elasticsearch/_sync/client/streams.py +185 -0
  27. elasticsearch/_sync/client/watcher.py +1 -5
  28. elasticsearch/_version.py +2 -1
  29. elasticsearch/client.py +2 -0
  30. elasticsearch/compat.py +45 -1
  31. elasticsearch/dsl/__init__.py +28 -0
  32. elasticsearch/dsl/aggs.py +97 -0
  33. elasticsearch/dsl/document_base.py +16 -1
  34. elasticsearch/dsl/field.py +12 -1
  35. elasticsearch/dsl/query.py +1 -1
  36. elasticsearch/dsl/response/__init__.py +3 -0
  37. elasticsearch/dsl/types.py +185 -9
  38. elasticsearch/helpers/__init__.py +10 -1
  39. elasticsearch/helpers/actions.py +106 -33
  40. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.2.dist-info}/METADATA +2 -2
  41. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.2.dist-info}/RECORD +44 -42
  42. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.2.dist-info}/WHEEL +0 -0
  43. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.2.dist-info}/licenses/LICENSE +0 -0
  44. {elasticsearch-8.19.1.dist-info → elasticsearch-8.19.2.dist-info}/licenses/NOTICE +0 -0
@@ -102,7 +102,7 @@ class ConnectorClient(NamespacedClient):
102
102
 
103
103
  :param connector_id: The unique identifier of the connector to be deleted
104
104
  :param delete_sync_jobs: A flag indicating if associated sync jobs should be
105
- also removed. Defaults to false.
105
+ also removed.
106
106
  """
107
107
  if connector_id in SKIP_IN_PATH:
108
108
  raise ValueError("Empty value passed for parameter 'connector_id'")
@@ -350,7 +350,7 @@ class ConnectorClient(NamespacedClient):
350
350
 
351
351
  :param connector_name: A comma-separated list of connector names to fetch connector
352
352
  documents for
353
- :param from_: Starting offset (default: 0)
353
+ :param from_: Starting offset
354
354
  :param index_name: A comma-separated list of connector index names to fetch connector
355
355
  documents for
356
356
  :param query: A wildcard query string that filters connectors with matching name,
@@ -941,7 +941,7 @@ class ConnectorClient(NamespacedClient):
941
941
  `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/list-connector-sync-jobs-api.html>`_
942
942
 
943
943
  :param connector_id: A connector id to fetch connector sync jobs for
944
- :param from_: Starting offset (default: 0)
944
+ :param from_: Starting offset
945
945
  :param job_type: A comma-separated list of job types to fetch the sync jobs for
946
946
  :param size: Specifies a max number of results to get
947
947
  :param status: A sync job status to fetch connector sync jobs for
@@ -644,11 +644,7 @@ class FleetClient(NamespacedClient):
644
644
  __body["track_total_hits"] = track_total_hits
645
645
  if version is not None:
646
646
  __body["version"] = version
647
- if not __body:
648
- __body = None # type: ignore[assignment]
649
- __headers = {"accept": "application/json"}
650
- if __body is not None:
651
- __headers["content-type"] = "application/json"
647
+ __headers = {"accept": "application/json", "content-type": "application/json"}
652
648
  return self.perform_request( # type: ignore[return-value]
653
649
  "POST",
654
650
  __path,
@@ -97,11 +97,7 @@ class GraphClient(NamespacedClient):
97
97
  __body["query"] = query
98
98
  if vertices is not None:
99
99
  __body["vertices"] = vertices
100
- if not __body:
101
- __body = None # type: ignore[assignment]
102
- __headers = {"accept": "application/json"}
103
- if __body is not None:
104
- __headers["content-type"] = "application/json"
100
+ __headers = {"accept": "application/json", "content-type": "application/json"}
105
101
  return self.perform_request( # type: ignore[return-value]
106
102
  "POST",
107
103
  __path,
@@ -376,11 +376,7 @@ class IlmClient(NamespacedClient):
376
376
  __body["current_step"] = current_step
377
377
  if next_step is not None:
378
378
  __body["next_step"] = next_step
379
- if not __body:
380
- __body = None # type: ignore[assignment]
381
- __headers = {"accept": "application/json"}
382
- if __body is not None:
383
- __headers["content-type"] = "application/json"
379
+ __headers = {"accept": "application/json", "content-type": "application/json"}
384
380
  return self.perform_request( # type: ignore[return-value]
385
381
  "POST",
386
382
  __path,
@@ -446,11 +442,7 @@ class IlmClient(NamespacedClient):
446
442
  if not __body:
447
443
  if policy is not None:
448
444
  __body["policy"] = policy
449
- if not __body:
450
- __body = None # type: ignore[assignment]
451
- __headers = {"accept": "application/json"}
452
- if __body is not None:
453
- __headers["content-type"] = "application/json"
445
+ __headers = {"accept": "application/json", "content-type": "application/json"}
454
446
  return self.perform_request( # type: ignore[return-value]
455
447
  "PUT",
456
448
  __path,
@@ -232,11 +232,7 @@ class IndicesClient(NamespacedClient):
232
232
  __body["text"] = text
233
233
  if tokenizer is not None:
234
234
  __body["tokenizer"] = tokenizer
235
- if not __body:
236
- __body = None # type: ignore[assignment]
237
- __headers = {"accept": "application/json"}
238
- if __body is not None:
239
- __headers["content-type"] = "application/json"
235
+ __headers = {"accept": "application/json", "content-type": "application/json"}
240
236
  return self.perform_request( # type: ignore[return-value]
241
237
  "POST",
242
238
  __path,
@@ -804,11 +800,7 @@ class IndicesClient(NamespacedClient):
804
800
  raise ValueError("Empty value passed for parameter 'source'")
805
801
  if dest in SKIP_IN_PATH:
806
802
  raise ValueError("Empty value passed for parameter 'dest'")
807
- if create_from is None and body is None:
808
- raise ValueError(
809
- "Empty value passed for parameters 'create_from' and 'body', one of them should be set."
810
- )
811
- elif create_from is not None and body is not None:
803
+ if create_from is not None and body is not None:
812
804
  raise ValueError("Cannot set both 'create_from' and 'body'")
813
805
  __path_parts: t.Dict[str, str] = {
814
806
  "source": _quote(source),
@@ -825,7 +817,11 @@ class IndicesClient(NamespacedClient):
825
817
  if pretty is not None:
826
818
  __query["pretty"] = pretty
827
819
  __body = create_from if create_from is not None else body
828
- __headers = {"accept": "application/json", "content-type": "application/json"}
820
+ if not __body:
821
+ __body = None
822
+ __headers = {"accept": "application/json"}
823
+ if __body is not None:
824
+ __headers["content-type"] = "application/json"
829
825
  return self.perform_request( # type: ignore[return-value]
830
826
  "PUT",
831
827
  __path,
@@ -2467,6 +2463,57 @@ class IndicesClient(NamespacedClient):
2467
2463
  path_parts=__path_parts,
2468
2464
  )
2469
2465
 
2466
+ @_rewrite_parameters()
2467
+ def get_data_stream_settings(
2468
+ self,
2469
+ *,
2470
+ name: t.Union[str, t.Sequence[str]],
2471
+ error_trace: t.Optional[bool] = None,
2472
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2473
+ human: t.Optional[bool] = None,
2474
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2475
+ pretty: t.Optional[bool] = None,
2476
+ ) -> ObjectApiResponse[t.Any]:
2477
+ """
2478
+ .. raw:: html
2479
+
2480
+ <p>Get data stream settings.</p>
2481
+ <p>Get setting information for one or more data streams.</p>
2482
+
2483
+
2484
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-get-data-stream-settings.html>`_
2485
+
2486
+ :param name: A comma-separated list of data streams or data stream patterns.
2487
+ Supports wildcards (`*`).
2488
+ :param master_timeout: The period to wait for a connection to the master node.
2489
+ If no response is received before the timeout expires, the request fails
2490
+ and returns an error.
2491
+ """
2492
+ if name in SKIP_IN_PATH:
2493
+ raise ValueError("Empty value passed for parameter 'name'")
2494
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
2495
+ __path = f'/_data_stream/{__path_parts["name"]}/_settings'
2496
+ __query: t.Dict[str, t.Any] = {}
2497
+ if error_trace is not None:
2498
+ __query["error_trace"] = error_trace
2499
+ if filter_path is not None:
2500
+ __query["filter_path"] = filter_path
2501
+ if human is not None:
2502
+ __query["human"] = human
2503
+ if master_timeout is not None:
2504
+ __query["master_timeout"] = master_timeout
2505
+ if pretty is not None:
2506
+ __query["pretty"] = pretty
2507
+ __headers = {"accept": "application/json"}
2508
+ return self.perform_request( # type: ignore[return-value]
2509
+ "GET",
2510
+ __path,
2511
+ params=__query,
2512
+ headers=__headers,
2513
+ endpoint_id="indices.get_data_stream_settings",
2514
+ path_parts=__path_parts,
2515
+ )
2516
+
2470
2517
  @_rewrite_parameters()
2471
2518
  def get_field_mapping(
2472
2519
  self,
@@ -3453,11 +3500,7 @@ class IndicesClient(NamespacedClient):
3453
3500
  __body["downsampling"] = downsampling
3454
3501
  if enabled is not None:
3455
3502
  __body["enabled"] = enabled
3456
- if not __body:
3457
- __body = None # type: ignore[assignment]
3458
- __headers = {"accept": "application/json"}
3459
- if __body is not None:
3460
- __headers["content-type"] = "application/json"
3503
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3461
3504
  return self.perform_request( # type: ignore[return-value]
3462
3505
  "PUT",
3463
3506
  __path,
@@ -3468,6 +3511,84 @@ class IndicesClient(NamespacedClient):
3468
3511
  path_parts=__path_parts,
3469
3512
  )
3470
3513
 
3514
+ @_rewrite_parameters(
3515
+ body_name="settings",
3516
+ )
3517
+ def put_data_stream_settings(
3518
+ self,
3519
+ *,
3520
+ name: t.Union[str, t.Sequence[str]],
3521
+ settings: t.Optional[t.Mapping[str, t.Any]] = None,
3522
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
3523
+ dry_run: t.Optional[bool] = None,
3524
+ error_trace: t.Optional[bool] = None,
3525
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
3526
+ human: t.Optional[bool] = None,
3527
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3528
+ pretty: t.Optional[bool] = None,
3529
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3530
+ ) -> ObjectApiResponse[t.Any]:
3531
+ """
3532
+ .. raw:: html
3533
+
3534
+ <p>Update data stream settings.</p>
3535
+ <p>This API can be used to override settings on specific data streams. These overrides will take precedence over what
3536
+ is specified in the template that the data stream matches. To prevent your data stream from getting into an invalid state,
3537
+ only certain settings are allowed. If possible, the setting change is applied to all
3538
+ backing indices. Otherwise, it will be applied when the data stream is next rolled over.</p>
3539
+
3540
+
3541
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.19/indices-put-data-stream-settings.html>`_
3542
+
3543
+ :param name: A comma-separated list of data streams or data stream patterns.
3544
+ :param settings:
3545
+ :param dry_run: If `true`, the request does not actually change the settings
3546
+ on any data streams or indices. Instead, it simulates changing the settings
3547
+ and reports back to the user what would have happened had these settings
3548
+ actually been applied.
3549
+ :param master_timeout: The period to wait for a connection to the master node.
3550
+ If no response is received before the timeout expires, the request fails
3551
+ and returns an error.
3552
+ :param timeout: The period to wait for a response. If no response is received
3553
+ before the timeout expires, the request fails and returns an error.
3554
+ """
3555
+ if name in SKIP_IN_PATH:
3556
+ raise ValueError("Empty value passed for parameter 'name'")
3557
+ if settings is None and body is None:
3558
+ raise ValueError(
3559
+ "Empty value passed for parameters 'settings' and 'body', one of them should be set."
3560
+ )
3561
+ elif settings is not None and body is not None:
3562
+ raise ValueError("Cannot set both 'settings' and 'body'")
3563
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
3564
+ __path = f'/_data_stream/{__path_parts["name"]}/_settings'
3565
+ __query: t.Dict[str, t.Any] = {}
3566
+ if dry_run is not None:
3567
+ __query["dry_run"] = dry_run
3568
+ if error_trace is not None:
3569
+ __query["error_trace"] = error_trace
3570
+ if filter_path is not None:
3571
+ __query["filter_path"] = filter_path
3572
+ if human is not None:
3573
+ __query["human"] = human
3574
+ if master_timeout is not None:
3575
+ __query["master_timeout"] = master_timeout
3576
+ if pretty is not None:
3577
+ __query["pretty"] = pretty
3578
+ if timeout is not None:
3579
+ __query["timeout"] = timeout
3580
+ __body = settings if settings is not None else body
3581
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3582
+ return self.perform_request( # type: ignore[return-value]
3583
+ "PUT",
3584
+ __path,
3585
+ params=__query,
3586
+ headers=__headers,
3587
+ body=__body,
3588
+ endpoint_id="indices.put_data_stream_settings",
3589
+ path_parts=__path_parts,
3590
+ )
3591
+
3471
3592
  @_rewrite_parameters(
3472
3593
  body_fields=(
3473
3594
  "allow_auto_create",
@@ -4207,6 +4328,7 @@ class IndicesClient(NamespacedClient):
4207
4328
  For data streams, the API runs the refresh operation on the stream’s backing indices.</p>
4208
4329
  <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.
4209
4330
  You can change this default interval with the <code>index.refresh_interval</code> setting.</p>
4331
+ <p>In Elastic Cloud Serverless, the default refresh interval is 5 seconds across all indices.</p>
4210
4332
  <p>Refresh requests are synchronous and do not return a response until the refresh operation completes.</p>
4211
4333
  <p>Refreshes are resource-intensive.
4212
4334
  To ensure good cluster performance, it's recommended to wait for Elasticsearch's periodic refresh rather than performing an explicit refresh when possible.</p>
@@ -4962,11 +5084,7 @@ class IndicesClient(NamespacedClient):
4962
5084
  __body["aliases"] = aliases
4963
5085
  if settings is not None:
4964
5086
  __body["settings"] = settings
4965
- if not __body:
4966
- __body = None # type: ignore[assignment]
4967
- __headers = {"accept": "application/json"}
4968
- if __body is not None:
4969
- __headers["content-type"] = "application/json"
5087
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4970
5088
  return self.perform_request( # type: ignore[return-value]
4971
5089
  "PUT",
4972
5090
  __path,
@@ -4977,7 +5095,9 @@ class IndicesClient(NamespacedClient):
4977
5095
  path_parts=__path_parts,
4978
5096
  )
4979
5097
 
4980
- @_rewrite_parameters()
5098
+ @_rewrite_parameters(
5099
+ body_name="index_template",
5100
+ )
4981
5101
  def simulate_index_template(
4982
5102
  self,
4983
5103
  *,
@@ -4988,6 +5108,8 @@ class IndicesClient(NamespacedClient):
4988
5108
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4989
5109
  human: t.Optional[bool] = None,
4990
5110
  include_defaults: t.Optional[bool] = None,
5111
+ index_template: t.Optional[t.Mapping[str, t.Any]] = None,
5112
+ body: t.Optional[t.Mapping[str, t.Any]] = None,
4991
5113
  master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4992
5114
  pretty: t.Optional[bool] = None,
4993
5115
  ) -> ObjectApiResponse[t.Any]:
@@ -5007,12 +5129,15 @@ class IndicesClient(NamespacedClient):
5007
5129
  only be dry-run added if new or can also replace an existing one
5008
5130
  :param include_defaults: If true, returns all relevant default configurations
5009
5131
  for the index template.
5132
+ :param index_template:
5010
5133
  :param master_timeout: Period to wait for a connection to the master node. If
5011
5134
  no response is received before the timeout expires, the request fails and
5012
5135
  returns an error.
5013
5136
  """
5014
5137
  if name in SKIP_IN_PATH:
5015
5138
  raise ValueError("Empty value passed for parameter 'name'")
5139
+ if index_template is not None and body is not None:
5140
+ raise ValueError("Cannot set both 'index_template' and 'body'")
5016
5141
  __path_parts: t.Dict[str, str] = {"name": _quote(name)}
5017
5142
  __path = f'/_index_template/_simulate_index/{__path_parts["name"]}'
5018
5143
  __query: t.Dict[str, t.Any] = {}
@@ -5032,12 +5157,18 @@ class IndicesClient(NamespacedClient):
5032
5157
  __query["master_timeout"] = master_timeout
5033
5158
  if pretty is not None:
5034
5159
  __query["pretty"] = pretty
5160
+ __body = index_template if index_template is not None else body
5161
+ if not __body:
5162
+ __body = None
5035
5163
  __headers = {"accept": "application/json"}
5164
+ if __body is not None:
5165
+ __headers["content-type"] = "application/json"
5036
5166
  return self.perform_request( # type: ignore[return-value]
5037
5167
  "POST",
5038
5168
  __path,
5039
5169
  params=__query,
5040
5170
  headers=__headers,
5171
+ body=__body,
5041
5172
  endpoint_id="indices.simulate_index_template",
5042
5173
  path_parts=__path_parts,
5043
5174
  )
@@ -5305,11 +5436,7 @@ class IndicesClient(NamespacedClient):
5305
5436
  __body["aliases"] = aliases
5306
5437
  if settings is not None:
5307
5438
  __body["settings"] = settings
5308
- if not __body:
5309
- __body = None # type: ignore[assignment]
5310
- __headers = {"accept": "application/json"}
5311
- if __body is not None:
5312
- __headers["content-type"] = "application/json"
5439
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5313
5440
  return self.perform_request( # type: ignore[return-value]
5314
5441
  "PUT",
5315
5442
  __path,
@@ -5386,8 +5513,8 @@ class IndicesClient(NamespacedClient):
5386
5513
  are requested).
5387
5514
  :param include_unloaded_segments: If true, the response includes information
5388
5515
  from segments that are not loaded into memory.
5389
- :param level: Indicates whether statistics are aggregated at the cluster, index,
5390
- or shard level.
5516
+ :param level: Indicates whether statistics are aggregated at the cluster, indices,
5517
+ or shards level.
5391
5518
  """
5392
5519
  __path_parts: t.Dict[str, str]
5393
5520
  if index not in SKIP_IN_PATH and metric not in SKIP_IN_PATH:
@@ -5639,8 +5766,8 @@ class IndicesClient(NamespacedClient):
5639
5766
  :param analyze_wildcard: If `true`, wildcard and prefix queries are analyzed.
5640
5767
  :param analyzer: Analyzer to use for the query string. This parameter can only
5641
5768
  be used when the `q` query string parameter is specified.
5642
- :param default_operator: The default operator for query string query: `AND` or
5643
- `OR`.
5769
+ :param default_operator: The default operator for query string query: `and` or
5770
+ `or`.
5644
5771
  :param df: Field to use as default where no field prefix is given in the query
5645
5772
  string. This parameter can only be used when the `q` query string parameter
5646
5773
  is specified.