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
@@ -78,11 +78,7 @@ class InferenceClient(NamespacedClient):
78
78
  __body["input"] = input
79
79
  if task_settings is not None:
80
80
  __body["task_settings"] = task_settings
81
- if not __body:
82
- __body = None # type: ignore[assignment]
83
- __headers = {"accept": "application/json"}
84
- if __body is not None:
85
- __headers["content-type"] = "application/json"
81
+ __headers = {"accept": "application/json", "content-type": "application/json"}
86
82
  return self.perform_request( # type: ignore[return-value]
87
83
  "POST",
88
84
  __path,
@@ -338,11 +334,7 @@ class InferenceClient(NamespacedClient):
338
334
  __body["query"] = query
339
335
  if task_settings is not None:
340
336
  __body["task_settings"] = task_settings
341
- if not __body:
342
- __body = None # type: ignore[assignment]
343
- __headers = {"accept": "application/json"}
344
- if __body is not None:
345
- __headers["content-type"] = "application/json"
337
+ __headers = {"accept": "application/json", "content-type": "application/json"}
346
338
  return self.perform_request( # type: ignore[return-value]
347
339
  "POST",
348
340
  __path,
@@ -546,11 +538,7 @@ class InferenceClient(NamespacedClient):
546
538
  __body["chunking_settings"] = chunking_settings
547
539
  if task_settings is not None:
548
540
  __body["task_settings"] = task_settings
549
- if not __body:
550
- __body = None # type: ignore[assignment]
551
- __headers = {"accept": "application/json"}
552
- if __body is not None:
553
- __headers["content-type"] = "application/json"
541
+ __headers = {"accept": "application/json", "content-type": "application/json"}
554
542
  return self.perform_request( # type: ignore[return-value]
555
543
  "PUT",
556
544
  __path,
@@ -646,11 +634,7 @@ class InferenceClient(NamespacedClient):
646
634
  __body["chunking_settings"] = chunking_settings
647
635
  if task_settings is not None:
648
636
  __body["task_settings"] = task_settings
649
- if not __body:
650
- __body = None # type: ignore[assignment]
651
- __headers = {"accept": "application/json"}
652
- if __body is not None:
653
- __headers["content-type"] = "application/json"
637
+ __headers = {"accept": "application/json", "content-type": "application/json"}
654
638
  return self.perform_request( # type: ignore[return-value]
655
639
  "PUT",
656
640
  __path,
@@ -752,11 +736,7 @@ class InferenceClient(NamespacedClient):
752
736
  __body["chunking_settings"] = chunking_settings
753
737
  if task_settings is not None:
754
738
  __body["task_settings"] = task_settings
755
- if not __body:
756
- __body = None # type: ignore[assignment]
757
- __headers = {"accept": "application/json"}
758
- if __body is not None:
759
- __headers["content-type"] = "application/json"
739
+ __headers = {"accept": "application/json", "content-type": "application/json"}
760
740
  return self.perform_request( # type: ignore[return-value]
761
741
  "PUT",
762
742
  __path,
@@ -849,11 +829,7 @@ class InferenceClient(NamespacedClient):
849
829
  __body["chunking_settings"] = chunking_settings
850
830
  if task_settings is not None:
851
831
  __body["task_settings"] = task_settings
852
- if not __body:
853
- __body = None # type: ignore[assignment]
854
- __headers = {"accept": "application/json"}
855
- if __body is not None:
856
- __headers["content-type"] = "application/json"
832
+ __headers = {"accept": "application/json", "content-type": "application/json"}
857
833
  return self.perform_request( # type: ignore[return-value]
858
834
  "PUT",
859
835
  __path,
@@ -945,11 +921,7 @@ class InferenceClient(NamespacedClient):
945
921
  __body["chunking_settings"] = chunking_settings
946
922
  if task_settings is not None:
947
923
  __body["task_settings"] = task_settings
948
- if not __body:
949
- __body = None # type: ignore[assignment]
950
- __headers = {"accept": "application/json"}
951
- if __body is not None:
952
- __headers["content-type"] = "application/json"
924
+ __headers = {"accept": "application/json", "content-type": "application/json"}
953
925
  return self.perform_request( # type: ignore[return-value]
954
926
  "PUT",
955
927
  __path,
@@ -1049,11 +1021,7 @@ class InferenceClient(NamespacedClient):
1049
1021
  __body["chunking_settings"] = chunking_settings
1050
1022
  if task_settings is not None:
1051
1023
  __body["task_settings"] = task_settings
1052
- if not __body:
1053
- __body = None # type: ignore[assignment]
1054
- __headers = {"accept": "application/json"}
1055
- if __body is not None:
1056
- __headers["content-type"] = "application/json"
1024
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1057
1025
  return self.perform_request( # type: ignore[return-value]
1058
1026
  "PUT",
1059
1027
  __path,
@@ -1143,11 +1111,7 @@ class InferenceClient(NamespacedClient):
1143
1111
  __body["chunking_settings"] = chunking_settings
1144
1112
  if task_settings is not None:
1145
1113
  __body["task_settings"] = task_settings
1146
- if not __body:
1147
- __body = None # type: ignore[assignment]
1148
- __headers = {"accept": "application/json"}
1149
- if __body is not None:
1150
- __headers["content-type"] = "application/json"
1114
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1151
1115
  return self.perform_request( # type: ignore[return-value]
1152
1116
  "PUT",
1153
1117
  __path,
@@ -1274,11 +1238,7 @@ class InferenceClient(NamespacedClient):
1274
1238
  __body["chunking_settings"] = chunking_settings
1275
1239
  if task_settings is not None:
1276
1240
  __body["task_settings"] = task_settings
1277
- if not __body:
1278
- __body = None # type: ignore[assignment]
1279
- __headers = {"accept": "application/json"}
1280
- if __body is not None:
1281
- __headers["content-type"] = "application/json"
1241
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1282
1242
  return self.perform_request( # type: ignore[return-value]
1283
1243
  "PUT",
1284
1244
  __path,
@@ -1358,11 +1318,7 @@ class InferenceClient(NamespacedClient):
1358
1318
  __body["service_settings"] = service_settings
1359
1319
  if chunking_settings is not None:
1360
1320
  __body["chunking_settings"] = chunking_settings
1361
- if not __body:
1362
- __body = None # type: ignore[assignment]
1363
- __headers = {"accept": "application/json"}
1364
- if __body is not None:
1365
- __headers["content-type"] = "application/json"
1321
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1366
1322
  return self.perform_request( # type: ignore[return-value]
1367
1323
  "PUT",
1368
1324
  __path,
@@ -1470,11 +1426,7 @@ class InferenceClient(NamespacedClient):
1470
1426
  __body["chunking_settings"] = chunking_settings
1471
1427
  if task_settings is not None:
1472
1428
  __body["task_settings"] = task_settings
1473
- if not __body:
1474
- __body = None # type: ignore[assignment]
1475
- __headers = {"accept": "application/json"}
1476
- if __body is not None:
1477
- __headers["content-type"] = "application/json"
1429
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1478
1430
  return self.perform_request( # type: ignore[return-value]
1479
1431
  "PUT",
1480
1432
  __path,
@@ -1568,11 +1520,7 @@ class InferenceClient(NamespacedClient):
1568
1520
  __body["service_settings"] = service_settings
1569
1521
  if chunking_settings is not None:
1570
1522
  __body["chunking_settings"] = chunking_settings
1571
- if not __body:
1572
- __body = None # type: ignore[assignment]
1573
- __headers = {"accept": "application/json"}
1574
- if __body is not None:
1575
- __headers["content-type"] = "application/json"
1523
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1576
1524
  return self.perform_request( # type: ignore[return-value]
1577
1525
  "PUT",
1578
1526
  __path,
@@ -1654,11 +1602,7 @@ class InferenceClient(NamespacedClient):
1654
1602
  __body["service_settings"] = service_settings
1655
1603
  if chunking_settings is not None:
1656
1604
  __body["chunking_settings"] = chunking_settings
1657
- if not __body:
1658
- __body = None # type: ignore[assignment]
1659
- __headers = {"accept": "application/json"}
1660
- if __body is not None:
1661
- __headers["content-type"] = "application/json"
1605
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1662
1606
  return self.perform_request( # type: ignore[return-value]
1663
1607
  "PUT",
1664
1608
  __path,
@@ -1752,11 +1696,7 @@ class InferenceClient(NamespacedClient):
1752
1696
  __body["chunking_settings"] = chunking_settings
1753
1697
  if task_settings is not None:
1754
1698
  __body["task_settings"] = task_settings
1755
- if not __body:
1756
- __body = None # type: ignore[assignment]
1757
- __headers = {"accept": "application/json"}
1758
- if __body is not None:
1759
- __headers["content-type"] = "application/json"
1699
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1760
1700
  return self.perform_request( # type: ignore[return-value]
1761
1701
  "PUT",
1762
1702
  __path,
@@ -1884,11 +1824,7 @@ class InferenceClient(NamespacedClient):
1884
1824
  __body["chunking_settings"] = chunking_settings
1885
1825
  if task_settings is not None:
1886
1826
  __body["task_settings"] = task_settings
1887
- if not __body:
1888
- __body = None # type: ignore[assignment]
1889
- __headers = {"accept": "application/json"}
1890
- if __body is not None:
1891
- __headers["content-type"] = "application/json"
1827
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1892
1828
  return self.perform_request( # type: ignore[return-value]
1893
1829
  "PUT",
1894
1830
  __path,
@@ -1980,11 +1916,7 @@ class InferenceClient(NamespacedClient):
1980
1916
  __body["chunking_settings"] = chunking_settings
1981
1917
  if task_settings is not None:
1982
1918
  __body["task_settings"] = task_settings
1983
- if not __body:
1984
- __body = None # type: ignore[assignment]
1985
- __headers = {"accept": "application/json"}
1986
- if __body is not None:
1987
- __headers["content-type"] = "application/json"
1919
+ __headers = {"accept": "application/json", "content-type": "application/json"}
1988
1920
  return self.perform_request( # type: ignore[return-value]
1989
1921
  "PUT",
1990
1922
  __path,
@@ -2066,11 +1998,7 @@ class InferenceClient(NamespacedClient):
2066
1998
  __body["service_settings"] = service_settings
2067
1999
  if chunking_settings is not None:
2068
2000
  __body["chunking_settings"] = chunking_settings
2069
- if not __body:
2070
- __body = None # type: ignore[assignment]
2071
- __headers = {"accept": "application/json"}
2072
- if __body is not None:
2073
- __headers["content-type"] = "application/json"
2001
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2074
2002
  return self.perform_request( # type: ignore[return-value]
2075
2003
  "PUT",
2076
2004
  __path,
@@ -2164,11 +2092,7 @@ class InferenceClient(NamespacedClient):
2164
2092
  __body["chunking_settings"] = chunking_settings
2165
2093
  if task_settings is not None:
2166
2094
  __body["task_settings"] = task_settings
2167
- if not __body:
2168
- __body = None # type: ignore[assignment]
2169
- __headers = {"accept": "application/json"}
2170
- if __body is not None:
2171
- __headers["content-type"] = "application/json"
2095
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2172
2096
  return self.perform_request( # type: ignore[return-value]
2173
2097
  "PUT",
2174
2098
  __path,
@@ -2259,11 +2183,7 @@ class InferenceClient(NamespacedClient):
2259
2183
  __body["chunking_settings"] = chunking_settings
2260
2184
  if task_settings is not None:
2261
2185
  __body["task_settings"] = task_settings
2262
- if not __body:
2263
- __body = None # type: ignore[assignment]
2264
- __headers = {"accept": "application/json"}
2265
- if __body is not None:
2266
- __headers["content-type"] = "application/json"
2186
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2267
2187
  return self.perform_request( # type: ignore[return-value]
2268
2188
  "PUT",
2269
2189
  __path,
@@ -2342,11 +2262,7 @@ class InferenceClient(NamespacedClient):
2342
2262
  __body["service"] = service
2343
2263
  if service_settings is not None:
2344
2264
  __body["service_settings"] = service_settings
2345
- if not __body:
2346
- __body = None # type: ignore[assignment]
2347
- __headers = {"accept": "application/json"}
2348
- if __body is not None:
2349
- __headers["content-type"] = "application/json"
2265
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2350
2266
  return self.perform_request( # type: ignore[return-value]
2351
2267
  "PUT",
2352
2268
  __path,
@@ -2419,11 +2335,7 @@ class InferenceClient(NamespacedClient):
2419
2335
  __body["query"] = query
2420
2336
  if task_settings is not None:
2421
2337
  __body["task_settings"] = task_settings
2422
- if not __body:
2423
- __body = None # type: ignore[assignment]
2424
- __headers = {"accept": "application/json"}
2425
- if __body is not None:
2426
- __headers["content-type"] = "application/json"
2338
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2427
2339
  return self.perform_request( # type: ignore[return-value]
2428
2340
  "POST",
2429
2341
  __path,
@@ -2487,11 +2399,7 @@ class InferenceClient(NamespacedClient):
2487
2399
  __body["input"] = input
2488
2400
  if task_settings is not None:
2489
2401
  __body["task_settings"] = task_settings
2490
- if not __body:
2491
- __body = None # type: ignore[assignment]
2492
- __headers = {"accept": "application/json"}
2493
- if __body is not None:
2494
- __headers["content-type"] = "application/json"
2402
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2495
2403
  return self.perform_request( # type: ignore[return-value]
2496
2404
  "POST",
2497
2405
  __path,
@@ -2503,7 +2411,7 @@ class InferenceClient(NamespacedClient):
2503
2411
  )
2504
2412
 
2505
2413
  @_rewrite_parameters(
2506
- body_fields=("input", "task_settings"),
2414
+ body_fields=("input", "input_type", "task_settings"),
2507
2415
  )
2508
2416
  def text_embedding(
2509
2417
  self,
@@ -2513,6 +2421,7 @@ class InferenceClient(NamespacedClient):
2513
2421
  error_trace: t.Optional[bool] = None,
2514
2422
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2515
2423
  human: t.Optional[bool] = None,
2424
+ input_type: t.Optional[str] = None,
2516
2425
  pretty: t.Optional[bool] = None,
2517
2426
  task_settings: t.Optional[t.Any] = None,
2518
2427
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -2528,6 +2437,13 @@ class InferenceClient(NamespacedClient):
2528
2437
 
2529
2438
  :param inference_id: The inference Id
2530
2439
  :param input: Inference input. Either a string or an array of strings.
2440
+ :param input_type: The input data type for the text embedding model. Possible
2441
+ values include: * `SEARCH` * `INGEST` * `CLASSIFICATION` * `CLUSTERING` Not
2442
+ all services support all values. Unsupported values will trigger a validation
2443
+ exception. Accepted values depend on the configured inference service, refer
2444
+ to the relevant service-specific documentation for more info. > info > The
2445
+ `input_type` parameter specified on the root level of the request body will
2446
+ take precedence over the `input_type` parameter specified in `task_settings`.
2531
2447
  :param task_settings: Optional task settings
2532
2448
  :param timeout: Specifies the amount of time to wait for the inference request
2533
2449
  to complete.
@@ -2553,13 +2469,11 @@ class InferenceClient(NamespacedClient):
2553
2469
  if not __body:
2554
2470
  if input is not None:
2555
2471
  __body["input"] = input
2472
+ if input_type is not None:
2473
+ __body["input_type"] = input_type
2556
2474
  if task_settings is not None:
2557
2475
  __body["task_settings"] = task_settings
2558
- if not __body:
2559
- __body = None # type: ignore[assignment]
2560
- __headers = {"accept": "application/json"}
2561
- if __body is not None:
2562
- __headers["content-type"] = "application/json"
2476
+ __headers = {"accept": "application/json", "content-type": "application/json"}
2563
2477
  return self.perform_request( # type: ignore[return-value]
2564
2478
  "POST",
2565
2479
  __path,
@@ -405,8 +405,8 @@ class NodesClient(NamespacedClient):
405
405
  are requested).
406
406
  :param include_unloaded_segments: If `true`, the response includes information
407
407
  from segments that are not loaded into memory.
408
- :param level: Indicates whether statistics are aggregated at the cluster, index,
409
- or shard level.
408
+ :param level: Indicates whether statistics are aggregated at the node, indices,
409
+ or shards level.
410
410
  :param timeout: Period to wait for a response. If no response is received before
411
411
  the timeout expires, the request fails and returns an error.
412
412
  :param types: A comma-separated list of document types for the indexing index
@@ -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
  """
@@ -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,
@@ -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
+ )
@@ -550,11 +550,7 @@ class WatcherClient(NamespacedClient):
550
550
  __body["transform"] = transform
551
551
  if trigger is not None:
552
552
  __body["trigger"] = trigger
553
- if not __body:
554
- __body = None # type: ignore[assignment]
555
- __headers = {"accept": "application/json"}
556
- if __body is not None:
557
- __headers["content-type"] = "application/json"
553
+ __headers = {"accept": "application/json", "content-type": "application/json"}
558
554
  return self.perform_request( # type: ignore[return-value]
559
555
  "PUT",
560
556
  __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__ = "8.19.1"
18
+ __versionstr__ = "8.19.2"
19
+ __es_specification_commit__ = "f4816bb41c52c1bfda93c48191f0a0e4e2d575be"
elasticsearch/client.py CHANGED
@@ -62,6 +62,7 @@ from ._sync.client.slm import SlmClient as SlmClient # noqa: F401
62
62
  from ._sync.client.snapshot import SnapshotClient as SnapshotClient # noqa: F401
63
63
  from ._sync.client.sql import SqlClient as SqlClient # noqa: F401
64
64
  from ._sync.client.ssl import SslClient as SslClient # noqa: F401
65
+ from ._sync.client.streams import StreamsClient as StreamsClient # noqa: F401
65
66
  from ._sync.client.synonyms import SynonymsClient as SynonymsClient # noqa: F401
66
67
  from ._sync.client.tasks import TasksClient as TasksClient # noqa: F401
67
68
  from ._sync.client.text_structure import ( # noqa: F401
@@ -115,6 +116,7 @@ __all__ = [
115
116
  "SnapshotClient",
116
117
  "SqlClient",
117
118
  "SslClient",
119
+ "StreamsClient",
118
120
  "TasksClient",
119
121
  "TextStructureClient",
120
122
  "TransformClient",