elasticsearch 9.1.2__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 (61) hide show
  1. elasticsearch/_async/client/__init__.py +94 -44
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/cat.py +8 -1
  4. elasticsearch/_async/client/cluster.py +9 -8
  5. elasticsearch/_async/client/eql.py +7 -0
  6. elasticsearch/_async/client/esql.py +26 -3
  7. elasticsearch/_async/client/fleet.py +1 -5
  8. elasticsearch/_async/client/graph.py +1 -5
  9. elasticsearch/_async/client/ilm.py +2 -10
  10. elasticsearch/_async/client/indices.py +158 -28
  11. elasticsearch/_async/client/inference.py +280 -123
  12. elasticsearch/_async/client/ingest.py +8 -0
  13. elasticsearch/_async/client/license.py +4 -2
  14. elasticsearch/_async/client/ml.py +2 -2
  15. elasticsearch/_async/client/nodes.py +1 -3
  16. elasticsearch/_async/client/project.py +67 -0
  17. elasticsearch/_async/client/security.py +39 -0
  18. elasticsearch/_async/client/simulate.py +8 -0
  19. elasticsearch/_async/client/slm.py +1 -5
  20. elasticsearch/_async/client/snapshot.py +20 -10
  21. elasticsearch/_async/client/sql.py +7 -0
  22. elasticsearch/_async/client/streams.py +2 -3
  23. elasticsearch/_async/helpers.py +28 -15
  24. elasticsearch/_sync/client/__init__.py +94 -44
  25. elasticsearch/_sync/client/async_search.py +7 -0
  26. elasticsearch/_sync/client/cat.py +8 -1
  27. elasticsearch/_sync/client/cluster.py +9 -8
  28. elasticsearch/_sync/client/eql.py +7 -0
  29. elasticsearch/_sync/client/esql.py +26 -3
  30. elasticsearch/_sync/client/fleet.py +1 -5
  31. elasticsearch/_sync/client/graph.py +1 -5
  32. elasticsearch/_sync/client/ilm.py +2 -10
  33. elasticsearch/_sync/client/indices.py +158 -28
  34. elasticsearch/_sync/client/inference.py +280 -123
  35. elasticsearch/_sync/client/ingest.py +8 -0
  36. elasticsearch/_sync/client/license.py +4 -2
  37. elasticsearch/_sync/client/ml.py +2 -2
  38. elasticsearch/_sync/client/nodes.py +1 -3
  39. elasticsearch/_sync/client/project.py +67 -0
  40. elasticsearch/_sync/client/security.py +39 -0
  41. elasticsearch/_sync/client/simulate.py +8 -0
  42. elasticsearch/_sync/client/slm.py +1 -5
  43. elasticsearch/_sync/client/snapshot.py +20 -10
  44. elasticsearch/_sync/client/sql.py +7 -0
  45. elasticsearch/_sync/client/streams.py +2 -3
  46. elasticsearch/_version.py +2 -2
  47. elasticsearch/client.py +2 -0
  48. elasticsearch/compat.py +2 -15
  49. elasticsearch/dsl/_async/document.py +2 -1
  50. elasticsearch/dsl/_sync/document.py +2 -1
  51. elasticsearch/dsl/document_base.py +38 -13
  52. elasticsearch/dsl/pydantic.py +152 -0
  53. elasticsearch/dsl/search_base.py +5 -1
  54. elasticsearch/esql/esql.py +331 -41
  55. elasticsearch/esql/functions.py +88 -0
  56. elasticsearch/helpers/actions.py +1 -1
  57. {elasticsearch-9.1.2.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +26 -4
  58. {elasticsearch-9.1.2.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +61 -58
  59. {elasticsearch-9.1.2.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
  60. {elasticsearch-9.1.2.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
  61. {elasticsearch-9.1.2.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
@@ -369,6 +370,7 @@ class Elasticsearch(BaseClient):
369
370
  self.migration = MigrationClient(self)
370
371
  self.ml = MlClient(self)
371
372
  self.monitoring = MonitoringClient(self)
373
+ self.project = ProjectClient(self)
372
374
  self.query_rules = QueryRulesClient(self)
373
375
  self.rollup = RollupClient(self)
374
376
  self.search_application = SearchApplicationClient(self)
@@ -845,11 +847,7 @@ class Elasticsearch(BaseClient):
845
847
  if not __body:
846
848
  if id is not None:
847
849
  __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"
850
+ __headers = {"accept": "application/json", "content-type": "application/json"}
853
851
  return self.perform_request( # type: ignore[return-value]
854
852
  "DELETE",
855
853
  __path,
@@ -889,6 +887,7 @@ class Elasticsearch(BaseClient):
889
887
  min_score: t.Optional[float] = None,
890
888
  preference: t.Optional[str] = None,
891
889
  pretty: t.Optional[bool] = None,
890
+ project_routing: t.Optional[str] = None,
892
891
  q: t.Optional[str] = None,
893
892
  query: t.Optional[t.Mapping[str, t.Any]] = None,
894
893
  routing: t.Optional[str] = None,
@@ -922,8 +921,8 @@ class Elasticsearch(BaseClient):
922
921
  This parameter can be used only when the `q` query string parameter is specified.
923
922
  :param analyzer: The analyzer to use for the query string. This parameter can
924
923
  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
924
+ :param default_operator: The default operator for query string query: `and` or
925
+ `or`. This parameter can be used only when the `q` query string parameter
927
926
  is specified.
928
927
  :param df: The field to use as a default when no field prefix is given in the
929
928
  query string. This parameter can be used only when the `q` query string parameter
@@ -943,6 +942,10 @@ class Elasticsearch(BaseClient):
943
942
  in the result.
944
943
  :param preference: The node or shard the operation should be performed on. By
945
944
  default, it is random.
945
+ :param project_routing: Specifies a subset of projects to target for the search
946
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
947
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
948
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
946
949
  :param q: The query in Lucene query string syntax. This parameter cannot be used
947
950
  with a request body.
948
951
  :param query: Defines the search query using Query DSL. A request body query
@@ -995,6 +998,8 @@ class Elasticsearch(BaseClient):
995
998
  __query["preference"] = preference
996
999
  if pretty is not None:
997
1000
  __query["pretty"] = pretty
1001
+ if project_routing is not None:
1002
+ __query["project_routing"] = project_routing
998
1003
  if q is not None:
999
1004
  __query["q"] = q
1000
1005
  if routing is not None:
@@ -1044,7 +1049,7 @@ class Elasticsearch(BaseClient):
1044
1049
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1045
1050
  version: t.Optional[int] = None,
1046
1051
  version_type: t.Optional[
1047
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1052
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1048
1053
  ] = None,
1049
1054
  wait_for_active_shards: t.Optional[
1050
1055
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1223,7 +1228,7 @@ class Elasticsearch(BaseClient):
1223
1228
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
1224
1229
  version: t.Optional[int] = None,
1225
1230
  version_type: t.Optional[
1226
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1231
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1227
1232
  ] = None,
1228
1233
  wait_for_active_shards: t.Optional[
1229
1234
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -1468,8 +1473,8 @@ class Elasticsearch(BaseClient):
1468
1473
  used only when the `q` query string parameter is specified.
1469
1474
  :param conflicts: What to do if delete by query hits version conflicts: `abort`
1470
1475
  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
1476
+ :param default_operator: The default operator for query string query: `and` or
1477
+ `or`. This parameter can be used only when the `q` query string parameter
1473
1478
  is specified.
1474
1479
  :param df: The field to use as default where no field prefix is given in the
1475
1480
  query string. This parameter can be used only when the `q` query string parameter
@@ -1763,7 +1768,7 @@ class Elasticsearch(BaseClient):
1763
1768
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1764
1769
  version: t.Optional[int] = None,
1765
1770
  version_type: t.Optional[
1766
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1771
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1767
1772
  ] = None,
1768
1773
  ) -> HeadApiResponse:
1769
1774
  """
@@ -1892,7 +1897,7 @@ class Elasticsearch(BaseClient):
1892
1897
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
1893
1898
  version: t.Optional[int] = None,
1894
1899
  version_type: t.Optional[
1895
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
1900
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
1896
1901
  ] = None,
1897
1902
  ) -> HeadApiResponse:
1898
1903
  """
@@ -2021,8 +2026,8 @@ class Elasticsearch(BaseClient):
2021
2026
  This parameter can be used only when the `q` query string parameter is specified.
2022
2027
  :param analyzer: The analyzer to use for the query string. This parameter can
2023
2028
  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
2029
+ :param default_operator: The default operator for query string query: `and` or
2030
+ `or`. This parameter can be used only when the `q` query string parameter
2026
2031
  is specified.
2027
2032
  :param df: The field to use as default where no field prefix is given in the
2028
2033
  query string. This parameter can be used only when the `q` query string parameter
@@ -2133,6 +2138,7 @@ class Elasticsearch(BaseClient):
2133
2138
  include_unmapped: t.Optional[bool] = None,
2134
2139
  index_filter: t.Optional[t.Mapping[str, t.Any]] = None,
2135
2140
  pretty: t.Optional[bool] = None,
2141
+ project_routing: t.Optional[str] = None,
2136
2142
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
2137
2143
  types: t.Optional[t.Sequence[str]] = None,
2138
2144
  body: t.Optional[t.Dict[str, t.Any]] = None,
@@ -2176,6 +2182,11 @@ class Elasticsearch(BaseClient):
2176
2182
  deleted documents) are outside of the provided range. However, not all queries
2177
2183
  can rewrite to `match_none` so this API may return an index even if the provided
2178
2184
  filter matches no document.
2185
+ :param project_routing: Specifies a subset of projects to target for the field-caps
2186
+ query using project metadata tags in a subset of Lucene query syntax. Allowed
2187
+ Lucene queries: the _alias tag and a single value (possibly wildcarded).
2188
+ Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless
2189
+ only.
2179
2190
  :param runtime_mappings: Define ad-hoc runtime fields in the request similar
2180
2191
  to the way it is done in search requests. These fields exist only as part
2181
2192
  of the query and take precedence over fields defined with the same name in
@@ -2213,6 +2224,8 @@ class Elasticsearch(BaseClient):
2213
2224
  __query["include_unmapped"] = include_unmapped
2214
2225
  if pretty is not None:
2215
2226
  __query["pretty"] = pretty
2227
+ if project_routing is not None:
2228
+ __query["project_routing"] = project_routing
2216
2229
  if types is not None:
2217
2230
  __query["types"] = types
2218
2231
  if not __body:
@@ -2240,6 +2253,7 @@ class Elasticsearch(BaseClient):
2240
2253
  @_rewrite_parameters(
2241
2254
  parameter_aliases={
2242
2255
  "_source": "source",
2256
+ "_source_exclude_vectors": "source_exclude_vectors",
2243
2257
  "_source_excludes": "source_excludes",
2244
2258
  "_source_includes": "source_includes",
2245
2259
  },
@@ -2259,12 +2273,13 @@ class Elasticsearch(BaseClient):
2259
2273
  refresh: t.Optional[bool] = None,
2260
2274
  routing: t.Optional[str] = None,
2261
2275
  source: t.Optional[t.Union[bool, t.Union[str, t.Sequence[str]]]] = None,
2276
+ source_exclude_vectors: t.Optional[bool] = None,
2262
2277
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2263
2278
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2264
2279
  stored_fields: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2265
2280
  version: t.Optional[int] = None,
2266
2281
  version_type: t.Optional[
2267
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2282
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2268
2283
  ] = None,
2269
2284
  ) -> ObjectApiResponse[t.Any]:
2270
2285
  """
@@ -2332,6 +2347,7 @@ class Elasticsearch(BaseClient):
2332
2347
  :param routing: A custom value used to route operations to a specific shard.
2333
2348
  :param source: Indicates whether to return the `_source` field (`true` or `false`)
2334
2349
  or lists the fields to return.
2350
+ :param source_exclude_vectors: Whether vectors should be excluded from _source
2335
2351
  :param source_excludes: A comma-separated list of source fields to exclude from
2336
2352
  the response. You can also use this parameter to exclude fields from the
2337
2353
  subset specified in `_source_includes` query parameter. If the `_source`
@@ -2377,6 +2393,8 @@ class Elasticsearch(BaseClient):
2377
2393
  __query["routing"] = routing
2378
2394
  if source is not None:
2379
2395
  __query["_source"] = source
2396
+ if source_exclude_vectors is not None:
2397
+ __query["_source_exclude_vectors"] = source_exclude_vectors
2380
2398
  if source_excludes is not None:
2381
2399
  __query["_source_excludes"] = source_excludes
2382
2400
  if source_includes is not None:
@@ -2551,7 +2569,7 @@ class Elasticsearch(BaseClient):
2551
2569
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2552
2570
  version: t.Optional[int] = None,
2553
2571
  version_type: t.Optional[
2554
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2572
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2555
2573
  ] = None,
2556
2574
  ) -> ObjectApiResponse[t.Any]:
2557
2575
  """
@@ -2731,7 +2749,7 @@ class Elasticsearch(BaseClient):
2731
2749
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
2732
2750
  version: t.Optional[int] = None,
2733
2751
  version_type: t.Optional[
2734
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
2752
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
2735
2753
  ] = None,
2736
2754
  wait_for_active_shards: t.Optional[
2737
2755
  t.Union[int, t.Union[str, t.Literal["all", "index-setting"]]]
@@ -3146,6 +3164,7 @@ class Elasticsearch(BaseClient):
3146
3164
  max_concurrent_shard_requests: t.Optional[int] = None,
3147
3165
  pre_filter_shard_size: t.Optional[int] = None,
3148
3166
  pretty: t.Optional[bool] = None,
3167
+ project_routing: t.Optional[str] = None,
3149
3168
  rest_total_hits_as_int: t.Optional[bool] = None,
3150
3169
  routing: t.Optional[str] = None,
3151
3170
  search_type: t.Optional[
@@ -3207,6 +3226,10 @@ class Elasticsearch(BaseClient):
3207
3226
  roundtrip can limit the number of shards significantly if for instance a
3208
3227
  shard can not match any documents based on its rewrite method i.e., if date
3209
3228
  filters are mandatory to match but the shard bounds and the query are disjoint.
3229
+ :param project_routing: Specifies a subset of projects to target for a search
3230
+ using project metadata tags in a subset Lucene syntax. Allowed Lucene queries:
3231
+ the _alias tag and a single value (possible wildcarded). Examples: _alias:my-project
3232
+ _alias:_origin _alias:*pr* Supported in serverless only.
3210
3233
  :param rest_total_hits_as_int: If true, hits.total are returned as an integer
3211
3234
  in the response. Defaults to false, which returns an object.
3212
3235
  :param routing: Custom routing value used to route search operations to a specific
@@ -3256,6 +3279,8 @@ class Elasticsearch(BaseClient):
3256
3279
  __query["pre_filter_shard_size"] = pre_filter_shard_size
3257
3280
  if pretty is not None:
3258
3281
  __query["pretty"] = pretty
3282
+ if project_routing is not None:
3283
+ __query["project_routing"] = project_routing
3259
3284
  if rest_total_hits_as_int is not None:
3260
3285
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
3261
3286
  if routing is not None:
@@ -3294,6 +3319,7 @@ class Elasticsearch(BaseClient):
3294
3319
  human: t.Optional[bool] = None,
3295
3320
  max_concurrent_searches: t.Optional[int] = None,
3296
3321
  pretty: t.Optional[bool] = None,
3322
+ project_routing: t.Optional[str] = None,
3297
3323
  rest_total_hits_as_int: t.Optional[bool] = None,
3298
3324
  search_type: t.Optional[
3299
3325
  t.Union[str, t.Literal["dfs_query_then_fetch", "query_then_fetch"]]
@@ -3327,6 +3353,10 @@ class Elasticsearch(BaseClient):
3327
3353
  for cross-cluster search requests.
3328
3354
  :param max_concurrent_searches: The maximum number of concurrent searches the
3329
3355
  API can run.
3356
+ :param project_routing: Specifies a subset of projects to target for the search
3357
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
3358
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
3359
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
3330
3360
  :param rest_total_hits_as_int: If `true`, the response returns `hits.total` as
3331
3361
  an integer. If `false`, it returns `hits.total` as an object.
3332
3362
  :param search_type: The type of the search operation.
@@ -3359,6 +3389,8 @@ class Elasticsearch(BaseClient):
3359
3389
  __query["max_concurrent_searches"] = max_concurrent_searches
3360
3390
  if pretty is not None:
3361
3391
  __query["pretty"] = pretty
3392
+ if project_routing is not None:
3393
+ __query["project_routing"] = project_routing
3362
3394
  if rest_total_hits_as_int is not None:
3363
3395
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
3364
3396
  if search_type is not None:
@@ -3404,7 +3436,7 @@ class Elasticsearch(BaseClient):
3404
3436
  term_statistics: t.Optional[bool] = None,
3405
3437
  version: t.Optional[int] = None,
3406
3438
  version_type: t.Optional[
3407
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
3439
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
3408
3440
  ] = None,
3409
3441
  body: t.Optional[t.Dict[str, t.Any]] = None,
3410
3442
  ) -> ObjectApiResponse[t.Any]:
@@ -3529,6 +3561,7 @@ class Elasticsearch(BaseClient):
3529
3561
  max_concurrent_shard_requests: t.Optional[int] = None,
3530
3562
  preference: t.Optional[str] = None,
3531
3563
  pretty: t.Optional[bool] = None,
3564
+ project_routing: t.Optional[str] = None,
3532
3565
  routing: t.Optional[str] = None,
3533
3566
  body: t.Optional[t.Dict[str, t.Any]] = None,
3534
3567
  ) -> ObjectApiResponse[t.Any]:
@@ -3585,6 +3618,11 @@ class Elasticsearch(BaseClient):
3585
3618
  that each sub-search request executes per node.
3586
3619
  :param preference: The node or shard the operation should be performed on. By
3587
3620
  default, it is random.
3621
+ :param project_routing: Specifies a subset of projects to target for the PIT
3622
+ request using project metadata tags in a subset of Lucene query syntax. Allowed
3623
+ Lucene queries: the _alias tag and a single value (possibly wildcarded).
3624
+ Examples: _alias:my-project _alias:_origin _alias:*pr* Supported in serverless
3625
+ only.
3588
3626
  :param routing: A custom value that is used to route operations to a specific
3589
3627
  shard.
3590
3628
  """
@@ -3616,6 +3654,8 @@ class Elasticsearch(BaseClient):
3616
3654
  __query["preference"] = preference
3617
3655
  if pretty is not None:
3618
3656
  __query["pretty"] = pretty
3657
+ if project_routing is not None:
3658
+ __query["project_routing"] = project_routing
3619
3659
  if routing is not None:
3620
3660
  __query["routing"] = routing
3621
3661
  if not __body:
@@ -3814,7 +3854,7 @@ class Elasticsearch(BaseClient):
3814
3854
  )
3815
3855
 
3816
3856
  @_rewrite_parameters(
3817
- body_fields=("dest", "source", "conflicts", "max_docs", "script", "size"),
3857
+ body_fields=("dest", "source", "conflicts", "max_docs", "script"),
3818
3858
  )
3819
3859
  def reindex(
3820
3860
  self,
@@ -3832,7 +3872,6 @@ class Elasticsearch(BaseClient):
3832
3872
  require_alias: t.Optional[bool] = None,
3833
3873
  script: t.Optional[t.Mapping[str, t.Any]] = None,
3834
3874
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3835
- size: t.Optional[int] = None,
3836
3875
  slices: t.Optional[t.Union[int, t.Union[str, t.Literal["auto"]]]] = None,
3837
3876
  timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
3838
3877
  wait_for_active_shards: t.Optional[
@@ -3908,7 +3947,6 @@ class Elasticsearch(BaseClient):
3908
3947
  reindexing.
3909
3948
  :param scroll: The period of time that a consistent view of the index should
3910
3949
  be maintained for scrolled search.
3911
- :param size:
3912
3950
  :param slices: The number of slices this task should be divided into. It defaults
3913
3951
  to one slice, which means the task isn't sliced into subtasks. Reindex supports
3914
3952
  sliced scroll to parallelize the reindexing process. This parallelization
@@ -3973,8 +4011,6 @@ class Elasticsearch(BaseClient):
3973
4011
  __body["max_docs"] = max_docs
3974
4012
  if script is not None:
3975
4013
  __body["script"] = script
3976
- if size is not None:
3977
- __body["size"] = size
3978
4014
  __headers = {"accept": "application/json", "content-type": "application/json"}
3979
4015
  return self.perform_request( # type: ignore[return-value]
3980
4016
  "POST",
@@ -4101,11 +4137,7 @@ class Elasticsearch(BaseClient):
4101
4137
  __body["params"] = params
4102
4138
  if source is not None:
4103
4139
  __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"
4140
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4109
4141
  return self.perform_request( # type: ignore[return-value]
4110
4142
  "POST",
4111
4143
  __path,
@@ -4188,11 +4220,7 @@ class Elasticsearch(BaseClient):
4188
4220
  __body["context_setup"] = context_setup
4189
4221
  if script is not None:
4190
4222
  __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"
4223
+ __headers = {"accept": "application/json", "content-type": "application/json"}
4196
4224
  return self.perform_request( # type: ignore[return-value]
4197
4225
  "POST",
4198
4226
  __path,
@@ -4317,6 +4345,7 @@ class Elasticsearch(BaseClient):
4317
4345
  ),
4318
4346
  parameter_aliases={
4319
4347
  "_source": "source",
4348
+ "_source_exclude_vectors": "source_exclude_vectors",
4320
4349
  "_source_excludes": "source_excludes",
4321
4350
  "_source_includes": "source_includes",
4322
4351
  "from": "from_",
@@ -4371,6 +4400,7 @@ class Elasticsearch(BaseClient):
4371
4400
  preference: t.Optional[str] = None,
4372
4401
  pretty: t.Optional[bool] = None,
4373
4402
  profile: t.Optional[bool] = None,
4403
+ project_routing: t.Optional[str] = None,
4374
4404
  q: t.Optional[str] = None,
4375
4405
  query: t.Optional[t.Mapping[str, t.Any]] = None,
4376
4406
  rank: t.Optional[t.Mapping[str, t.Any]] = None,
@@ -4400,6 +4430,7 @@ class Elasticsearch(BaseClient):
4400
4430
  ]
4401
4431
  ] = None,
4402
4432
  source: t.Optional[t.Union[bool, t.Mapping[str, t.Any]]] = None,
4433
+ source_exclude_vectors: t.Optional[bool] = None,
4403
4434
  source_excludes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4404
4435
  source_includes: t.Optional[t.Union[str, t.Sequence[str]]] = None,
4405
4436
  stats: t.Optional[t.Sequence[str]] = None,
@@ -4467,8 +4498,8 @@ class Elasticsearch(BaseClient):
4467
4498
  node and the remote clusters are minimized when running cross-cluster search
4468
4499
  (CCS) requests.
4469
4500
  :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
4501
+ :param default_operator: The default operator for the query string query: `and`
4502
+ or `or`. This parameter can be used only when the `q` query string parameter
4472
4503
  is specified.
4473
4504
  :param df: The field to use as a default when no field prefix is given in the
4474
4505
  query string. This parameter can be used only when the `q` query string parameter
@@ -4553,6 +4584,10 @@ class Elasticsearch(BaseClient):
4553
4584
  :param profile: Set to `true` to return detailed timing information about the
4554
4585
  execution of individual components in a search request. NOTE: This is a debugging
4555
4586
  tool and adds significant overhead to search execution.
4587
+ :param project_routing: Specifies a subset of projects to target for the search
4588
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
4589
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
4590
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
4556
4591
  :param q: A query in the Lucene query string syntax. Query parameter searches
4557
4592
  do not support the full Elasticsearch Query DSL but are handy for testing.
4558
4593
  IMPORTANT: This parameter overrides the query parameter in the request body.
@@ -4594,6 +4629,7 @@ class Elasticsearch(BaseClient):
4594
4629
  fields are returned in the `hits._source` property of the search response.
4595
4630
  If the `stored_fields` property is specified, the `_source` property defaults
4596
4631
  to `false`. Otherwise, it defaults to `true`.
4632
+ :param source_exclude_vectors: Whether vectors should be excluded from _source
4597
4633
  :param source_excludes: A comma-separated list of source fields to exclude from
4598
4634
  the response. You can also use this parameter to exclude fields from the
4599
4635
  subset specified in `_source_includes` query parameter. If the `_source`
@@ -4706,6 +4742,8 @@ class Elasticsearch(BaseClient):
4706
4742
  __query["preference"] = preference
4707
4743
  if pretty is not None:
4708
4744
  __query["pretty"] = pretty
4745
+ if project_routing is not None:
4746
+ __query["project_routing"] = project_routing
4709
4747
  if q is not None:
4710
4748
  __query["q"] = q
4711
4749
  if request_cache is not None:
@@ -4718,6 +4756,8 @@ class Elasticsearch(BaseClient):
4718
4756
  __query["scroll"] = scroll
4719
4757
  if search_type is not None:
4720
4758
  __query["search_type"] = search_type
4759
+ if source_exclude_vectors is not None:
4760
+ __query["_source_exclude_vectors"] = source_exclude_vectors
4721
4761
  if source_excludes is not None:
4722
4762
  __query["_source_excludes"] = source_excludes
4723
4763
  if source_includes is not None:
@@ -4858,6 +4898,7 @@ class Elasticsearch(BaseClient):
4858
4898
  ] = None,
4859
4899
  human: t.Optional[bool] = None,
4860
4900
  pretty: t.Optional[bool] = None,
4901
+ project_routing: t.Optional[str] = None,
4861
4902
  query: t.Optional[t.Mapping[str, t.Any]] = None,
4862
4903
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
4863
4904
  size: t.Optional[int] = None,
@@ -5175,6 +5216,10 @@ class Elasticsearch(BaseClient):
5175
5216
  In the aggs layer, each feature represents a `geotile_grid` cell. If `grid,
5176
5217
  each feature is a polygon of the cells bounding box. If `point`, each feature
5177
5218
  is a Point that is the centroid of the cell.
5219
+ :param project_routing: Specifies a subset of projects to target for the search
5220
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
5221
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
5222
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
5178
5223
  :param query: The query DSL used to filter documents for the search.
5179
5224
  :param runtime_mappings: Defines one or more runtime fields in the search request.
5180
5225
  These fields take precedence over mapped fields with the same name.
@@ -5238,6 +5283,8 @@ class Elasticsearch(BaseClient):
5238
5283
  __query["human"] = human
5239
5284
  if pretty is not None:
5240
5285
  __query["pretty"] = pretty
5286
+ if project_routing is not None:
5287
+ __query["project_routing"] = project_routing
5241
5288
  if not __body:
5242
5289
  if aggs is not None:
5243
5290
  __body["aggs"] = aggs
@@ -5411,6 +5458,7 @@ class Elasticsearch(BaseClient):
5411
5458
  preference: t.Optional[str] = None,
5412
5459
  pretty: t.Optional[bool] = None,
5413
5460
  profile: t.Optional[bool] = None,
5461
+ project_routing: t.Optional[str] = None,
5414
5462
  rest_total_hits_as_int: t.Optional[bool] = None,
5415
5463
  routing: t.Optional[str] = None,
5416
5464
  scroll: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
@@ -5456,6 +5504,10 @@ class Elasticsearch(BaseClient):
5456
5504
  :param preference: The node or shard the operation should be performed on. It
5457
5505
  is random by default.
5458
5506
  :param profile: If `true`, the query execution is profiled.
5507
+ :param project_routing: Specifies a subset of projects to target for the search
5508
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
5509
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
5510
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
5459
5511
  :param rest_total_hits_as_int: If `true`, `hits.total` is rendered as an integer
5460
5512
  in the response. If `false`, it is rendered as an object.
5461
5513
  :param routing: A custom value used to route operations to a specific shard.
@@ -5497,6 +5549,8 @@ class Elasticsearch(BaseClient):
5497
5549
  __query["preference"] = preference
5498
5550
  if pretty is not None:
5499
5551
  __query["pretty"] = pretty
5552
+ if project_routing is not None:
5553
+ __query["project_routing"] = project_routing
5500
5554
  if rest_total_hits_as_int is not None:
5501
5555
  __query["rest_total_hits_as_int"] = rest_total_hits_as_int
5502
5556
  if routing is not None:
@@ -5623,11 +5677,7 @@ class Elasticsearch(BaseClient):
5623
5677
  __body["string"] = string
5624
5678
  if timeout is not None:
5625
5679
  __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"
5680
+ __headers = {"accept": "application/json", "content-type": "application/json"}
5631
5681
  return self.perform_request( # type: ignore[return-value]
5632
5682
  "POST",
5633
5683
  __path,
@@ -5677,7 +5727,7 @@ class Elasticsearch(BaseClient):
5677
5727
  term_statistics: t.Optional[bool] = None,
5678
5728
  version: t.Optional[int] = None,
5679
5729
  version_type: t.Optional[
5680
- t.Union[str, t.Literal["external", "external_gte", "force", "internal"]]
5730
+ t.Union[str, t.Literal["external", "external_gte", "internal"]]
5681
5731
  ] = None,
5682
5732
  body: t.Optional[t.Dict[str, t.Any]] = None,
5683
5733
  ) -> ObjectApiResponse[t.Any]:
@@ -6153,8 +6203,8 @@ class Elasticsearch(BaseClient):
6153
6203
  be used only when the `q` query string parameter is specified.
6154
6204
  :param conflicts: The preferred behavior when update by query hits version conflicts:
6155
6205
  `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
6206
+ :param default_operator: The default operator for query string query: `and` or
6207
+ `or`. This parameter can be used only when the `q` query string parameter
6158
6208
  is specified.
6159
6209
  :param df: The field to use as default where no field prefix is given in the
6160
6210
  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:
@@ -488,6 +488,7 @@ class CatClient(NamespacedClient):
488
488
  help: t.Optional[bool] = None,
489
489
  human: t.Optional[bool] = None,
490
490
  pretty: t.Optional[bool] = None,
491
+ project_routing: t.Optional[str] = None,
491
492
  s: t.Optional[t.Union[str, t.Sequence[str]]] = None,
492
493
  time: t.Optional[
493
494
  t.Union[str, t.Literal["d", "h", "m", "micros", "ms", "nanos", "s"]]
@@ -523,6 +524,10 @@ class CatClient(NamespacedClient):
523
524
  wildcards.
524
525
  :param help: When set to `true` will output available columns. This option can't
525
526
  be combined with any other query string option.
527
+ :param project_routing: Specifies a subset of projects to target for the search
528
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
529
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
530
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
526
531
  :param s: List of columns that determine how the table should be sorted. Sorting
527
532
  defaults to ascending and can be changed by setting `:asc` or `:desc` as
528
533
  a suffix to the column name.
@@ -558,6 +563,8 @@ class CatClient(NamespacedClient):
558
563
  __query["human"] = human
559
564
  if pretty is not None:
560
565
  __query["pretty"] = pretty
566
+ if project_routing is not None:
567
+ __query["project_routing"] = project_routing
561
568
  if s is not None:
562
569
  __query["s"] = s
563
570
  if time is not None:
@@ -2502,7 +2509,7 @@ class CatClient(NamespacedClient):
2502
2509
  error_trace: t.Optional[bool] = None,
2503
2510
  filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
2504
2511
  format: t.Optional[str] = None,
2505
- full_id: t.Optional[t.Union[bool, str]] = None,
2512
+ full_id: t.Optional[bool] = None,
2506
2513
  h: t.Optional[
2507
2514
  t.Union[
2508
2515
  t.Sequence[
@@ -49,6 +49,7 @@ class ClusterClient(NamespacedClient):
49
49
 
50
50
  <p>Explain the shard allocations.
51
51
  Get explanations for shard allocations in the cluster.
52
+ This API accepts the current_node, index, primary and shard parameters in the request body or in query parameters, but not in both at the same time.
52
53
  For unassigned shards, it provides an explanation for why the shard is unassigned.
53
54
  For assigned shards, it provides an explanation for why the shard is remaining on its current node and has not moved or rebalanced to another node.
54
55
  This API can be very useful when attempting to diagnose why a shard is unassigned or why a shard continues to remain on its current node when you might expect otherwise.
@@ -57,17 +58,16 @@ class ClusterClient(NamespacedClient):
57
58
 
58
59
  `<https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cluster-allocation-explain>`_
59
60
 
60
- :param current_node: Specifies the node ID or the name of the node to only explain
61
- a shard that is currently located on the specified node.
61
+ :param current_node: Explain a shard only if it is currently located on the specified
62
+ node name or node ID.
62
63
  :param include_disk_info: If true, returns information about disk usage and shard
63
64
  sizes.
64
65
  :param include_yes_decisions: If true, returns YES decisions in explanation.
65
- :param index: Specifies the name of the index that you would like an explanation
66
- for.
66
+ :param index: The name of the index that you would like an explanation for.
67
67
  :param master_timeout: Period to wait for a connection to the master node.
68
- :param primary: If true, returns explanation for the primary shard for the given
69
- shard ID.
70
- :param shard: Specifies the ID of the shard that you would like an explanation
68
+ :param primary: If true, returns an explanation for the primary shard for the
69
+ specified shard ID.
70
+ :param shard: An identifier for the shard that you would like an explanation
71
71
  for.
72
72
  """
73
73
  __path_parts: t.Dict[str, str] = {}
@@ -1124,7 +1124,8 @@ class ClusterClient(NamespacedClient):
1124
1124
  when unavailable (missing or closed)
1125
1125
  :param local: Return local information, do not retrieve the state from master
1126
1126
  node (default: false)
1127
- :param master_timeout: Specify timeout for connection to master
1127
+ :param master_timeout: Timeout for waiting for new cluster state in case it is
1128
+ blocked
1128
1129
  :param wait_for_metadata_version: Wait for the metadata version to be equal or
1129
1130
  greater than the specified metadata version
1130
1131
  :param wait_for_timeout: The maximum time to wait for wait_for_metadata_version
@@ -229,6 +229,7 @@ class EqlClient(NamespacedClient):
229
229
  keep_on_completion: t.Optional[bool] = None,
230
230
  max_samples_per_key: t.Optional[int] = None,
231
231
  pretty: t.Optional[bool] = None,
232
+ project_routing: t.Optional[str] = None,
232
233
  result_position: t.Optional[t.Union[str, t.Literal["head", "tail"]]] = None,
233
234
  runtime_mappings: t.Optional[t.Mapping[str, t.Mapping[str, t.Any]]] = None,
234
235
  size: t.Optional[int] = None,
@@ -285,6 +286,10 @@ class EqlClient(NamespacedClient):
285
286
  `size` parameter to get a smaller or larger set of samples. To retrieve more
286
287
  than one sample per set of join keys, use the `max_samples_per_key` parameter.
287
288
  Pipes are not supported for sample queries.
289
+ :param project_routing: Specifies a subset of projects to target for the search
290
+ using project metadata tags in a subset of Lucene query syntax. Allowed Lucene
291
+ queries: the _alias tag and a single value (possibly wildcarded). Examples:
292
+ _alias:my-project _alias:_origin _alias:*pr* Supported in serverless only.
288
293
  :param result_position:
289
294
  :param runtime_mappings:
290
295
  :param size: For basic queries, the maximum number of matching events to return.
@@ -318,6 +323,8 @@ class EqlClient(NamespacedClient):
318
323
  __query["ignore_unavailable"] = ignore_unavailable
319
324
  if pretty is not None:
320
325
  __query["pretty"] = pretty
326
+ if project_routing is not None:
327
+ __query["project_routing"] = project_routing
321
328
  if not __body:
322
329
  if query is not None:
323
330
  __body["query"] = query