elasticsearch 8.19.0__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 (61) hide show
  1. elasticsearch/_async/client/__init__.py +39 -55
  2. elasticsearch/_async/client/cat.py +605 -35
  3. elasticsearch/_async/client/cluster.py +7 -2
  4. elasticsearch/_async/client/connector.py +3 -3
  5. elasticsearch/_async/client/esql.py +16 -6
  6. elasticsearch/_async/client/fleet.py +1 -5
  7. elasticsearch/_async/client/graph.py +1 -5
  8. elasticsearch/_async/client/ilm.py +2 -10
  9. elasticsearch/_async/client/indices.py +159 -32
  10. elasticsearch/_async/client/inference.py +142 -120
  11. elasticsearch/_async/client/nodes.py +2 -2
  12. elasticsearch/_async/client/shutdown.py +5 -15
  13. elasticsearch/_async/client/slm.py +1 -5
  14. elasticsearch/_async/client/snapshot.py +262 -112
  15. elasticsearch/_async/client/sql.py +1 -1
  16. elasticsearch/_async/client/streams.py +185 -0
  17. elasticsearch/_async/client/transform.py +60 -0
  18. elasticsearch/_async/client/watcher.py +1 -5
  19. elasticsearch/_async/helpers.py +58 -9
  20. elasticsearch/_sync/client/__init__.py +39 -55
  21. elasticsearch/_sync/client/cat.py +605 -35
  22. elasticsearch/_sync/client/cluster.py +7 -2
  23. elasticsearch/_sync/client/connector.py +3 -3
  24. elasticsearch/_sync/client/esql.py +16 -6
  25. elasticsearch/_sync/client/fleet.py +1 -5
  26. elasticsearch/_sync/client/graph.py +1 -5
  27. elasticsearch/_sync/client/ilm.py +2 -10
  28. elasticsearch/_sync/client/indices.py +159 -32
  29. elasticsearch/_sync/client/inference.py +142 -120
  30. elasticsearch/_sync/client/nodes.py +2 -2
  31. elasticsearch/_sync/client/shutdown.py +5 -15
  32. elasticsearch/_sync/client/slm.py +1 -5
  33. elasticsearch/_sync/client/snapshot.py +262 -112
  34. elasticsearch/_sync/client/sql.py +1 -1
  35. elasticsearch/_sync/client/streams.py +185 -0
  36. elasticsearch/_sync/client/transform.py +60 -0
  37. elasticsearch/_sync/client/watcher.py +1 -5
  38. elasticsearch/_version.py +2 -1
  39. elasticsearch/client.py +2 -0
  40. elasticsearch/compat.py +45 -1
  41. elasticsearch/dsl/__init__.py +28 -0
  42. elasticsearch/dsl/_async/document.py +84 -0
  43. elasticsearch/dsl/_sync/document.py +84 -0
  44. elasticsearch/dsl/aggs.py +117 -0
  45. elasticsearch/dsl/document_base.py +59 -1
  46. elasticsearch/dsl/field.py +60 -10
  47. elasticsearch/dsl/query.py +1 -1
  48. elasticsearch/dsl/response/__init__.py +3 -0
  49. elasticsearch/dsl/response/aggs.py +1 -1
  50. elasticsearch/dsl/types.py +325 -20
  51. elasticsearch/dsl/utils.py +1 -1
  52. elasticsearch/esql/__init__.py +2 -1
  53. elasticsearch/esql/esql.py +85 -34
  54. elasticsearch/esql/functions.py +37 -25
  55. elasticsearch/helpers/__init__.py +10 -1
  56. elasticsearch/helpers/actions.py +106 -33
  57. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.2.dist-info}/METADATA +2 -4
  58. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.2.dist-info}/RECORD +61 -59
  59. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.2.dist-info}/WHEEL +0 -0
  60. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.2.dist-info}/licenses/LICENSE +0 -0
  61. {elasticsearch-8.19.0.dist-info → elasticsearch-8.19.2.dist-info}/licenses/NOTICE +0 -0
@@ -75,6 +75,7 @@ from .slm import SlmClient
75
75
  from .snapshot import SnapshotClient
76
76
  from .sql import SqlClient
77
77
  from .ssl import SslClient
78
+ from .streams import StreamsClient
78
79
  from .synonyms import SynonymsClient
79
80
  from .tasks import TasksClient
80
81
  from .text_structure import TextStructureClient
@@ -470,6 +471,7 @@ class Elasticsearch(BaseClient):
470
471
  self.shutdown = ShutdownClient(self)
471
472
  self.sql = SqlClient(self)
472
473
  self.ssl = SslClient(self)
474
+ self.streams = StreamsClient(self)
473
475
  self.synonyms = SynonymsClient(self)
474
476
  self.text_structure = TextStructureClient(self)
475
477
  self.transform = TransformClient(self)
@@ -698,6 +700,7 @@ class Elasticsearch(BaseClient):
698
700
  <li>JavaScript: Check out <code>client.helpers.*</code></li>
699
701
  <li>.NET: Check out <code>BulkAllObservable</code></li>
700
702
  <li>PHP: Check out bulk indexing.</li>
703
+ <li>Ruby: Check out <code>Elasticsearch::Helpers::BulkHelper</code></li>
701
704
  </ul>
702
705
  <p><strong>Submitting bulk requests with cURL</strong></p>
703
706
  <p>If you're providing text file input to <code>curl</code>, you must use the <code>--data-binary</code> flag instead of plain <code>-d</code>.
@@ -932,11 +935,7 @@ class Elasticsearch(BaseClient):
932
935
  if not __body:
933
936
  if id is not None:
934
937
  __body["id"] = id
935
- if not __body:
936
- __body = None # type: ignore[assignment]
937
- __headers = {"accept": "application/json"}
938
- if __body is not None:
939
- __headers["content-type"] = "application/json"
938
+ __headers = {"accept": "application/json", "content-type": "application/json"}
940
939
  return self.perform_request( # type: ignore[return-value]
941
940
  "DELETE",
942
941
  __path,
@@ -1009,8 +1008,8 @@ class Elasticsearch(BaseClient):
1009
1008
  This parameter can be used only when the `q` query string parameter is specified.
1010
1009
  :param analyzer: The analyzer to use for the query string. This parameter can
1011
1010
  be used only when the `q` query string parameter is specified.
1012
- :param default_operator: The default operator for query string query: `AND` or
1013
- `OR`. This parameter can be used only when the `q` query string parameter
1011
+ :param default_operator: The default operator for query string query: `and` or
1012
+ `or`. This parameter can be used only when the `q` query string parameter
1014
1013
  is specified.
1015
1014
  :param df: The field to use as a default when no field prefix is given in the
1016
1015
  query string. This parameter can be used only when the `q` query string parameter
@@ -1131,7 +1130,7 @@ class Elasticsearch(BaseClient):
1131
1130
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1132
1131
  version: t.Optional[int] = None,
1133
1132
  version_type: t.Optional[
1134
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1133
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1135
1134
  ] = None,
1136
1135
  wait_for_active_shards: t.Optional[
1137
1136
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1310,7 +1309,7 @@ class Elasticsearch(BaseClient):
1310
1309
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1311
1310
  version: t.Optional[int] = None,
1312
1311
  version_type: t.Optional[
1313
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1312
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1314
1313
  ] = None,
1315
1314
  wait_for_active_shards: t.Optional[
1316
1315
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1414,7 +1413,7 @@ class Elasticsearch(BaseClient):
1414
1413
  )
1415
1414
 
1416
1415
  @_rewrite_parameters(
1417
- body_fields=("max_docs", "query", "slice"),
1416
+ body_fields=("max_docs", "query", "slice", "sort"),
1418
1417
  parameter_aliases={"from": "from_"},
1419
1418
  )
1420
1419
  def delete_by_query(
@@ -1458,7 +1457,12 @@ class Elasticsearch(BaseClient):
1458
1457
  ] = None,
1459
1458
  slice: t.Optional[t.Mapping[str, t.Any]] = None,
1460
1459
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
1461
- sort: t.Optional[t.Sequence[str]] = None,
1460
+ sort: t.Optional[
1461
+ t.Union[
1462
+ t.Sequence[t.Union[str, t.Mapping[str, t.Any]]],
1463
+ t.Union[str, t.Mapping[str, t.Any]],
1464
+ ]
1465
+ ] = None,
1462
1466
  stats: t.Optional[t.Sequence[str]] = None,
1463
1467
  terminate_after: t.Optional[int] = None,
1464
1468
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -1550,8 +1554,8 @@ class Elasticsearch(BaseClient):
1550
1554
  used only when the `q` query string parameter is specified.
1551
1555
  :param conflicts: What to do if delete by query hits version conflicts: `abort`
1552
1556
  or `proceed`.
1553
- :param default_operator: The default operator for query string query: `AND` or
1554
- `OR`. This parameter can be used only when the `q` query string parameter
1557
+ :param default_operator: The default operator for query string query: `and` or
1558
+ `or`. This parameter can be used only when the `q` query string parameter
1555
1559
  is specified.
1556
1560
  :param df: The field to use as default where no field prefix is given in the
1557
1561
  query string. This parameter can be used only when the `q` query string parameter
@@ -1590,7 +1594,7 @@ class Elasticsearch(BaseClient):
1590
1594
  :param slice: Slice the request manually using the provided slice ID and total
1591
1595
  number of slices.
1592
1596
  :param slices: The number of slices this task should be divided into.
1593
- :param sort: A comma-separated list of `<field>:<direction>` pairs.
1597
+ :param sort: A sort object that specifies the order of deleted documents.
1594
1598
  :param stats: The specific `tag` of the request for logging and statistical purposes.
1595
1599
  :param terminate_after: The maximum number of documents to collect for each shard.
1596
1600
  If a query reaches this limit, Elasticsearch terminates the query early.
@@ -1680,8 +1684,6 @@ class Elasticsearch(BaseClient):
1680
1684
  __query["search_type"] = search_type
1681
1685
  if slices is not None:
1682
1686
  __query["slices"] = slices
1683
- if sort is not None:
1684
- __query["sort"] = sort
1685
1687
  if stats is not None:
1686
1688
  __query["stats"] = stats
1687
1689
  if terminate_after is not None:
@@ -1701,6 +1703,8 @@ class Elasticsearch(BaseClient):
1701
1703
  __body["query"] = query
1702
1704
  if slice is not None:
1703
1705
  __body["slice"] = slice
1706
+ if sort is not None:
1707
+ __body["sort"] = sort
1704
1708
  __headers = {"accept": "application/json", "content-type": "application/json"}
1705
1709
  return self.perform_request( # type: ignore[return-value]
1706
1710
  "POST",
@@ -1845,7 +1849,7 @@ class Elasticsearch(BaseClient):
1845
1849
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1846
1850
  version: t.Optional[int] = None,
1847
1851
  version_type: t.Optional[
1848
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1852
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1849
1853
  ] = None,
1850
1854
  ) -> HeadApiResponse:
1851
1855
  """
@@ -1974,7 +1978,7 @@ class Elasticsearch(BaseClient):
1974
1978
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1975
1979
  version: t.Optional[int] = None,
1976
1980
  version_type: t.Optional[
1977
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1981
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1978
1982
  ] = None,
1979
1983
  ) -> HeadApiResponse:
1980
1984
  """
@@ -2103,8 +2107,8 @@ class Elasticsearch(BaseClient):
2103
2107
  This parameter can be used only when the `q` query string parameter is specified.
2104
2108
  :param analyzer: The analyzer to use for the query string. This parameter can
2105
2109
  be used only when the `q` query string parameter is specified.
2106
- :param default_operator: The default operator for query string query: `AND` or
2107
- `OR`. This parameter can be used only when the `q` query string parameter
2110
+ :param default_operator: The default operator for query string query: `and` or
2111
+ `or`. This parameter can be used only when the `q` query string parameter
2108
2112
  is specified.
2109
2113
  :param df: The field to use as default where no field prefix is given in the
2110
2114
  query string. This parameter can be used only when the `q` query string parameter
@@ -2346,7 +2350,7 @@ class Elasticsearch(BaseClient):
2346
2350
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2347
2351
  version: t.Optional[int] = None,
2348
2352
  version_type: t.Optional[
2349
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2353
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2350
2354
  ] = None,
2351
2355
  ) -> ObjectApiResponse[t.Any]:
2352
2356
  """
@@ -2633,7 +2637,7 @@ class Elasticsearch(BaseClient):
2633
2637
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2634
2638
  version: t.Optional[int] = None,
2635
2639
  version_type: t.Optional[
2636
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2640
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2637
2641
  ] = None,
2638
2642
  ) -> ObjectApiResponse[t.Any]:
2639
2643
  """
@@ -2813,7 +2817,7 @@ class Elasticsearch(BaseClient):
2813
2817
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2814
2818
  version: t.Optional[int] = None,
2815
2819
  version_type: t.Optional[
2816
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2820
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2817
2821
  ] = None,
2818
2822
  wait_for_active_shards: t.Optional[
2819
2823
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -3177,11 +3181,7 @@ class Elasticsearch(BaseClient):
3177
3181
  __body["_source"] = source
3178
3182
  if stored_fields is not None:
3179
3183
  __body["stored_fields"] = stored_fields
3180
- if not __body:
3181
- __body = None # type: ignore[assignment]
3182
- __headers = {"accept": "application/json"}
3183
- if __body is not None:
3184
- __headers["content-type"] = "application/json"
3184
+ __headers = {"accept": "application/json", "content-type": "application/json"}
3185
3185
  return self.perform_request( # type: ignore[return-value]
3186
3186
  "POST",
3187
3187
  __path,
@@ -3606,7 +3606,7 @@ class Elasticsearch(BaseClient):
3606
3606
  term_statistics: t.Optional[bool] = None,
3607
3607
  version: t.Optional[int] = None,
3608
3608
  version_type: t.Optional[
3609
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
3609
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
3610
3610
  ] = None,
3611
3611
  body: t.Optional[t.Dict[str, t.Any]] = None,
3612
3612
  ) -> ObjectApiResponse[t.Any]:
@@ -4016,7 +4016,7 @@ class Elasticsearch(BaseClient):
4016
4016
  )
4017
4017
 
4018
4018
  @_rewrite_parameters(
4019
- body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"),
4019
+ body_fields=("dest", "source", "conflicts", "max_docs", "script"),
4020
4020
  )
4021
4021
  def reindex(
4022
4022
  self,
@@ -4034,7 +4034,6 @@ class Elasticsearch(BaseClient):
4034
4034
  require_alias: t.Optional[bool] = None,
4035
4035
  script: t.Optional[t.Mapping[str, t.Any]] = None,
4036
4036
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4037
- size: t.Optional[int] = None,
4038
4037
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
4039
4038
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
4040
4039
  wait_for_active_shards: t.Optional[
@@ -4206,7 +4205,6 @@ class Elasticsearch(BaseClient):
4206
4205
  reindexing.
4207
4206
  :param scroll: The period of time that a consistent view of the index should
4208
4207
  be maintained for scrolled search.
4209
- :param size:
4210
4208
  :param slices: The number of slices this task should be divided into. It defaults
4211
4209
  to one slice, which means the task isn't sliced into subtasks. Reindex supports
4212
4210
  sliced scroll to parallelize the reindexing process. This parallelization
@@ -4271,8 +4269,6 @@ class Elasticsearch(BaseClient):
4271
4269
  __body["max_docs"] = max_docs
4272
4270
  if script is not None:
4273
4271
  __body["script"] = script
4274
- if size is not None:
4275
- __body["size"] = size
4276
4272
  __headers = {"accept": "application/json", "content-type": "application/json"}
4277
4273
  return self.perform_request( # type: ignore[return-value]
4278
4274
  "POST",
@@ -4399,11 +4395,7 @@ class Elasticsearch(BaseClient):
4399
4395
  __body["params"] = params
4400
4396
  if source is not None:
4401
4397
  __body["source"] = source
4402
- if not __body:
4403
- __body = None # type: ignore[assignment]
4404
- __headers = {"accept": "application/json"}
4405
- if __body is not None:
4406
- __headers["content-type"] = "application/json"
4398
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4407
4399
  return self.perform_request( # type: ignore[return-value]
4408
4400
  "POST",
4409
4401
  __path,
@@ -4486,11 +4478,7 @@ class Elasticsearch(BaseClient):
4486
4478
  __body["context_setup"] = context_setup
4487
4479
  if script is not None:
4488
4480
  __body["script"] = script
4489
- if not __body:
4490
- __body = None # type: ignore[assignment]
4491
- __headers = {"accept": "application/json"}
4492
- if __body is not None:
4493
- __headers["content-type"] = "application/json"
4481
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4494
4482
  return self.perform_request( # type: ignore[return-value]
4495
4483
  "POST",
4496
4484
  __path,
@@ -4766,8 +4754,8 @@ class Elasticsearch(BaseClient):
4766
4754
  node and the remote clusters are minimized when running cross-cluster search
4767
4755
  (CCS) requests.
4768
4756
  :param collapse: Collapses search results the values of the specified field.
4769
- :param default_operator: The default operator for the query string query: `AND`
4770
- or `OR`. This parameter can be used only when the `q` query string parameter
4757
+ :param default_operator: The default operator for the query string query: `and`
4758
+ or `or`. This parameter can be used only when the `q` query string parameter
4771
4759
  is specified.
4772
4760
  :param df: The field to use as a default when no field prefix is given in the
4773
4761
  query string. This parameter can be used only when the `q` query string parameter
@@ -5969,11 +5957,7 @@ class Elasticsearch(BaseClient):
5969
5957
  __body["string"] = string
5970
5958
  if timeout is not None:
5971
5959
  __body["timeout"] = timeout
5972
- if not __body:
5973
- __body = None # type: ignore[assignment]
5974
- __headers = {"accept": "application/json"}
5975
- if __body is not None:
5976
- __headers["content-type"] = "application/json"
5960
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5977
5961
  return self.perform_request( # type: ignore[return-value]
5978
5962
  "POST",
5979
5963
  __path,
@@ -6008,7 +5992,7 @@ class Elasticsearch(BaseClient):
6008
5992
  doc: t.Optional[t.Mapping[str, t.Any]] = None,
6009
5993
  error_trace: t.Optional[bool] = None,
6010
5994
  field_statistics: t.Optional[bool] = None,
6011
- fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
5995
+ fields: t.Optional[t.Sequence[str]] = None,
6012
5996
  filter: t.Optional[t.Mapping[str, t.Any]] = None,
6013
5997
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
6014
5998
  human: t.Optional[bool] = None,
@@ -6023,7 +6007,7 @@ class Elasticsearch(BaseClient):
6023
6007
  term_statistics: t.Optional[bool] = None,
6024
6008
  version: t.Optional[int] = None,
6025
6009
  version_type: t.Optional[
6026
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
6010
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
6027
6011
  ] = None,
6028
6012
  body: t.Optional[t.Dict[str, t.Any]] = None,
6029
6013
  ) -> ObjectApiResponse[t.Any]:
@@ -6489,8 +6473,8 @@ class Elasticsearch(BaseClient):
6489
6473
  be used only when the `q` query string parameter is specified.
6490
6474
  :param conflicts: The preferred behavior when update by query hits version conflicts:
6491
6475
  `abort` or `proceed`.
6492
- :param default_operator: The default operator for query string query: `AND` or
6493
- `OR`. This parameter can be used only when the `q` query string parameter
6476
+ :param default_operator: The default operator for query string query: `and` or
6477
+ `or`. This parameter can be used only when the `q` query string parameter
6494
6478
  is specified.
6495
6479
  :param df: The field to use as default where no field prefix is given in the
6496
6480
  query string. This parameter can be used only when the `q` query string parameter