elasticsearch 9.1.1__py3-none-any.whl → 9.2.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 (76) hide show
  1. elasticsearch/_async/client/__init__.py +96 -44
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/cat.py +489 -26
  4. elasticsearch/_async/client/cluster.py +9 -8
  5. elasticsearch/_async/client/connector.py +3 -3
  6. elasticsearch/_async/client/eql.py +7 -0
  7. elasticsearch/_async/client/esql.py +26 -3
  8. elasticsearch/_async/client/fleet.py +1 -5
  9. elasticsearch/_async/client/graph.py +1 -5
  10. elasticsearch/_async/client/ilm.py +2 -10
  11. elasticsearch/_async/client/indices.py +181 -37
  12. elasticsearch/_async/client/inference.py +291 -124
  13. elasticsearch/_async/client/ingest.py +8 -0
  14. elasticsearch/_async/client/license.py +4 -2
  15. elasticsearch/_async/client/logstash.py +3 -1
  16. elasticsearch/_async/client/ml.py +2 -2
  17. elasticsearch/_async/client/nodes.py +3 -5
  18. elasticsearch/_async/client/project.py +67 -0
  19. elasticsearch/_async/client/security.py +39 -0
  20. elasticsearch/_async/client/shutdown.py +5 -15
  21. elasticsearch/_async/client/simulate.py +8 -0
  22. elasticsearch/_async/client/slm.py +1 -5
  23. elasticsearch/_async/client/snapshot.py +20 -10
  24. elasticsearch/_async/client/sql.py +7 -0
  25. elasticsearch/_async/client/streams.py +185 -0
  26. elasticsearch/_async/client/watcher.py +1 -5
  27. elasticsearch/_async/helpers.py +74 -12
  28. elasticsearch/_sync/client/__init__.py +96 -44
  29. elasticsearch/_sync/client/async_search.py +7 -0
  30. elasticsearch/_sync/client/cat.py +489 -26
  31. elasticsearch/_sync/client/cluster.py +9 -8
  32. elasticsearch/_sync/client/connector.py +3 -3
  33. elasticsearch/_sync/client/eql.py +7 -0
  34. elasticsearch/_sync/client/esql.py +26 -3
  35. elasticsearch/_sync/client/fleet.py +1 -5
  36. elasticsearch/_sync/client/graph.py +1 -5
  37. elasticsearch/_sync/client/ilm.py +2 -10
  38. elasticsearch/_sync/client/indices.py +181 -37
  39. elasticsearch/_sync/client/inference.py +291 -124
  40. elasticsearch/_sync/client/ingest.py +8 -0
  41. elasticsearch/_sync/client/license.py +4 -2
  42. elasticsearch/_sync/client/logstash.py +3 -1
  43. elasticsearch/_sync/client/ml.py +2 -2
  44. elasticsearch/_sync/client/nodes.py +3 -5
  45. elasticsearch/_sync/client/project.py +67 -0
  46. elasticsearch/_sync/client/security.py +39 -0
  47. elasticsearch/_sync/client/shutdown.py +5 -15
  48. elasticsearch/_sync/client/simulate.py +8 -0
  49. elasticsearch/_sync/client/slm.py +1 -5
  50. elasticsearch/_sync/client/snapshot.py +20 -10
  51. elasticsearch/_sync/client/sql.py +7 -0
  52. elasticsearch/_sync/client/streams.py +185 -0
  53. elasticsearch/_sync/client/watcher.py +1 -5
  54. elasticsearch/_version.py +2 -1
  55. elasticsearch/client.py +4 -0
  56. elasticsearch/compat.py +30 -1
  57. elasticsearch/dsl/__init__.py +28 -0
  58. elasticsearch/dsl/_async/document.py +2 -1
  59. elasticsearch/dsl/_sync/document.py +2 -1
  60. elasticsearch/dsl/aggs.py +97 -0
  61. elasticsearch/dsl/document_base.py +53 -13
  62. elasticsearch/dsl/field.py +21 -2
  63. elasticsearch/dsl/pydantic.py +152 -0
  64. elasticsearch/dsl/query.py +5 -1
  65. elasticsearch/dsl/response/__init__.py +3 -0
  66. elasticsearch/dsl/search_base.py +5 -1
  67. elasticsearch/dsl/types.py +226 -14
  68. elasticsearch/esql/esql.py +331 -41
  69. elasticsearch/esql/functions.py +88 -0
  70. elasticsearch/helpers/__init__.py +10 -1
  71. elasticsearch/helpers/actions.py +106 -33
  72. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +27 -5
  73. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +76 -71
  74. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
  75. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
  76. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/NOTICE +0 -0
@@ -63,6 +63,7 @@ from .migration import MigrationClient
63
63
  from .ml import MlClient
64
64
  from .monitoring import MonitoringClient
65
65
  from .nodes import NodesClient
66
+ from .project import ProjectClient
66
67
  from .query_rules import QueryRulesClient
67
68
  from .rollup import RollupClient
68
69
  from .search_application import SearchApplicationClient
@@ -74,6 +75,7 @@ from .slm import SlmClient
74
75
  from .snapshot import SnapshotClient
75
76
  from .sql import SqlClient
76
77
  from .ssl import SslClient
78
+ from .streams import StreamsClient
77
79
  from .synonyms import SynonymsClient
78
80
  from .tasks import TasksClient
79
81
  from .text_structure import TextStructureClient
@@ -368,6 +370,7 @@ class AsyncElasticsearch(BaseClient):
368
370
  self.migration = MigrationClient(self)
369
371
  self.ml = MlClient(self)
370
372
  self.monitoring = MonitoringClient(self)
373
+ self.project = ProjectClient(self)
371
374
  self.query_rules = QueryRulesClient(self)
372
375
  self.rollup = RollupClient(self)
373
376
  self.search_application = SearchApplicationClient(self)
@@ -378,6 +381,7 @@ class AsyncElasticsearch(BaseClient):
378
381
  self.shutdown = ShutdownClient(self)
379
382
  self.sql = SqlClient(self)
380
383
  self.ssl = SslClient(self)
384
+ self.streams = StreamsClient(self)
381
385
  self.synonyms = SynonymsClient(self)
382
386
  self.text_structure = TextStructureClient(self)
383
387
  self.transform = TransformClient(self)
@@ -845,11 +849,7 @@ class AsyncElasticsearch(BaseClient):
845
849
  if not __body:
846
850
  if id is not None:
847
851
  __body["id"] = id
848
- if not __body:
849
- __body = None # type: ignore[assignment]
850
- __headers = {"accept": "application/json"}
851
- if __body is not None:
852
- __headers["content-type"] = "application/json"
852
+ __headers = {"accept": "application/json", "content-type": "application/json"}
853
853
  return await self.perform_request( # type: ignore[return-value]
854
854
  "DELETE",
855
855
  __path,
@@ -889,6 +889,7 @@ class AsyncElasticsearch(BaseClient):
889
889
  min_score: t.Optional[float] = None,
890
890
  preference: t.Optional[str] = None,
891
891
  pretty: t.Optional[bool] = None,
892
+ project_routing: t.Optional[str] = None,
892
893
  q: t.Optional[str] = None,
893
894
  query: t.Optional[t.Mapping[str, t.Any]] = None,
894
895
  routing: t.Optional[str] = None,
@@ -922,8 +923,8 @@ class AsyncElasticsearch(BaseClient):
922
923
  This parameter can be used only when the `q` query string parameter is specified.
923
924
  :param analyzer: The analyzer to use for the query string. This parameter can
924
925
  be used only when the `q` query string parameter is specified.
925
- :param default_operator: The default operator for query string query: `AND` or
926
- `OR`. This parameter can be used only when the `q` query string parameter
926
+ :param default_operator: The default operator for query string query: `and` or
927
+ `or`. This parameter can be used only when the `q` query string parameter
927
928
  is specified.
928
929
  :param df: The field to use as a default when no field prefix is given in the
929
930
  query string. This parameter can be used only when the `q` query string parameter
@@ -943,6 +944,10 @@ class AsyncElasticsearch(BaseClient):
943
944
  in the result.
944
945
  :param preference: The node or shard the operation should be performed on. By
945
946
  default, it is random.
947
+ :param project_routing: Specifies a subset of projects to target for the search
948
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
949
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
950
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
946
951
  :param q: The query in Lucene query string syntax. This parameter cannot be used
947
952
  with a request body.
948
953
  :param query: Defines the search query using Query DSL. A request body query
@@ -995,6 +1000,8 @@ class AsyncElasticsearch(BaseClient):
995
1000
  __query["preference"] = preference
996
1001
  if pretty is not None:
997
1002
  __query["pretty"] = pretty
1003
+ if project_routing is not None:
1004
+ __query["project_routing"] = project_routing
998
1005
  if q is not None:
999
1006
  __query["q"] = q
1000
1007
  if routing is not None:
@@ -1044,7 +1051,7 @@ class AsyncElasticsearch(BaseClient):
1044
1051
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1045
1052
  version: t.Optional[int] = None,
1046
1053
  version_type: t.Optional[
1047
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1054
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1048
1055
  ] = None,
1049
1056
  wait_for_active_shards: t.Optional[
1050
1057
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1223,7 +1230,7 @@ class AsyncElasticsearch(BaseClient):
1223
1230
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1224
1231
  version: t.Optional[int] = None,
1225
1232
  version_type: t.Optional[
1226
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1233
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1227
1234
  ] = None,
1228
1235
  wait_for_active_shards: t.Optional[
1229
1236
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1468,8 +1475,8 @@ class AsyncElasticsearch(BaseClient):
1468
1475
  used only when the `q` query string parameter is specified.
1469
1476
  :param conflicts: What to do if delete by query hits version conflicts: `abort`
1470
1477
  or `proceed`.
1471
- :param default_operator: The default operator for query string query: `AND` or
1472
- `OR`. This parameter can be used only when the `q` query string parameter
1478
+ :param default_operator: The default operator for query string query: `and` or
1479
+ `or`. This parameter can be used only when the `q` query string parameter
1473
1480
  is specified.
1474
1481
  :param df: The field to use as default where no field prefix is given in the
1475
1482
  query string. This parameter can be used only when the `q` query string parameter
@@ -1763,7 +1770,7 @@ class AsyncElasticsearch(BaseClient):
1763
1770
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1764
1771
  version: t.Optional[int] = None,
1765
1772
  version_type: t.Optional[
1766
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1773
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1767
1774
  ] = None,
1768
1775
  ) -> HeadApiResponse:
1769
1776
  """
@@ -1892,7 +1899,7 @@ class AsyncElasticsearch(BaseClient):
1892
1899
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1893
1900
  version: t.Optional[int] = None,
1894
1901
  version_type: t.Optional[
1895
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1902
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1896
1903
  ] = None,
1897
1904
  ) -> HeadApiResponse:
1898
1905
  """
@@ -2021,8 +2028,8 @@ class AsyncElasticsearch(BaseClient):
2021
2028
  This parameter can be used only when the `q` query string parameter is specified.
2022
2029
  :param analyzer: The analyzer to use for the query string. This parameter can
2023
2030
  be used only when the `q` query string parameter is specified.
2024
- :param default_operator: The default operator for query string query: `AND` or
2025
- `OR`. This parameter can be used only when the `q` query string parameter
2031
+ :param default_operator: The default operator for query string query: `and` or
2032
+ `or`. This parameter can be used only when the `q` query string parameter
2026
2033
  is specified.
2027
2034
  :param df: The field to use as default where no field prefix is given in the
2028
2035
  query string. This parameter can be used only when the `q` query string parameter
@@ -2133,6 +2140,7 @@ class AsyncElasticsearch(BaseClient):
2133
2140
  include_unmapped: t.Optional[bool] = None,
2134
2141
  index_filter: t.Optional[t.Mapping[str, t.Any]] = None,
2135
2142
  pretty: t.Optional[bool] = None,
2143
+ project_routing: t.Optional[str] = None,
2136
2144
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
2137
2145
  types: t.Optional[t.Sequence[str]] = None,
2138
2146
  body: t.Optional[t.Dict[str, t.Any]] = None,
@@ -2176,6 +2184,11 @@ class AsyncElasticsearch(BaseClient):
2176
2184
  deleted documents) are outside of the provided range. However, not all queries
2177
2185
  can rewrite to `match_none` so this API may return an index even if the provided
2178
2186
  filter matches no document.
2187
+ :param project_routing: Specifies a subset of projects to target for the field-caps
2188
+ query using project metadata tags in a subset of Lucene query syntax. Allowed
2189
+ Lucene queries: the _alias tag and a single value (possibly wildcarded).
2190
+ Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless
2191
+ only.
2179
2192
  :param runtime_mappings: Define ad-hoc runtime fields in the request similar
2180
2193
  to the way it is done in search requests. These fields exist only as part
2181
2194
  of the query and take precedence over fields defined with the same name in
@@ -2213,6 +2226,8 @@ class AsyncElasticsearch(BaseClient):
2213
2226
  __query["include_unmapped"] = include_unmapped
2214
2227
  if pretty is not None:
2215
2228
  __query["pretty"] = pretty
2229
+ if project_routing is not None:
2230
+ __query["project_routing"] = project_routing
2216
2231
  if types is not None:
2217
2232
  __query["types"] = types
2218
2233
  if not __body:
@@ -2240,6 +2255,7 @@ class AsyncElasticsearch(BaseClient):
2240
2255
  @_rewrite_parameters(
2241
2256
  parameter_aliases={
2242
2257
  "_source": "source",
2258
+ "_source_exclude_vectors": "source_exclude_vectors",
2243
2259
  "_source_excludes": "source_excludes",
2244
2260
  "_source_includes": "source_includes",
2245
2261
  },
@@ -2259,12 +2275,13 @@ class AsyncElasticsearch(BaseClient):
2259
2275
  refresh: t.Optional[bool] = None,
2260
2276
  routing: t.Optional[str] = None,
2261
2277
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
2278
+ source_exclude_vectors: t.Optional[bool] = None,
2262
2279
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2263
2280
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2264
2281
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2265
2282
  version: t.Optional[int] = None,
2266
2283
  version_type: t.Optional[
2267
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2284
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2268
2285
  ] = None,
2269
2286
  ) -> ObjectApiResponse[t.Any]:
2270
2287
  """
@@ -2332,6 +2349,7 @@ class AsyncElasticsearch(BaseClient):
2332
2349
  :param routing: A custom value used to route operations to a specific shard.
2333
2350
  :param source: Indicates whether to return the `_source` field (`true` or `false`)
2334
2351
  or lists the fields to return.
2352
+ :param source_exclude_vectors: Whether vectors should be excluded from _source
2335
2353
  :param source_excludes: A comma-separated list of source fields to exclude from
2336
2354
  the response. You can also use this parameter to exclude fields from the
2337
2355
  subset specified in `_source_includes` query parameter. If the `_source`
@@ -2377,6 +2395,8 @@ class AsyncElasticsearch(BaseClient):
2377
2395
  __query["routing"] = routing
2378
2396
  if source is not None:
2379
2397
  __query["_source"] = source
2398
+ if source_exclude_vectors is not None:
2399
+ __query["_source_exclude_vectors"] = source_exclude_vectors
2380
2400
  if source_excludes is not None:
2381
2401
  __query["_source_excludes"] = source_excludes
2382
2402
  if source_includes is not None:
@@ -2551,7 +2571,7 @@ class AsyncElasticsearch(BaseClient):
2551
2571
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2552
2572
  version: t.Optional[int] = None,
2553
2573
  version_type: t.Optional[
2554
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2574
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2555
2575
  ] = None,
2556
2576
  ) -> ObjectApiResponse[t.Any]:
2557
2577
  """
@@ -2731,7 +2751,7 @@ class AsyncElasticsearch(BaseClient):
2731
2751
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2732
2752
  version: t.Optional[int] = None,
2733
2753
  version_type: t.Optional[
2734
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2754
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2735
2755
  ] = None,
2736
2756
  wait_for_active_shards: t.Optional[
2737
2757
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -3146,6 +3166,7 @@ class AsyncElasticsearch(BaseClient):
3146
3166
  max_concurrent_shard_requests: t.Optional[int] = None,
3147
3167
  pre_filter_shard_size: t.Optional[int] = None,
3148
3168
  pretty: t.Optional[bool] = None,
3169
+ project_routing: t.Optional[str] = None,
3149
3170
  rest_total_hits_as_int: t.Optional[bool] = None,
3150
3171
  routing: t.Optional[str] = None,
3151
3172
  search_type: t.Optional[
@@ -3207,6 +3228,10 @@ class AsyncElasticsearch(BaseClient):
3207
3228
  roundtrip can limit the number of shards significantly if for instance a
3208
3229
  shard can not match any documents based on its rewrite method i.e., if date
3209
3230
  filters are mandatory to match but the shard bounds and the query are disjoint.
3231
+ :param project_routing: Specifies a subset of projects to target for a search
3232
+ using project metadata tags in a subset Lucene syntax. Allowed Lucene queries:
3233
+ the _alias tag and a single value (possible wildcarded). Examples: _alias:my-project
3234
+ _alias:_origin _alias:*pr* Supported in serverless only.
3210
3235
  :param rest_total_hits_as_int: If true, hits.total are returned as an integer
3211
3236
  in the response. Defaults to false, which returns an object.
3212
3237
  :param routing: Custom routing value used to route search operations to a specific
@@ -3256,6 +3281,8 @@ class AsyncElasticsearch(BaseClient):
3256
3281
  __query["pre_filter_shard_size"] = pre_filter_shard_size
3257
3282
  if pretty is not None:
3258
3283
  __query["pretty"] = pretty
3284
+ if project_routing is not None:
3285
+ __query["project_routing"] = project_routing
3259
3286
  if rest_total_hits_as_int is not None:
3260
3287
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
3261
3288
  if routing is not None:
@@ -3294,6 +3321,7 @@ class AsyncElasticsearch(BaseClient):
3294
3321
  human: t.Optional[bool] = None,
3295
3322
  max_concurrent_searches: t.Optional[int] = None,
3296
3323
  pretty: t.Optional[bool] = None,
3324
+ project_routing: t.Optional[str] = None,
3297
3325
  rest_total_hits_as_int: t.Optional[bool] = None,
3298
3326
  search_type: t.Optional[
3299
3327
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
@@ -3327,6 +3355,10 @@ class AsyncElasticsearch(BaseClient):
3327
3355
  for cross-cluster search requests.
3328
3356
  :param max_concurrent_searches: The maximum number of concurrent searches the
3329
3357
  API can run.
3358
+ :param project_routing: Specifies a subset of projects to target for the search
3359
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
3360
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
3361
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
3330
3362
  :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as
3331
3363
  an integer. If `false`, it returns `hits.total` as an object.
3332
3364
  :param search_type: The type of the search operation.
@@ -3359,6 +3391,8 @@ class AsyncElasticsearch(BaseClient):
3359
3391
  __query["max_concurrent_searches"] = max_concurrent_searches
3360
3392
  if pretty is not None:
3361
3393
  __query["pretty"] = pretty
3394
+ if project_routing is not None:
3395
+ __query["project_routing"] = project_routing
3362
3396
  if rest_total_hits_as_int is not None:
3363
3397
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
3364
3398
  if search_type is not None:
@@ -3404,7 +3438,7 @@ class AsyncElasticsearch(BaseClient):
3404
3438
  term_statistics: t.Optional[bool] = None,
3405
3439
  version: t.Optional[int] = None,
3406
3440
  version_type: t.Optional[
3407
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
3441
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
3408
3442
  ] = None,
3409
3443
  body: t.Optional[t.Dict[str, t.Any]] = None,
3410
3444
  ) -> ObjectApiResponse[t.Any]:
@@ -3529,6 +3563,7 @@ class AsyncElasticsearch(BaseClient):
3529
3563
  max_concurrent_shard_requests: t.Optional[int] = None,
3530
3564
  preference: t.Optional[str] = None,
3531
3565
  pretty: t.Optional[bool] = None,
3566
+ project_routing: t.Optional[str] = None,
3532
3567
  routing: t.Optional[str] = None,
3533
3568
  body: t.Optional[t.Dict[str, t.Any]] = None,
3534
3569
  ) -> ObjectApiResponse[t.Any]:
@@ -3585,6 +3620,11 @@ class AsyncElasticsearch(BaseClient):
3585
3620
  that each sub-search request executes per node.
3586
3621
  :param preference: The node or shard the operation should be performed on. By
3587
3622
  default, it is random.
3623
+ :param project_routing: Specifies a subset of projects to target for the PIT
3624
+ request using project metadata tags in a subset of Lucene query syntax. Allowed
3625
+ Lucene queries: the _alias tag and a single value (possibly wildcarded).
3626
+ Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless
3627
+ only.
3588
3628
  :param routing: A custom value that is used to route operations to a specific
3589
3629
  shard.
3590
3630
  """
@@ -3616,6 +3656,8 @@ class AsyncElasticsearch(BaseClient):
3616
3656
  __query["preference"] = preference
3617
3657
  if pretty is not None:
3618
3658
  __query["pretty"] = pretty
3659
+ if project_routing is not None:
3660
+ __query["project_routing"] = project_routing
3619
3661
  if routing is not None:
3620
3662
  __query["routing"] = routing
3621
3663
  if not __body:
@@ -3814,7 +3856,7 @@ class AsyncElasticsearch(BaseClient):
3814
3856
  )
3815
3857
 
3816
3858
  @_rewrite_parameters(
3817
- body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"),
3859
+ body_fields=("dest", "source", "conflicts", "max_docs", "script"),
3818
3860
  )
3819
3861
  async def reindex(
3820
3862
  self,
@@ -3832,7 +3874,6 @@ class AsyncElasticsearch(BaseClient):
3832
3874
  require_alias: t.Optional[bool] = None,
3833
3875
  script: t.Optional[t.Mapping[str, t.Any]] = None,
3834
3876
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3835
- size: t.Optional[int] = None,
3836
3877
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
3837
3878
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3838
3879
  wait_for_active_shards: t.Optional[
@@ -3908,7 +3949,6 @@ class AsyncElasticsearch(BaseClient):
3908
3949
  reindexing.
3909
3950
  :param scroll: The period of time that a consistent view of the index should
3910
3951
  be maintained for scrolled search.
3911
- :param size:
3912
3952
  :param slices: The number of slices this task should be divided into. It defaults
3913
3953
  to one slice, which means the task isn't sliced into subtasks. Reindex supports
3914
3954
  sliced scroll to parallelize the reindexing process. This parallelization
@@ -3973,8 +4013,6 @@ class AsyncElasticsearch(BaseClient):
3973
4013
  __body["max_docs"] = max_docs
3974
4014
  if script is not None:
3975
4015
  __body["script"] = script
3976
- if size is not None:
3977
- __body["size"] = size
3978
4016
  __headers = {"accept": "application/json", "content-type": "application/json"}
3979
4017
  return await self.perform_request( # type: ignore[return-value]
3980
4018
  "POST",
@@ -4101,11 +4139,7 @@ class AsyncElasticsearch(BaseClient):
4101
4139
  __body["params"] = params
4102
4140
  if source is not None:
4103
4141
  __body["source"] = source
4104
- if not __body:
4105
- __body = None # type: ignore[assignment]
4106
- __headers = {"accept": "application/json"}
4107
- if __body is not None:
4108
- __headers["content-type"] = "application/json"
4142
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4109
4143
  return await self.perform_request( # type: ignore[return-value]
4110
4144
  "POST",
4111
4145
  __path,
@@ -4188,11 +4222,7 @@ class AsyncElasticsearch(BaseClient):
4188
4222
  __body["context_setup"] = context_setup
4189
4223
  if script is not None:
4190
4224
  __body["script"] = script
4191
- if not __body:
4192
- __body = None # type: ignore[assignment]
4193
- __headers = {"accept": "application/json"}
4194
- if __body is not None:
4195
- __headers["content-type"] = "application/json"
4225
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4196
4226
  return await self.perform_request( # type: ignore[return-value]
4197
4227
  "POST",
4198
4228
  __path,
@@ -4317,6 +4347,7 @@ class AsyncElasticsearch(BaseClient):
4317
4347
  ),
4318
4348
  parameter_aliases={
4319
4349
  "_source": "source",
4350
+ "_source_exclude_vectors": "source_exclude_vectors",
4320
4351
  "_source_excludes": "source_excludes",
4321
4352
  "_source_includes": "source_includes",
4322
4353
  "from": "from_",
@@ -4371,6 +4402,7 @@ class AsyncElasticsearch(BaseClient):
4371
4402
  preference: t.Optional[str] = None,
4372
4403
  pretty: t.Optional[bool] = None,
4373
4404
  profile: t.Optional[bool] = None,
4405
+ project_routing: t.Optional[str] = None,
4374
4406
  q: t.Optional[str] = None,
4375
4407
  query: t.Optional[t.Mapping[str, t.Any]] = None,
4376
4408
  rank: t.Optional[t.Mapping[str, t.Any]] = None,
@@ -4400,6 +4432,7 @@ class AsyncElasticsearch(BaseClient):
4400
4432
  ]
4401
4433
  ] = None,
4402
4434
  source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
4435
+ source_exclude_vectors: t.Optional[bool] = None,
4403
4436
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4404
4437
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4405
4438
  stats: t.Optional[t.Sequence[str]] = None,
@@ -4467,8 +4500,8 @@ class AsyncElasticsearch(BaseClient):
4467
4500
  node and the remote clusters are minimized when running cross-cluster search
4468
4501
  (CCS) requests.
4469
4502
  :param collapse: Collapses search results the values of the specified field.
4470
- :param default_operator: The default operator for the query string query: `AND`
4471
- or `OR`. This parameter can be used only when the `q` query string parameter
4503
+ :param default_operator: The default operator for the query string query: `and`
4504
+ or `or`. This parameter can be used only when the `q` query string parameter
4472
4505
  is specified.
4473
4506
  :param df: The field to use as a default when no field prefix is given in the
4474
4507
  query string. This parameter can be used only when the `q` query string parameter
@@ -4553,6 +4586,10 @@ class AsyncElasticsearch(BaseClient):
4553
4586
  :param profile: Set to `true` to return detailed timing information about the
4554
4587
  execution of individual components in a search request. NOTE: This is a debugging
4555
4588
  tool and adds significant overhead to search execution.
4589
+ :param project_routing: Specifies a subset of projects to target for the search
4590
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
4591
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
4592
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
4556
4593
  :param q: A query in the Lucene query string syntax. Query parameter searches
4557
4594
  do not support the full Elasticsearch Query DSL but are handy for testing.
4558
4595
  IMPORTANT: This parameter overrides the query parameter in the request body.
@@ -4594,6 +4631,7 @@ class AsyncElasticsearch(BaseClient):
4594
4631
  fields are returned in the `hits._source` property of the search response.
4595
4632
  If the `stored_fields` property is specified, the `_source` property defaults
4596
4633
  to `false`. Otherwise, it defaults to `true`.
4634
+ :param source_exclude_vectors: Whether vectors should be excluded from _source
4597
4635
  :param source_excludes: A comma-separated list of source fields to exclude from
4598
4636
  the response. You can also use this parameter to exclude fields from the
4599
4637
  subset specified in `_source_includes` query parameter. If the `_source`
@@ -4706,6 +4744,8 @@ class AsyncElasticsearch(BaseClient):
4706
4744
  __query["preference"] = preference
4707
4745
  if pretty is not None:
4708
4746
  __query["pretty"] = pretty
4747
+ if project_routing is not None:
4748
+ __query["project_routing"] = project_routing
4709
4749
  if q is not None:
4710
4750
  __query["q"] = q
4711
4751
  if request_cache is not None:
@@ -4718,6 +4758,8 @@ class AsyncElasticsearch(BaseClient):
4718
4758
  __query["scroll"] = scroll
4719
4759
  if search_type is not None:
4720
4760
  __query["search_type"] = search_type
4761
+ if source_exclude_vectors is not None:
4762
+ __query["_source_exclude_vectors"] = source_exclude_vectors
4721
4763
  if source_excludes is not None:
4722
4764
  __query["_source_excludes"] = source_excludes
4723
4765
  if source_includes is not None:
@@ -4858,6 +4900,7 @@ class AsyncElasticsearch(BaseClient):
4858
4900
  ] = None,
4859
4901
  human: t.Optional[bool] = None,
4860
4902
  pretty: t.Optional[bool] = None,
4903
+ project_routing: t.Optional[str] = None,
4861
4904
  query: t.Optional[t.Mapping[str, t.Any]] = None,
4862
4905
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
4863
4906
  size: t.Optional[int] = None,
@@ -5175,6 +5218,10 @@ class AsyncElasticsearch(BaseClient):
5175
5218
  In the aggs layer, each feature represents a `geotile_grid` cell. If `grid,
5176
5219
  each feature is a polygon of the cells bounding box. If `point`, each feature
5177
5220
  is a Point that is the centroid of the cell.
5221
+ :param project_routing: Specifies a subset of projects to target for the search
5222
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
5223
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
5224
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
5178
5225
  :param query: The query DSL used to filter documents for the search.
5179
5226
  :param runtime_mappings: Defines one or more runtime fields in the search request.
5180
5227
  These fields take precedence over mapped fields with the same name.
@@ -5238,6 +5285,8 @@ class AsyncElasticsearch(BaseClient):
5238
5285
  __query["human"] = human
5239
5286
  if pretty is not None:
5240
5287
  __query["pretty"] = pretty
5288
+ if project_routing is not None:
5289
+ __query["project_routing"] = project_routing
5241
5290
  if not __body:
5242
5291
  if aggs is not None:
5243
5292
  __body["aggs"] = aggs
@@ -5411,6 +5460,7 @@ class AsyncElasticsearch(BaseClient):
5411
5460
  preference: t.Optional[str] = None,
5412
5461
  pretty: t.Optional[bool] = None,
5413
5462
  profile: t.Optional[bool] = None,
5463
+ project_routing: t.Optional[str] = None,
5414
5464
  rest_total_hits_as_int: t.Optional[bool] = None,
5415
5465
  routing: t.Optional[str] = None,
5416
5466
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -5456,6 +5506,10 @@ class AsyncElasticsearch(BaseClient):
5456
5506
  :param preference: The node or shard the operation should be performed on. It
5457
5507
  is random by default.
5458
5508
  :param profile: If `true`, the query execution is profiled.
5509
+ :param project_routing: Specifies a subset of projects to target for the search
5510
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
5511
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
5512
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
5459
5513
  :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer
5460
5514
  in the response. If `false`, it is rendered as an object.
5461
5515
  :param routing: A custom value used to route operations to a specific shard.
@@ -5497,6 +5551,8 @@ class AsyncElasticsearch(BaseClient):
5497
5551
  __query["preference"] = preference
5498
5552
  if pretty is not None:
5499
5553
  __query["pretty"] = pretty
5554
+ if project_routing is not None:
5555
+ __query["project_routing"] = project_routing
5500
5556
  if rest_total_hits_as_int is not None:
5501
5557
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
5502
5558
  if routing is not None:
@@ -5623,11 +5679,7 @@ class AsyncElasticsearch(BaseClient):
5623
5679
  __body["string"] = string
5624
5680
  if timeout is not None:
5625
5681
  __body["timeout"] = timeout
5626
- if not __body:
5627
- __body = None # type: ignore[assignment]
5628
- __headers = {"accept": "application/json"}
5629
- if __body is not None:
5630
- __headers["content-type"] = "application/json"
5682
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5631
5683
  return await self.perform_request( # type: ignore[return-value]
5632
5684
  "POST",
5633
5685
  __path,
@@ -5677,7 +5729,7 @@ class AsyncElasticsearch(BaseClient):
5677
5729
  term_statistics: t.Optional[bool] = None,
5678
5730
  version: t.Optional[int] = None,
5679
5731
  version_type: t.Optional[
5680
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
5732
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
5681
5733
  ] = None,
5682
5734
  body: t.Optional[t.Dict[str, t.Any]] = None,
5683
5735
  ) -> ObjectApiResponse[t.Any]:
@@ -6153,8 +6205,8 @@ class AsyncElasticsearch(BaseClient):
6153
6205
  be used only when the `q` query string parameter is specified.
6154
6206
  :param conflicts: The preferred behavior when update by query hits version conflicts:
6155
6207
  `abort` or `proceed`.
6156
- :param default_operator: The default operator for query string query: `AND` or
6157
- `OR`. This parameter can be used only when the `q` query string parameter
6208
+ :param default_operator: The default operator for query string query: `and` or
6209
+ `or`. This parameter can be used only when the `q` query string parameter
6158
6210
  is specified.
6159
6211
  :param df: The field to use as default where no field prefix is given in the
6160
6212
  query string. This parameter can be used only when the `q` query string parameter
@@ -287,6 +287,7 @@ class AsyncSearchClient(NamespacedClient):
287
287
  preference: t.Optional[str] = None,
288
288
  pretty: t.Optional[bool] = None,
289
289
  profile: t.Optional[bool] = None,
290
+ project_routing: t.Optional[str] = None,
290
291
  q: t.Optional[str] = None,
291
292
  query: t.Optional[t.Mapping[str, t.Any]] = None,
292
293
  request_cache: t.Optional[bool] = None,
@@ -408,6 +409,10 @@ class AsyncSearchClient(NamespacedClient):
408
409
  :param preference: Specify the node or shard the operation should be performed
409
410
  on (default: random)
410
411
  :param profile:
412
+ :param project_routing: Specifies a subset of projects to target for the search
413
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
414
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
415
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
411
416
  :param q: Query in the Lucene query string syntax
412
417
  :param query: Defines the search definition using the Query DSL.
413
418
  :param request_cache: Specify if request cache should be used for this request
@@ -528,6 +533,8 @@ class AsyncSearchClient(NamespacedClient):
528
533
  __query["preference"] = preference
529
534
  if pretty is not None:
530
535
  __query["pretty"] = pretty
536
+ if project_routing is not None:
537
+ __query["project_routing"] = project_routing
531
538
  if q is not None:
532
539
  __query["q"] = q
533
540
  if request_cache is not None: