elasticsearch 8.11.1__py3-none-any.whl → 8.12.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 (90) hide show
  1. elasticsearch/_async/client/__init__.py +493 -347
  2. elasticsearch/_async/client/async_search.py +108 -72
  3. elasticsearch/_async/client/autoscaling.py +13 -8
  4. elasticsearch/_async/client/cat.py +26 -26
  5. elasticsearch/_async/client/ccr.py +178 -117
  6. elasticsearch/_async/client/cluster.py +56 -48
  7. elasticsearch/_async/client/dangling_indices.py +3 -3
  8. elasticsearch/_async/client/enrich.py +15 -13
  9. elasticsearch/_async/client/eql.py +53 -36
  10. elasticsearch/_async/client/esql.py +99 -0
  11. elasticsearch/_async/client/features.py +2 -2
  12. elasticsearch/_async/client/fleet.py +111 -71
  13. elasticsearch/_async/client/graph.py +13 -11
  14. elasticsearch/_async/client/ilm.py +33 -27
  15. elasticsearch/_async/client/indices.py +326 -227
  16. elasticsearch/_async/client/inference.py +212 -0
  17. elasticsearch/_async/client/ingest.py +28 -24
  18. elasticsearch/_async/client/license.py +15 -13
  19. elasticsearch/_async/client/logstash.py +13 -10
  20. elasticsearch/_async/client/migration.py +3 -3
  21. elasticsearch/_async/client/ml.py +758 -538
  22. elasticsearch/_async/client/monitoring.py +10 -5
  23. elasticsearch/_async/client/nodes.py +13 -11
  24. elasticsearch/_async/client/query_ruleset.py +12 -10
  25. elasticsearch/_async/client/rollup.py +59 -46
  26. elasticsearch/_async/client/search_application.py +23 -16
  27. elasticsearch/_async/client/searchable_snapshots.py +23 -16
  28. elasticsearch/_async/client/security.py +391 -289
  29. elasticsearch/_async/client/shutdown.py +18 -14
  30. elasticsearch/_async/client/slm.py +23 -21
  31. elasticsearch/_async/client/snapshot.py +91 -65
  32. elasticsearch/_async/client/sql.py +81 -58
  33. elasticsearch/_async/client/ssl.py +1 -1
  34. elasticsearch/_async/client/synonyms.py +23 -19
  35. elasticsearch/_async/client/tasks.py +3 -3
  36. elasticsearch/_async/client/text_structure.py +10 -5
  37. elasticsearch/_async/client/transform.py +111 -75
  38. elasticsearch/_async/client/watcher.py +77 -55
  39. elasticsearch/_async/client/xpack.py +2 -2
  40. elasticsearch/_async/helpers.py +1 -1
  41. elasticsearch/_sync/client/__init__.py +493 -347
  42. elasticsearch/_sync/client/async_search.py +108 -72
  43. elasticsearch/_sync/client/autoscaling.py +13 -8
  44. elasticsearch/_sync/client/cat.py +26 -26
  45. elasticsearch/_sync/client/ccr.py +178 -117
  46. elasticsearch/_sync/client/cluster.py +56 -48
  47. elasticsearch/_sync/client/dangling_indices.py +3 -3
  48. elasticsearch/_sync/client/enrich.py +15 -13
  49. elasticsearch/_sync/client/eql.py +53 -36
  50. elasticsearch/_sync/client/esql.py +99 -0
  51. elasticsearch/_sync/client/features.py +2 -2
  52. elasticsearch/_sync/client/fleet.py +111 -71
  53. elasticsearch/_sync/client/graph.py +13 -11
  54. elasticsearch/_sync/client/ilm.py +33 -27
  55. elasticsearch/_sync/client/indices.py +326 -227
  56. elasticsearch/_sync/client/inference.py +212 -0
  57. elasticsearch/_sync/client/ingest.py +28 -24
  58. elasticsearch/_sync/client/license.py +15 -13
  59. elasticsearch/_sync/client/logstash.py +13 -10
  60. elasticsearch/_sync/client/migration.py +3 -3
  61. elasticsearch/_sync/client/ml.py +758 -538
  62. elasticsearch/_sync/client/monitoring.py +10 -5
  63. elasticsearch/_sync/client/nodes.py +13 -11
  64. elasticsearch/_sync/client/query_ruleset.py +12 -10
  65. elasticsearch/_sync/client/rollup.py +59 -46
  66. elasticsearch/_sync/client/search_application.py +23 -16
  67. elasticsearch/_sync/client/searchable_snapshots.py +23 -16
  68. elasticsearch/_sync/client/security.py +391 -289
  69. elasticsearch/_sync/client/shutdown.py +18 -14
  70. elasticsearch/_sync/client/slm.py +23 -21
  71. elasticsearch/_sync/client/snapshot.py +91 -65
  72. elasticsearch/_sync/client/sql.py +81 -58
  73. elasticsearch/_sync/client/ssl.py +1 -1
  74. elasticsearch/_sync/client/synonyms.py +23 -19
  75. elasticsearch/_sync/client/tasks.py +3 -3
  76. elasticsearch/_sync/client/text_structure.py +10 -5
  77. elasticsearch/_sync/client/transform.py +111 -75
  78. elasticsearch/_sync/client/utils.py +34 -10
  79. elasticsearch/_sync/client/watcher.py +77 -55
  80. elasticsearch/_sync/client/xpack.py +2 -2
  81. elasticsearch/_version.py +1 -1
  82. elasticsearch/client.py +2 -0
  83. elasticsearch/helpers/actions.py +1 -1
  84. {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/METADATA +2 -3
  85. elasticsearch-8.12.0.dist-info/RECORD +103 -0
  86. elasticsearch-8.11.1.dist-info/RECORD +0 -99
  87. {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/LICENSE +0 -0
  88. {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/NOTICE +0 -0
  89. {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/WHEEL +0 -0
  90. {elasticsearch-8.11.1.dist-info → elasticsearch-8.12.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,99 @@
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 _rewrite_parameters
24
+
25
+
26
+ class EsqlClient(NamespacedClient):
27
+ @_rewrite_parameters(
28
+ body_fields=("query", "columnar", "filter", "locale", "params"),
29
+ ignore_deprecated_options={"params"},
30
+ )
31
+ async def query(
32
+ self,
33
+ *,
34
+ query: t.Optional[str] = None,
35
+ columnar: t.Optional[bool] = None,
36
+ delimiter: t.Optional[str] = None,
37
+ error_trace: t.Optional[bool] = None,
38
+ filter: t.Optional[t.Mapping[str, t.Any]] = None,
39
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
40
+ format: t.Optional[str] = None,
41
+ human: t.Optional[bool] = None,
42
+ locale: t.Optional[str] = None,
43
+ params: t.Optional[t.Sequence[t.Union[None, bool, float, int, str]]] = None,
44
+ pretty: t.Optional[bool] = None,
45
+ body: t.Optional[t.Dict[str, t.Any]] = None,
46
+ ) -> ObjectApiResponse[t.Any]:
47
+ """
48
+ Executes an ESQL request
49
+
50
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/esql-rest.html>`_
51
+
52
+ :param query: The ES|QL query API accepts an ES|QL query string in the query
53
+ parameter, runs it, and returns the results.
54
+ :param columnar: By default, ES|QL returns results as rows. For example, FROM
55
+ returns each individual document as one row. For the JSON, YAML, CBOR and
56
+ smile formats, ES|QL can return the results in a columnar fashion where one
57
+ row represents all the values of a certain column in the results.
58
+ :param delimiter: The character to use between values within a CSV row. Only
59
+ valid for the CSV format.
60
+ :param filter: Specify a Query DSL query in the filter parameter to filter the
61
+ set of documents that an ES|QL query runs on.
62
+ :param format: A short version of the Accept header, e.g. json, yaml.
63
+ :param locale:
64
+ :param params: To avoid any attempts of hacking or code injection, extract the
65
+ values in a separate list of parameters. Use question mark placeholders (?)
66
+ in the query string for each of the parameters.
67
+ """
68
+ if query is None and body is None:
69
+ raise ValueError("Empty value passed for parameter 'query'")
70
+ __path = "/_query"
71
+ __query: t.Dict[str, t.Any] = {}
72
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
73
+ if delimiter is not None:
74
+ __query["delimiter"] = delimiter
75
+ if error_trace is not None:
76
+ __query["error_trace"] = error_trace
77
+ if filter_path is not None:
78
+ __query["filter_path"] = filter_path
79
+ if format is not None:
80
+ __query["format"] = format
81
+ if human is not None:
82
+ __query["human"] = human
83
+ if pretty is not None:
84
+ __query["pretty"] = pretty
85
+ if not __body:
86
+ if query is not None:
87
+ __body["query"] = query
88
+ if columnar is not None:
89
+ __body["columnar"] = columnar
90
+ if filter is not None:
91
+ __body["filter"] = filter
92
+ if locale is not None:
93
+ __body["locale"] = locale
94
+ if params is not None:
95
+ __body["params"] = params
96
+ __headers = {"accept": "application/json", "content-type": "application/json"}
97
+ return await self.perform_request( # type: ignore[return-value]
98
+ "POST", __path, params=__query, headers=__headers, body=__body
99
+ )
@@ -37,7 +37,7 @@ class FeaturesClient(NamespacedClient):
37
37
  Gets a list of features which can be included in snapshots using the feature_states
38
38
  field when creating a snapshot
39
39
 
40
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/get-features-api.html>`_
40
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-features-api.html>`_
41
41
  """
42
42
  __path = "/_features"
43
43
  __query: t.Dict[str, t.Any] = {}
@@ -66,7 +66,7 @@ class FeaturesClient(NamespacedClient):
66
66
  """
67
67
  Resets the internal state of features, usually by deleting system indices
68
68
 
69
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/modules-snapshots.html>`_
69
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/modules-snapshots.html>`_
70
70
  """
71
71
  __path = "/_features/_reset"
72
72
  __query: t.Dict[str, t.Any] = {}
@@ -42,7 +42,7 @@ class FleetClient(NamespacedClient):
42
42
  Returns the current global checkpoints for an index. This API is design for internal
43
43
  use by the fleet server project.
44
44
 
45
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/get-global-checkpoints.html>`_
45
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/get-global-checkpoints.html>`_
46
46
 
47
47
  :param index: A single index or index alias that resolves to a single index.
48
48
  :param checkpoints: A comma separated list of previous global checkpoints. When
@@ -87,7 +87,8 @@ class FleetClient(NamespacedClient):
87
87
  async def msearch(
88
88
  self,
89
89
  *,
90
- searches: t.Sequence[t.Mapping[str, t.Any]],
90
+ searches: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
91
+ body: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
91
92
  index: t.Optional[str] = None,
92
93
  allow_no_indices: t.Optional[bool] = None,
93
94
  allow_partial_search_results: t.Optional[bool] = None,
@@ -163,8 +164,12 @@ class FleetClient(NamespacedClient):
163
164
  has become visible for search. Defaults to an empty list which will cause
164
165
  Elasticsearch to immediately execute the search.
165
166
  """
166
- if searches is None:
167
- raise ValueError("Empty value passed for parameter 'searches'")
167
+ if searches is None and body is None:
168
+ raise ValueError(
169
+ "Empty value passed for parameters 'searches' and 'body', one of them should be set."
170
+ )
171
+ elif searches is not None and body is not None:
172
+ raise ValueError("Cannot set both 'searches' and 'body'")
168
173
  if index not in SKIP_IN_PATH:
169
174
  __path = f"/{_quote(index)}/_fleet/_fleet_msearch"
170
175
  else:
@@ -204,7 +209,7 @@ class FleetClient(NamespacedClient):
204
209
  __query["typed_keys"] = typed_keys
205
210
  if wait_for_checkpoints is not None:
206
211
  __query["wait_for_checkpoints"] = wait_for_checkpoints
207
- __body = searches
212
+ __body = searches if searches is not None else body
208
213
  __headers = {
209
214
  "accept": "application/json",
210
215
  "content-type": "application/x-ndjson",
@@ -214,7 +219,40 @@ class FleetClient(NamespacedClient):
214
219
  )
215
220
 
216
221
  @_rewrite_parameters(
217
- body_fields=True,
222
+ body_fields=(
223
+ "aggregations",
224
+ "aggs",
225
+ "collapse",
226
+ "docvalue_fields",
227
+ "explain",
228
+ "ext",
229
+ "fields",
230
+ "from_",
231
+ "highlight",
232
+ "indices_boost",
233
+ "min_score",
234
+ "pit",
235
+ "post_filter",
236
+ "profile",
237
+ "query",
238
+ "rescore",
239
+ "runtime_mappings",
240
+ "script_fields",
241
+ "search_after",
242
+ "seq_no_primary_term",
243
+ "size",
244
+ "slice",
245
+ "sort",
246
+ "source",
247
+ "stats",
248
+ "stored_fields",
249
+ "suggest",
250
+ "terminate_after",
251
+ "timeout",
252
+ "track_scores",
253
+ "track_total_hits",
254
+ "version",
255
+ ),
218
256
  parameter_aliases={
219
257
  "_source": "source",
220
258
  "_source_excludes": "source_excludes",
@@ -312,6 +350,7 @@ class FleetClient(NamespacedClient):
312
350
  typed_keys: t.Optional[bool] = None,
313
351
  version: t.Optional[bool] = None,
314
352
  wait_for_checkpoints: t.Optional[t.Sequence[int]] = None,
353
+ body: t.Optional[t.Dict[str, t.Any]] = None,
315
354
  ) -> ObjectApiResponse[t.Any]:
316
355
  """
317
356
  Search API where the search will only be executed after specified checkpoints
@@ -421,8 +460,8 @@ class FleetClient(NamespacedClient):
421
460
  if index in SKIP_IN_PATH:
422
461
  raise ValueError("Empty value passed for parameter 'index'")
423
462
  __path = f"/{_quote(index)}/_fleet/_fleet_search"
424
- __body: t.Dict[str, t.Any] = {}
425
463
  __query: t.Dict[str, t.Any] = {}
464
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
426
465
  # The 'sort' parameter with a colon can't be encoded to the body.
427
466
  if sort is not None and (
428
467
  (isinstance(sort, str) and ":" in sort)
@@ -434,10 +473,6 @@ class FleetClient(NamespacedClient):
434
473
  ):
435
474
  __query["sort"] = sort
436
475
  sort = None
437
- if aggregations is not None:
438
- __body["aggregations"] = aggregations
439
- if aggs is not None:
440
- __body["aggs"] = aggs
441
476
  if allow_no_indices is not None:
442
477
  __query["allow_no_indices"] = allow_no_indices
443
478
  if allow_partial_search_results is not None:
@@ -450,100 +485,50 @@ class FleetClient(NamespacedClient):
450
485
  __query["batched_reduce_size"] = batched_reduce_size
451
486
  if ccs_minimize_roundtrips is not None:
452
487
  __query["ccs_minimize_roundtrips"] = ccs_minimize_roundtrips
453
- if collapse is not None:
454
- __body["collapse"] = collapse
455
488
  if default_operator is not None:
456
489
  __query["default_operator"] = default_operator
457
490
  if df is not None:
458
491
  __query["df"] = df
459
- if docvalue_fields is not None:
460
- __body["docvalue_fields"] = docvalue_fields
461
492
  if error_trace is not None:
462
493
  __query["error_trace"] = error_trace
463
494
  if expand_wildcards is not None:
464
495
  __query["expand_wildcards"] = expand_wildcards
465
- if explain is not None:
466
- __body["explain"] = explain
467
- if ext is not None:
468
- __body["ext"] = ext
469
- if fields is not None:
470
- __body["fields"] = fields
471
496
  if filter_path is not None:
472
497
  __query["filter_path"] = filter_path
473
- if from_ is not None:
474
- __body["from"] = from_
475
- if highlight is not None:
476
- __body["highlight"] = highlight
477
498
  if human is not None:
478
499
  __query["human"] = human
479
500
  if ignore_throttled is not None:
480
501
  __query["ignore_throttled"] = ignore_throttled
481
502
  if ignore_unavailable is not None:
482
503
  __query["ignore_unavailable"] = ignore_unavailable
483
- if indices_boost is not None:
484
- __body["indices_boost"] = indices_boost
485
504
  if lenient is not None:
486
505
  __query["lenient"] = lenient
487
506
  if max_concurrent_shard_requests is not None:
488
507
  __query["max_concurrent_shard_requests"] = max_concurrent_shard_requests
489
508
  if min_compatible_shard_node is not None:
490
509
  __query["min_compatible_shard_node"] = min_compatible_shard_node
491
- if min_score is not None:
492
- __body["min_score"] = min_score
493
- if pit is not None:
494
- __body["pit"] = pit
495
- if post_filter is not None:
496
- __body["post_filter"] = post_filter
497
510
  if pre_filter_shard_size is not None:
498
511
  __query["pre_filter_shard_size"] = pre_filter_shard_size
499
512
  if preference is not None:
500
513
  __query["preference"] = preference
501
514
  if pretty is not None:
502
515
  __query["pretty"] = pretty
503
- if profile is not None:
504
- __body["profile"] = profile
505
516
  if q is not None:
506
517
  __query["q"] = q
507
- if query is not None:
508
- __body["query"] = query
509
518
  if request_cache is not None:
510
519
  __query["request_cache"] = request_cache
511
- if rescore is not None:
512
- __body["rescore"] = rescore
513
520
  if rest_total_hits_as_int is not None:
514
521
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
515
522
  if routing is not None:
516
523
  __query["routing"] = routing
517
- if runtime_mappings is not None:
518
- __body["runtime_mappings"] = runtime_mappings
519
- if script_fields is not None:
520
- __body["script_fields"] = script_fields
521
524
  if scroll is not None:
522
525
  __query["scroll"] = scroll
523
- if search_after is not None:
524
- __body["search_after"] = search_after
525
526
  if search_type is not None:
526
527
  __query["search_type"] = search_type
527
- if seq_no_primary_term is not None:
528
- __body["seq_no_primary_term"] = seq_no_primary_term
529
- if size is not None:
530
- __body["size"] = size
531
- if slice is not None:
532
- __body["slice"] = slice
533
- if sort is not None:
534
- __body["sort"] = sort
535
- if source is not None:
536
- __body["_source"] = source
537
528
  if source_excludes is not None:
538
529
  __query["_source_excludes"] = source_excludes
539
530
  if source_includes is not None:
540
531
  __query["_source_includes"] = source_includes
541
- if stats is not None:
542
- __body["stats"] = stats
543
- if stored_fields is not None:
544
- __body["stored_fields"] = stored_fields
545
- if suggest is not None:
546
- __body["suggest"] = suggest
547
532
  if suggest_field is not None:
548
533
  __query["suggest_field"] = suggest_field
549
534
  if suggest_mode is not None:
@@ -552,20 +537,75 @@ class FleetClient(NamespacedClient):
552
537
  __query["suggest_size"] = suggest_size
553
538
  if suggest_text is not None:
554
539
  __query["suggest_text"] = suggest_text
555
- if terminate_after is not None:
556
- __body["terminate_after"] = terminate_after
557
- if timeout is not None:
558
- __body["timeout"] = timeout
559
- if track_scores is not None:
560
- __body["track_scores"] = track_scores
561
- if track_total_hits is not None:
562
- __body["track_total_hits"] = track_total_hits
563
540
  if typed_keys is not None:
564
541
  __query["typed_keys"] = typed_keys
565
- if version is not None:
566
- __body["version"] = version
567
542
  if wait_for_checkpoints is not None:
568
543
  __query["wait_for_checkpoints"] = wait_for_checkpoints
544
+ if not __body:
545
+ if aggregations is not None:
546
+ __body["aggregations"] = aggregations
547
+ if aggs is not None:
548
+ __body["aggs"] = aggs
549
+ if collapse is not None:
550
+ __body["collapse"] = collapse
551
+ if docvalue_fields is not None:
552
+ __body["docvalue_fields"] = docvalue_fields
553
+ if explain is not None:
554
+ __body["explain"] = explain
555
+ if ext is not None:
556
+ __body["ext"] = ext
557
+ if fields is not None:
558
+ __body["fields"] = fields
559
+ if from_ is not None:
560
+ __body["from"] = from_
561
+ if highlight is not None:
562
+ __body["highlight"] = highlight
563
+ if indices_boost is not None:
564
+ __body["indices_boost"] = indices_boost
565
+ if min_score is not None:
566
+ __body["min_score"] = min_score
567
+ if pit is not None:
568
+ __body["pit"] = pit
569
+ if post_filter is not None:
570
+ __body["post_filter"] = post_filter
571
+ if profile is not None:
572
+ __body["profile"] = profile
573
+ if query is not None:
574
+ __body["query"] = query
575
+ if rescore is not None:
576
+ __body["rescore"] = rescore
577
+ if runtime_mappings is not None:
578
+ __body["runtime_mappings"] = runtime_mappings
579
+ if script_fields is not None:
580
+ __body["script_fields"] = script_fields
581
+ if search_after is not None:
582
+ __body["search_after"] = search_after
583
+ if seq_no_primary_term is not None:
584
+ __body["seq_no_primary_term"] = seq_no_primary_term
585
+ if size is not None:
586
+ __body["size"] = size
587
+ if slice is not None:
588
+ __body["slice"] = slice
589
+ if sort is not None:
590
+ __body["sort"] = sort
591
+ if source is not None:
592
+ __body["_source"] = source
593
+ if stats is not None:
594
+ __body["stats"] = stats
595
+ if stored_fields is not None:
596
+ __body["stored_fields"] = stored_fields
597
+ if suggest is not None:
598
+ __body["suggest"] = suggest
599
+ if terminate_after is not None:
600
+ __body["terminate_after"] = terminate_after
601
+ if timeout is not None:
602
+ __body["timeout"] = timeout
603
+ if track_scores is not None:
604
+ __body["track_scores"] = track_scores
605
+ if track_total_hits is not None:
606
+ __body["track_total_hits"] = track_total_hits
607
+ if version is not None:
608
+ __body["version"] = version
569
609
  if not __body:
570
610
  __body = None # type: ignore[assignment]
571
611
  __headers = {"accept": "application/json"}
@@ -25,7 +25,7 @@ from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
25
25
 
26
26
  class GraphClient(NamespacedClient):
27
27
  @_rewrite_parameters(
28
- body_fields=True,
28
+ body_fields=("connections", "controls", "query", "vertices"),
29
29
  )
30
30
  async def explore(
31
31
  self,
@@ -41,12 +41,13 @@ class GraphClient(NamespacedClient):
41
41
  routing: t.Optional[str] = None,
42
42
  timeout: t.Optional[t.Union["t.Literal[-1]", "t.Literal[0]", str]] = None,
43
43
  vertices: t.Optional[t.Sequence[t.Mapping[str, t.Any]]] = None,
44
+ body: t.Optional[t.Dict[str, t.Any]] = None,
44
45
  ) -> ObjectApiResponse[t.Any]:
45
46
  """
46
47
  Explore extracted and summarized information about the documents and terms in
47
48
  an index.
48
49
 
49
- `<https://www.elastic.co/guide/en/elasticsearch/reference/8.11/graph-explore-api.html>`_
50
+ `<https://www.elastic.co/guide/en/elasticsearch/reference/8.12/graph-explore-api.html>`_
50
51
 
51
52
  :param index: Name of the index.
52
53
  :param connections: Specifies or more fields from which you want to extract terms
@@ -64,12 +65,8 @@ class GraphClient(NamespacedClient):
64
65
  if index in SKIP_IN_PATH:
65
66
  raise ValueError("Empty value passed for parameter 'index'")
66
67
  __path = f"/{_quote(index)}/_graph/explore"
67
- __body: t.Dict[str, t.Any] = {}
68
68
  __query: t.Dict[str, t.Any] = {}
69
- if connections is not None:
70
- __body["connections"] = connections
71
- if controls is not None:
72
- __body["controls"] = controls
69
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
73
70
  if error_trace is not None:
74
71
  __query["error_trace"] = error_trace
75
72
  if filter_path is not None:
@@ -78,14 +75,19 @@ class GraphClient(NamespacedClient):
78
75
  __query["human"] = human
79
76
  if pretty is not None:
80
77
  __query["pretty"] = pretty
81
- if query is not None:
82
- __body["query"] = query
83
78
  if routing is not None:
84
79
  __query["routing"] = routing
85
80
  if timeout is not None:
86
81
  __query["timeout"] = timeout
87
- if vertices is not None:
88
- __body["vertices"] = vertices
82
+ if not __body:
83
+ if connections is not None:
84
+ __body["connections"] = connections
85
+ if controls is not None:
86
+ __body["controls"] = controls
87
+ if query is not None:
88
+ __body["query"] = query
89
+ if vertices is not None:
90
+ __body["vertices"] = vertices
89
91
  if not __body:
90
92
  __body = None # type: ignore[assignment]
91
93
  __headers = {"accept": "application/json"}