elasticsearch 9.2.1__py3-none-any.whl → 9.3.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 (55) hide show
  1. elasticsearch/_async/client/__init__.py +44 -40
  2. elasticsearch/_async/client/async_search.py +4 -3
  3. elasticsearch/_async/client/cat.py +163 -8
  4. elasticsearch/_async/client/cluster.py +66 -34
  5. elasticsearch/_async/client/eql.py +7 -6
  6. elasticsearch/_async/client/esql.py +157 -8
  7. elasticsearch/_async/client/fleet.py +1 -1
  8. elasticsearch/_async/client/graph.py +1 -1
  9. elasticsearch/_async/client/indices.py +436 -17
  10. elasticsearch/_async/client/inference.py +299 -9
  11. elasticsearch/_async/client/ml.py +7 -3
  12. elasticsearch/_async/client/nodes.py +167 -5
  13. elasticsearch/_async/client/project.py +9 -1
  14. elasticsearch/_async/client/security.py +26 -3
  15. elasticsearch/_async/client/snapshot.py +1 -1
  16. elasticsearch/_async/client/sql.py +7 -6
  17. elasticsearch/_async/client/streams.py +0 -1
  18. elasticsearch/_async/client/text_structure.py +3 -3
  19. elasticsearch/_sync/client/__init__.py +44 -40
  20. elasticsearch/_sync/client/async_search.py +4 -3
  21. elasticsearch/_sync/client/cat.py +163 -8
  22. elasticsearch/_sync/client/cluster.py +66 -34
  23. elasticsearch/_sync/client/eql.py +7 -6
  24. elasticsearch/_sync/client/esql.py +157 -8
  25. elasticsearch/_sync/client/fleet.py +1 -1
  26. elasticsearch/_sync/client/graph.py +1 -1
  27. elasticsearch/_sync/client/indices.py +436 -17
  28. elasticsearch/_sync/client/inference.py +299 -9
  29. elasticsearch/_sync/client/ml.py +7 -3
  30. elasticsearch/_sync/client/nodes.py +167 -5
  31. elasticsearch/_sync/client/project.py +9 -1
  32. elasticsearch/_sync/client/project_routing.py +264 -0
  33. elasticsearch/_sync/client/security.py +26 -3
  34. elasticsearch/_sync/client/snapshot.py +1 -1
  35. elasticsearch/_sync/client/sql.py +7 -6
  36. elasticsearch/_sync/client/streams.py +0 -1
  37. elasticsearch/_sync/client/text_structure.py +3 -3
  38. elasticsearch/_version.py +2 -2
  39. elasticsearch/dsl/__init__.py +4 -0
  40. elasticsearch/dsl/aggs.py +6 -6
  41. elasticsearch/dsl/field.py +91 -7
  42. elasticsearch/dsl/query.py +2 -2
  43. elasticsearch/dsl/response/__init__.py +2 -0
  44. elasticsearch/dsl/types.py +66 -7
  45. elasticsearch/dsl/utils.py +11 -2
  46. elasticsearch/esql/functions.py +924 -250
  47. elasticsearch/helpers/__init__.py +2 -0
  48. elasticsearch/helpers/actions.py +21 -0
  49. elasticsearch/helpers/vectorstore/_async/vectorstore.py +3 -0
  50. elasticsearch/helpers/vectorstore/_sync/vectorstore.py +3 -0
  51. {elasticsearch-9.2.1.dist-info → elasticsearch-9.3.0.dist-info}/METADATA +2 -1
  52. {elasticsearch-9.2.1.dist-info → elasticsearch-9.3.0.dist-info}/RECORD +55 -54
  53. {elasticsearch-9.2.1.dist-info → elasticsearch-9.3.0.dist-info}/WHEEL +0 -0
  54. {elasticsearch-9.2.1.dist-info → elasticsearch-9.3.0.dist-info}/licenses/LICENSE +0 -0
  55. {elasticsearch-9.2.1.dist-info → elasticsearch-9.3.0.dist-info}/licenses/NOTICE +0 -0
@@ -302,8 +302,8 @@ class ClusterClient(NamespacedClient):
302
302
 
303
303
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-put-component-template>`_
304
304
 
305
- :param name: Comma-separated list of component template names used to limit the
306
- request. Wildcard (`*`) expressions are supported.
305
+ :param name: Name of component template to retrieve. Wildcard (`*`) expressions
306
+ are supported.
307
307
  :param flat_settings: If `true`, returns settings in flat format.
308
308
  :param include_defaults: Return all default configurations for the component
309
309
  template
@@ -470,39 +470,38 @@ class ClusterClient(NamespacedClient):
470
470
 
471
471
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-health>`_
472
472
 
473
- :param index: Comma-separated list of data streams, indices, and index aliases
474
- used to limit the request. Wildcard expressions (`*`) are supported. To target
473
+ :param index: A comma-separated list of data streams, indices, and index aliases
474
+ that limit the request. Wildcard expressions (`*`) are supported. To target
475
475
  all data streams and indices in a cluster, omit this parameter or use _all
476
476
  or `*`.
477
- :param expand_wildcards: Whether to expand wildcard expression to concrete indices
478
- that are open, closed or both.
479
- :param level: Can be one of cluster, indices or shards. Controls the details
480
- level of the health information returned.
481
- :param local: If true, the request retrieves information from the local node
482
- only. Defaults to false, which means information is retrieved from the master
483
- node.
484
- :param master_timeout: Period to wait for a connection to the master node. If
485
- no response is received before the timeout expires, the request fails and
486
- returns an error.
487
- :param timeout: Period to wait for a response. If no response is received before
488
- the timeout expires, the request fails and returns an error.
489
- :param wait_for_active_shards: A number controlling to how many active shards
490
- to wait for, all to wait for all shards in the cluster to be active, or 0
491
- to not wait.
492
- :param wait_for_events: Can be one of immediate, urgent, high, normal, low, languid.
493
- Wait until all currently queued events with the given priority are processed.
494
- :param wait_for_no_initializing_shards: A boolean value which controls whether
495
- to wait (until the timeout provided) for the cluster to have no shard initializations.
496
- Defaults to false, which means it will not wait for initializing shards.
497
- :param wait_for_no_relocating_shards: A boolean value which controls whether
498
- to wait (until the timeout provided) for the cluster to have no shard relocations.
499
- Defaults to false, which means it will not wait for relocating shards.
500
- :param wait_for_nodes: The request waits until the specified number N of nodes
501
- is available. It also accepts >=N, <=N, >N and <N. Alternatively, it is possible
502
- to use ge(N), le(N), gt(N) and lt(N) notation.
503
- :param wait_for_status: One of green, yellow or red. Will wait (until the timeout
504
- provided) until the status of the cluster changes to the one provided or
505
- better, i.e. green > yellow > red. By default, will not wait for any status.
477
+ :param expand_wildcards: Expand wildcard expression to concrete indices that
478
+ are open, closed or both.
479
+ :param level: Return health information at a specific level of detail.
480
+ :param local: If true, retrieve information from the local node only. If false,
481
+ retrieve information from the master node.
482
+ :param master_timeout: The period to wait for a connection to the master node.
483
+ If no response is received before the timeout expires, the request fails
484
+ and returns an error.
485
+ :param timeout: The period to wait for a response. If no response is received
486
+ before the timeout expires, the request fails and returns an error.
487
+ :param wait_for_active_shards: Wait for the specified number of active shards.
488
+ Use `all` to wait for all shards in the cluster to be active. Use `0` to
489
+ not wait.
490
+ :param wait_for_events: Wait until all currently queued events with the given
491
+ priority are processed.
492
+ :param wait_for_no_initializing_shards: Wait (until the timeout expires) for
493
+ the cluster to have no shard initializations. If false, the request does
494
+ not wait for initializing shards.
495
+ :param wait_for_no_relocating_shards: Wait (until the timeout expires) for the
496
+ cluster to have no shard relocations. If false, the request not wait for
497
+ relocating shards.
498
+ :param wait_for_nodes: Wait until the specified number (N) of nodes is available.
499
+ It also accepts `>=N`, `<=N`, `>N` and `<N`. Alternatively, use the notations
500
+ `ge(N)`, `le(N)`, `gt(N)`, and `lt(N)`.
501
+ :param wait_for_status: Wait (until the timeout expires) for the cluster to reach
502
+ a specific health status (or a better status). A green status is better than
503
+ yellow and yellow is better than red. By default, the request does not wait
504
+ for a particular status.
506
505
  """
507
506
  __path_parts: t.Dict[str, str]
508
507
  if index not in SKIP_IN_PATH:
@@ -1068,7 +1067,40 @@ class ClusterClient(NamespacedClient):
1068
1067
  async def state(
1069
1068
  self,
1070
1069
  *,
1071
- metric: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1070
+ metric: t.Optional[
1071
+ t.Union[
1072
+ t.Sequence[
1073
+ t.Union[
1074
+ str,
1075
+ t.Literal[
1076
+ "_all",
1077
+ "blocks",
1078
+ "customs",
1079
+ "master_node",
1080
+ "metadata",
1081
+ "nodes",
1082
+ "routing_nodes",
1083
+ "routing_table",
1084
+ "version",
1085
+ ],
1086
+ ]
1087
+ ],
1088
+ t.Union[
1089
+ str,
1090
+ t.Literal[
1091
+ "_all",
1092
+ "blocks",
1093
+ "customs",
1094
+ "master_node",
1095
+ "metadata",
1096
+ "nodes",
1097
+ "routing_nodes",
1098
+ "routing_table",
1099
+ "version",
1100
+ ],
1101
+ ],
1102
+ ]
1103
+ ] = None,
1072
1104
  index: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1073
1105
  allow_no_indices: t.Optional[bool] = None,
1074
1106
  error_trace: t.Optional[bool] = None,
@@ -187,6 +187,7 @@ class EqlClient(NamespacedClient):
187
187
  "keep_alive",
188
188
  "keep_on_completion",
189
189
  "max_samples_per_key",
190
+ "project_routing",
190
191
  "result_position",
191
192
  "runtime_mappings",
192
193
  "size",
@@ -286,10 +287,10 @@ class EqlClient(NamespacedClient):
286
287
  `size` parameter to get a smaller or larger set of samples. To retrieve more
287
288
  than one sample per set of join keys, use the `max_samples_per_key` parameter.
288
289
  Pipes are not supported for sample queries.
289
- :param project_routing: Specifies a subset of projects to target for the search
290
- using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
291
- queries: the _alias tag and a single value (possibly wildcarded). Examples:
292
- _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
290
+ :param project_routing: Specifies a subset of projects to target using project
291
+ metadata tags in a subset of Lucene query syntax. Allowed Lucene queries:
292
+ the _alias tag and a single value (possibly wildcarded). Examples: _alias:my-project
293
+ _alias:_origin _alias:*pr* Supported in serverless only.
293
294
  :param result_position:
294
295
  :param runtime_mappings:
295
296
  :param size: For basic queries, the maximum number of matching events to return.
@@ -323,8 +324,6 @@ class EqlClient(NamespacedClient):
323
324
  __query["ignore_unavailable"] = ignore_unavailable
324
325
  if pretty is not None:
325
326
  __query["pretty"] = pretty
326
- if project_routing is not None:
327
- __query["project_routing"] = project_routing
328
327
  if not __body:
329
328
  if query is not None:
330
329
  __body["query"] = query
@@ -350,6 +349,8 @@ class EqlClient(NamespacedClient):
350
349
  __body["keep_on_completion"] = keep_on_completion
351
350
  if max_samples_per_key is not None:
352
351
  __body["max_samples_per_key"] = max_samples_per_key
352
+ if project_routing is not None:
353
+ __body["project_routing"] = project_routing
353
354
  if result_position is not None:
354
355
  __body["result_position"] = result_position
355
356
  if runtime_mappings is not None:
@@ -126,10 +126,10 @@ class EsqlClient(NamespacedClient):
126
126
  query, the response will include an extra `_clusters` object with information
127
127
  about the clusters that participated in the search along with info such as
128
128
  shards count.
129
- :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
130
- query, the response will include an extra `_clusters` object with information
131
- about the clusters that participated in the search along with info such as
132
- shards count.
129
+ :param include_execution_metadata: When set to `true`, the response will include
130
+ an extra `_clusters` object with information about the clusters that participated
131
+ in the search along with info such as shards count. This is similar to `include_ccs_metadata`,
132
+ but it also returns metadata when the query is not CCS/CPS
133
133
  :param keep_alive: The period for which the query and its results are stored
134
134
  in the cluster. The default period is five days. When this period expires,
135
135
  the query and its results are deleted, even if the query is still ongoing.
@@ -403,6 +403,51 @@ class EsqlClient(NamespacedClient):
403
403
  path_parts=__path_parts,
404
404
  )
405
405
 
406
+ @_rewrite_parameters()
407
+ @_availability_warning(Stability.EXPERIMENTAL)
408
+ async def delete_view(
409
+ self,
410
+ *,
411
+ name: str,
412
+ error_trace: t.Optional[bool] = None,
413
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
414
+ human: t.Optional[bool] = None,
415
+ pretty: t.Optional[bool] = None,
416
+ ) -> ObjectApiResponse[t.Any]:
417
+ """
418
+ .. raw:: html
419
+
420
+ <p>Delete an ES|QL view.</p>
421
+ <p>Deletes a stored ES|QL view.</p>
422
+
423
+
424
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
425
+
426
+ :param name: The view name to remove.
427
+ """
428
+ if name in SKIP_IN_PATH:
429
+ raise ValueError("Empty value passed for parameter 'name'")
430
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
431
+ __path = f'/_query/view/{__path_parts["name"]}'
432
+ __query: t.Dict[str, t.Any] = {}
433
+ if error_trace is not None:
434
+ __query["error_trace"] = error_trace
435
+ if filter_path is not None:
436
+ __query["filter_path"] = filter_path
437
+ if human is not None:
438
+ __query["human"] = human
439
+ if pretty is not None:
440
+ __query["pretty"] = pretty
441
+ __headers = {"accept": "application/json"}
442
+ return await self.perform_request( # type: ignore[return-value]
443
+ "DELETE",
444
+ __path,
445
+ params=__query,
446
+ headers=__headers,
447
+ endpoint_id="esql.delete_view",
448
+ path_parts=__path_parts,
449
+ )
450
+
406
451
  @_rewrite_parameters()
407
452
  @_availability_warning(Stability.EXPERIMENTAL)
408
453
  async def get_query(
@@ -448,6 +493,54 @@ class EsqlClient(NamespacedClient):
448
493
  path_parts=__path_parts,
449
494
  )
450
495
 
496
+ @_rewrite_parameters()
497
+ @_availability_warning(Stability.EXPERIMENTAL)
498
+ async def get_view(
499
+ self,
500
+ *,
501
+ name: t.Optional[str] = None,
502
+ error_trace: t.Optional[bool] = None,
503
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
504
+ human: t.Optional[bool] = None,
505
+ pretty: t.Optional[bool] = None,
506
+ ) -> ObjectApiResponse[t.Any]:
507
+ """
508
+ .. raw:: html
509
+
510
+ <p>Get an ES|QL view.</p>
511
+ <p>Returns a stored ES|QL view.</p>
512
+
513
+
514
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
515
+
516
+ :param name: The comma-separated view names to retrieve.
517
+ """
518
+ __path_parts: t.Dict[str, str]
519
+ if name not in SKIP_IN_PATH:
520
+ __path_parts = {"name": _quote(name)}
521
+ __path = f'/_query/view/{__path_parts["name"]}'
522
+ else:
523
+ __path_parts = {}
524
+ __path = "/_query/view"
525
+ __query: t.Dict[str, t.Any] = {}
526
+ if error_trace is not None:
527
+ __query["error_trace"] = error_trace
528
+ if filter_path is not None:
529
+ __query["filter_path"] = filter_path
530
+ if human is not None:
531
+ __query["human"] = human
532
+ if pretty is not None:
533
+ __query["pretty"] = pretty
534
+ __headers = {"accept": "application/json"}
535
+ return await self.perform_request( # type: ignore[return-value]
536
+ "GET",
537
+ __path,
538
+ params=__query,
539
+ headers=__headers,
540
+ endpoint_id="esql.get_view",
541
+ path_parts=__path_parts,
542
+ )
543
+
451
544
  @_rewrite_parameters()
452
545
  @_availability_warning(Stability.EXPERIMENTAL)
453
546
  async def list_queries(
@@ -488,6 +581,62 @@ class EsqlClient(NamespacedClient):
488
581
  path_parts=__path_parts,
489
582
  )
490
583
 
584
+ @_rewrite_parameters(
585
+ body_fields=("query",),
586
+ )
587
+ @_availability_warning(Stability.EXPERIMENTAL)
588
+ async def put_view(
589
+ self,
590
+ *,
591
+ name: str,
592
+ query: t.Optional[t.Union[str, "ESQLBase"]] = None,
593
+ error_trace: t.Optional[bool] = None,
594
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
595
+ human: t.Optional[bool] = None,
596
+ pretty: t.Optional[bool] = None,
597
+ body: t.Optional[t.Dict[str, t.Any]] = None,
598
+ ) -> ObjectApiResponse[t.Any]:
599
+ """
600
+ .. raw:: html
601
+
602
+ <p>Create or update an ES|QL view.</p>
603
+
604
+
605
+ `<https://www.elastic.co/docs/api/doc/elasticsearch#TODO>`_
606
+
607
+ :param name: The view name to create or update.
608
+ :param query: The ES|QL query string from which to create a view.
609
+ """
610
+ if name in SKIP_IN_PATH:
611
+ raise ValueError("Empty value passed for parameter 'name'")
612
+ if query is None and body is None:
613
+ raise ValueError("Empty value passed for parameter 'query'")
614
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
615
+ __path = f'/_query/view/{__path_parts["name"]}'
616
+ __query: t.Dict[str, t.Any] = {}
617
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
618
+ if error_trace is not None:
619
+ __query["error_trace"] = error_trace
620
+ if filter_path is not None:
621
+ __query["filter_path"] = filter_path
622
+ if human is not None:
623
+ __query["human"] = human
624
+ if pretty is not None:
625
+ __query["pretty"] = pretty
626
+ if not __body:
627
+ if query is not None:
628
+ __body["query"] = str(query)
629
+ __headers = {"accept": "application/json", "content-type": "application/json"}
630
+ return await self.perform_request( # type: ignore[return-value]
631
+ "PUT",
632
+ __path,
633
+ params=__query,
634
+ headers=__headers,
635
+ body=__body,
636
+ endpoint_id="esql.put_view",
637
+ path_parts=__path_parts,
638
+ )
639
+
491
640
  @_rewrite_parameters(
492
641
  body_fields=(
493
642
  "query",
@@ -575,10 +724,10 @@ class EsqlClient(NamespacedClient):
575
724
  query, the response will include an extra `_clusters` object with information
576
725
  about the clusters that participated in the search along with info such as
577
726
  shards count.
578
- :param include_execution_metadata: When set to `true` and performing a cross-cluster/cross-project
579
- query, the response will include an extra `_clusters` object with information
580
- about the clusters that participated in the search along with info such as
581
- shards count.
727
+ :param include_execution_metadata: When set to `true`, the response will include
728
+ an extra `_clusters` object with information about the clusters that participated
729
+ in the search along with info such as shards count. This is similar to `include_ccs_metadata`,
730
+ but it also returns metadata when the query is not CCS/CPS
582
731
  :param locale:
583
732
  :param params: To avoid any attempts of hacking or code injection, extract the
584
733
  values in a separate list of parameters. Use question mark placeholders (?)
@@ -345,7 +345,7 @@ class FleetClient(NamespacedClient):
345
345
  t.Union[t.Mapping[str, t.Any], t.Sequence[t.Mapping[str, t.Any]]]
346
346
  ] = None,
347
347
  rest_total_hits_as_int: t.Optional[bool] = None,
348
- routing: t.Optional[str] = None,
348
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
349
349
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
350
350
  script_fields: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
351
351
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -39,7 +39,7 @@ class GraphClient(NamespacedClient):
39
39
  human: t.Optional[bool] = None,
40
40
  pretty: t.Optional[bool] = None,
41
41
  query: t.Optional[t.Mapping[str, t.Any]] = None,
42
- routing: t.Optional[str] = None,
42
+ routing: t.Optional[t.Union[str, t.Sequence[str]]] = None,
43
43
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
44
44
  vertices: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
45
45
  body: t.Optional[t.Dict[str, t.Any]] = None,