elasticsearch9 9.2.0__py3-none-any.whl → 9.3.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 (125) hide show
  1. elasticsearch9/_async/client/__init__.py +108 -85
  2. elasticsearch9/_async/client/async_search.py +7 -6
  3. elasticsearch9/_async/client/autoscaling.py +15 -4
  4. elasticsearch9/_async/client/cat.py +203 -10
  5. elasticsearch9/_async/client/ccr.py +10 -10
  6. elasticsearch9/_async/client/cluster.py +98 -66
  7. elasticsearch9/_async/client/connector.py +42 -41
  8. elasticsearch9/_async/client/dangling_indices.py +8 -12
  9. elasticsearch9/_async/client/enrich.py +10 -10
  10. elasticsearch9/_async/client/eql.py +17 -16
  11. elasticsearch9/_async/client/esql.py +173 -24
  12. elasticsearch9/_async/client/features.py +6 -6
  13. elasticsearch9/_async/client/fleet.py +8 -8
  14. elasticsearch9/_async/client/graph.py +3 -3
  15. elasticsearch9/_async/client/ilm.py +18 -18
  16. elasticsearch9/_async/client/indices.py +564 -149
  17. elasticsearch9/_async/client/inference.py +374 -64
  18. elasticsearch9/_async/client/ingest.py +9 -9
  19. elasticsearch9/_async/client/license.py +5 -7
  20. elasticsearch9/_async/client/logstash.py +4 -4
  21. elasticsearch9/_async/client/migration.py +6 -6
  22. elasticsearch9/_async/client/ml.py +132 -88
  23. elasticsearch9/_async/client/monitoring.py +4 -3
  24. elasticsearch9/_async/client/nodes.py +182 -20
  25. elasticsearch9/_async/client/project.py +13 -4
  26. elasticsearch9/_async/client/query_rules.py +16 -16
  27. elasticsearch9/_async/client/rollup.py +21 -21
  28. elasticsearch9/_async/client/search_application.py +19 -19
  29. elasticsearch9/_async/client/searchable_snapshots.py +10 -10
  30. elasticsearch9/_async/client/security.py +34 -10
  31. elasticsearch9/_async/client/shutdown.py +15 -4
  32. elasticsearch9/_async/client/simulate.py +4 -4
  33. elasticsearch9/_async/client/slm.py +17 -17
  34. elasticsearch9/_async/client/snapshot.py +21 -21
  35. elasticsearch9/_async/client/sql.py +17 -16
  36. elasticsearch9/_async/client/streams.py +6 -7
  37. elasticsearch9/_async/client/synonyms.py +10 -10
  38. elasticsearch9/_async/client/tasks.py +8 -8
  39. elasticsearch9/_async/client/text_structure.py +16 -12
  40. elasticsearch9/_async/client/transform.py +51 -12
  41. elasticsearch9/_async/client/utils.py +4 -2
  42. elasticsearch9/_async/client/watcher.py +26 -26
  43. elasticsearch9/_async/client/xpack.py +6 -5
  44. elasticsearch9/_sync/client/__init__.py +110 -85
  45. elasticsearch9/_sync/client/async_search.py +7 -6
  46. elasticsearch9/_sync/client/autoscaling.py +15 -4
  47. elasticsearch9/_sync/client/cat.py +203 -10
  48. elasticsearch9/_sync/client/ccr.py +10 -10
  49. elasticsearch9/_sync/client/cluster.py +98 -66
  50. elasticsearch9/_sync/client/connector.py +42 -41
  51. elasticsearch9/_sync/client/dangling_indices.py +8 -12
  52. elasticsearch9/_sync/client/enrich.py +10 -10
  53. elasticsearch9/_sync/client/eql.py +17 -16
  54. elasticsearch9/_sync/client/esql.py +173 -24
  55. elasticsearch9/_sync/client/features.py +6 -6
  56. elasticsearch9/_sync/client/fleet.py +8 -8
  57. elasticsearch9/_sync/client/graph.py +3 -3
  58. elasticsearch9/_sync/client/ilm.py +18 -18
  59. elasticsearch9/_sync/client/indices.py +564 -149
  60. elasticsearch9/_sync/client/inference.py +374 -64
  61. elasticsearch9/_sync/client/ingest.py +9 -9
  62. elasticsearch9/_sync/client/license.py +5 -7
  63. elasticsearch9/_sync/client/logstash.py +4 -4
  64. elasticsearch9/_sync/client/migration.py +6 -6
  65. elasticsearch9/_sync/client/ml.py +132 -88
  66. elasticsearch9/_sync/client/monitoring.py +4 -3
  67. elasticsearch9/_sync/client/nodes.py +182 -20
  68. elasticsearch9/_sync/client/project.py +13 -4
  69. elasticsearch9/_sync/client/project_routing.py +264 -0
  70. elasticsearch9/_sync/client/query_rules.py +16 -16
  71. elasticsearch9/_sync/client/rollup.py +21 -21
  72. elasticsearch9/_sync/client/search_application.py +19 -19
  73. elasticsearch9/_sync/client/searchable_snapshots.py +10 -10
  74. elasticsearch9/_sync/client/security.py +34 -10
  75. elasticsearch9/_sync/client/shutdown.py +15 -4
  76. elasticsearch9/_sync/client/simulate.py +4 -4
  77. elasticsearch9/_sync/client/slm.py +17 -17
  78. elasticsearch9/_sync/client/snapshot.py +21 -21
  79. elasticsearch9/_sync/client/sql.py +17 -16
  80. elasticsearch9/_sync/client/streams.py +6 -7
  81. elasticsearch9/_sync/client/synonyms.py +10 -10
  82. elasticsearch9/_sync/client/tasks.py +8 -8
  83. elasticsearch9/_sync/client/text_structure.py +16 -12
  84. elasticsearch9/_sync/client/transform.py +51 -12
  85. elasticsearch9/_sync/client/utils.py +16 -2
  86. elasticsearch9/_sync/client/watcher.py +26 -26
  87. elasticsearch9/_sync/client/xpack.py +6 -5
  88. elasticsearch9/_version.py +2 -2
  89. elasticsearch9/dsl/__init__.py +4 -0
  90. elasticsearch9/dsl/_async/document.py +4 -5
  91. elasticsearch9/dsl/_async/index.py +1 -1
  92. elasticsearch9/dsl/_async/search.py +2 -3
  93. elasticsearch9/dsl/_sync/document.py +4 -5
  94. elasticsearch9/dsl/_sync/index.py +1 -1
  95. elasticsearch9/dsl/_sync/search.py +2 -3
  96. elasticsearch9/dsl/aggs.py +9 -9
  97. elasticsearch9/dsl/async_connections.py +1 -2
  98. elasticsearch9/dsl/connections.py +1 -2
  99. elasticsearch9/dsl/document_base.py +1 -1
  100. elasticsearch9/dsl/field.py +90 -6
  101. elasticsearch9/dsl/pydantic.py +1 -1
  102. elasticsearch9/dsl/query.py +25 -2
  103. elasticsearch9/dsl/response/__init__.py +2 -0
  104. elasticsearch9/dsl/serializer.py +1 -2
  105. elasticsearch9/dsl/types.py +63 -8
  106. elasticsearch9/dsl/utils.py +12 -4
  107. elasticsearch9/esql/esql.py +1 -1
  108. elasticsearch9/esql/functions.py +926 -252
  109. elasticsearch9/helpers/__init__.py +2 -0
  110. elasticsearch9/helpers/actions.py +21 -0
  111. elasticsearch9/helpers/vectorstore/__init__.py +7 -7
  112. elasticsearch9/helpers/vectorstore/_async/_utils.py +1 -1
  113. elasticsearch9/helpers/vectorstore/_async/embedding_service.py +2 -2
  114. elasticsearch9/helpers/vectorstore/_async/strategies.py +3 -3
  115. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +8 -5
  116. elasticsearch9/helpers/vectorstore/_sync/_utils.py +1 -1
  117. elasticsearch9/helpers/vectorstore/_sync/embedding_service.py +2 -2
  118. elasticsearch9/helpers/vectorstore/_sync/strategies.py +3 -3
  119. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +8 -5
  120. {elasticsearch9-9.2.0.dist-info → elasticsearch9-9.3.0.dist-info}/METADATA +2 -1
  121. elasticsearch9-9.3.0.dist-info/RECORD +169 -0
  122. {elasticsearch9-9.2.0.dist-info → elasticsearch9-9.3.0.dist-info}/WHEEL +1 -1
  123. elasticsearch9-9.2.0.dist-info/RECORD +0 -168
  124. {elasticsearch9-9.2.0.dist-info → elasticsearch9-9.3.0.dist-info}/licenses/LICENSE +0 -0
  125. {elasticsearch9-9.2.0.dist-info → elasticsearch9-9.3.0.dist-info}/licenses/NOTICE +0 -0
@@ -1568,7 +1568,9 @@ class DenseVector(Field):
1568
1568
  self,
1569
1569
  *args: Any,
1570
1570
  dims: Union[int, "DefaultType"] = DEFAULT,
1571
- element_type: Union[Literal["bit", "byte", "float"], "DefaultType"] = DEFAULT,
1571
+ element_type: Union[
1572
+ Literal["bit", "byte", "float", "bfloat16"], "DefaultType"
1573
+ ] = DEFAULT,
1572
1574
  index: Union[bool, "DefaultType"] = DEFAULT,
1573
1575
  index_options: Union[
1574
1576
  "types.DenseVectorIndexOptions", Dict[str, Any], "DefaultType"
@@ -1616,11 +1618,33 @@ class DenseVector(Field):
1616
1618
  kwargs["multi"] = True
1617
1619
  super().__init__(*args, **kwargs)
1618
1620
 
1619
- def _deserialize(self, data: Any) -> Any:
1620
- if self._element_type == "float":
1621
- return float(data)
1622
- elif self._element_type == "byte":
1623
- return int(data)
1621
+
1622
+ class NumpyDenseVector(DenseVector):
1623
+ """A dense vector field that uses numpy arrays.
1624
+
1625
+ Accepts the same arguments as class ``DenseVector`` plus:
1626
+
1627
+ :arg dtype: The numpy data type to use for the array. If not given, numpy will select the type based on the data.
1628
+ """
1629
+
1630
+ def __init__(self, *args: Any, dtype: Optional[type] = None, **kwargs: Any):
1631
+ super().__init__(*args, **kwargs)
1632
+ self._dtype = dtype
1633
+
1634
+ def deserialize(self, data: Any) -> Any:
1635
+ if isinstance(data, list):
1636
+ import numpy as np
1637
+
1638
+ return np.array(data, dtype=self._dtype)
1639
+ return super().deserialize(data)
1640
+
1641
+ def clean(self, data: Any) -> Any:
1642
+ # this method does the same as the one in the parent classes, but it
1643
+ # avoids comparisons that do not work for numpy arrays
1644
+ if data is not None:
1645
+ data = self.deserialize(data)
1646
+ if (data is None or len(data) == 0) and self._required:
1647
+ raise ValidationException("Value required for this field.")
1624
1648
  return data
1625
1649
 
1626
1650
 
@@ -1808,6 +1832,59 @@ class DoubleRange(RangeField):
1808
1832
  super().__init__(*args, **kwargs)
1809
1833
 
1810
1834
 
1835
+ class ExponentialHistogram(Field):
1836
+ """
1837
+ :arg time_series_metric:
1838
+ :arg meta: Metadata about the field.
1839
+ :arg properties:
1840
+ :arg ignore_above:
1841
+ :arg dynamic:
1842
+ :arg fields:
1843
+ :arg synthetic_source_keep:
1844
+ """
1845
+
1846
+ name = "exponential_histogram"
1847
+ _param_defs = {
1848
+ "properties": {"type": "field", "hash": True},
1849
+ "fields": {"type": "field", "hash": True},
1850
+ }
1851
+
1852
+ def __init__(
1853
+ self,
1854
+ *args: Any,
1855
+ time_series_metric: Union[
1856
+ Literal["gauge", "counter", "summary", "histogram", "position"],
1857
+ "DefaultType",
1858
+ ] = DEFAULT,
1859
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1860
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1861
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1862
+ dynamic: Union[
1863
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1864
+ ] = DEFAULT,
1865
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1866
+ synthetic_source_keep: Union[
1867
+ Literal["none", "arrays", "all"], "DefaultType"
1868
+ ] = DEFAULT,
1869
+ **kwargs: Any,
1870
+ ):
1871
+ if time_series_metric is not DEFAULT:
1872
+ kwargs["time_series_metric"] = time_series_metric
1873
+ if meta is not DEFAULT:
1874
+ kwargs["meta"] = meta
1875
+ if properties is not DEFAULT:
1876
+ kwargs["properties"] = properties
1877
+ if ignore_above is not DEFAULT:
1878
+ kwargs["ignore_above"] = ignore_above
1879
+ if dynamic is not DEFAULT:
1880
+ kwargs["dynamic"] = dynamic
1881
+ if fields is not DEFAULT:
1882
+ kwargs["fields"] = fields
1883
+ if synthetic_source_keep is not DEFAULT:
1884
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1885
+ super().__init__(*args, **kwargs)
1886
+
1887
+
1811
1888
  class Flattened(Field):
1812
1889
  """
1813
1890
  :arg boost:
@@ -2277,6 +2354,7 @@ class HalfFloat(Float):
2277
2354
  class Histogram(Field):
2278
2355
  """
2279
2356
  :arg ignore_malformed:
2357
+ :arg time_series_metric:
2280
2358
  :arg meta: Metadata about the field.
2281
2359
  :arg properties:
2282
2360
  :arg ignore_above:
@@ -2295,6 +2373,10 @@ class Histogram(Field):
2295
2373
  self,
2296
2374
  *args: Any,
2297
2375
  ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2376
+ time_series_metric: Union[
2377
+ Literal["gauge", "counter", "summary", "histogram", "position"],
2378
+ "DefaultType",
2379
+ ] = DEFAULT,
2298
2380
  meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2299
2381
  properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2300
2382
  ignore_above: Union[int, "DefaultType"] = DEFAULT,
@@ -2309,6 +2391,8 @@ class Histogram(Field):
2309
2391
  ):
2310
2392
  if ignore_malformed is not DEFAULT:
2311
2393
  kwargs["ignore_malformed"] = ignore_malformed
2394
+ if time_series_metric is not DEFAULT:
2395
+ kwargs["time_series_metric"] = time_series_metric
2312
2396
  if meta is not DEFAULT:
2313
2397
  kwargs["meta"] = meta
2314
2398
  if properties is not DEFAULT:
@@ -20,7 +20,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Tuple, Type
20
20
  from pydantic import BaseModel, Field, PrivateAttr
21
21
  from typing_extensions import Annotated, Self, dataclass_transform
22
22
 
23
- from elasticsearch import dsl
23
+ from .. import dsl
24
24
 
25
25
 
26
26
  class ESMeta(BaseModel):
@@ -370,6 +370,7 @@ class Common(Query):
370
370
  _value: Union[
371
371
  "types.CommonTermsQuery", Dict[str, Any], "DefaultType"
372
372
  ] = DEFAULT,
373
+ /,
373
374
  **kwargs: Any,
374
375
  ):
375
376
  if _field is not DEFAULT:
@@ -666,6 +667,7 @@ class Fuzzy(Query):
666
667
  self,
667
668
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
668
669
  _value: Union["types.FuzzyQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
670
+ /,
669
671
  **kwargs: Any,
670
672
  ):
671
673
  if _field is not DEFAULT:
@@ -708,6 +710,7 @@ class GeoBoundingBox(Query):
708
710
  Dict[str, Any],
709
711
  "DefaultType",
710
712
  ] = DEFAULT,
713
+ /,
711
714
  *,
712
715
  type: Union[Literal["memory", "indexed"], "DefaultType"] = DEFAULT,
713
716
  validation_method: Union[
@@ -771,6 +774,7 @@ class GeoDistance(Query):
771
774
  Dict[str, Any],
772
775
  "DefaultType",
773
776
  ] = DEFAULT,
777
+ /,
774
778
  *,
775
779
  distance: Union[str, "DefaultType"] = DEFAULT,
776
780
  distance_type: Union[Literal["arc", "plane"], "DefaultType"] = DEFAULT,
@@ -810,6 +814,7 @@ class GeoGrid(Query):
810
814
  self,
811
815
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
812
816
  _value: Union["types.GeoGridQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
817
+ /,
813
818
  **kwargs: Any,
814
819
  ):
815
820
  if _field is not DEFAULT:
@@ -839,6 +844,7 @@ class GeoPolygon(Query):
839
844
  _value: Union[
840
845
  "types.GeoPolygonPoints", Dict[str, Any], "DefaultType"
841
846
  ] = DEFAULT,
847
+ /,
842
848
  *,
843
849
  validation_method: Union[
844
850
  Literal["coerce", "ignore_malformed", "strict"], "DefaultType"
@@ -885,6 +891,7 @@ class GeoShape(Query):
885
891
  _value: Union[
886
892
  "types.GeoShapeFieldQuery", Dict[str, Any], "DefaultType"
887
893
  ] = DEFAULT,
894
+ /,
888
895
  *,
889
896
  ignore_unmapped: Union[bool, "DefaultType"] = DEFAULT,
890
897
  boost: Union[float, "DefaultType"] = DEFAULT,
@@ -1060,6 +1067,7 @@ class Intervals(Query):
1060
1067
  self,
1061
1068
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
1062
1069
  _value: Union["types.IntervalsQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
1070
+ /,
1063
1071
  **kwargs: Any,
1064
1072
  ):
1065
1073
  if _field is not DEFAULT:
@@ -1151,6 +1159,7 @@ class Match(Query):
1151
1159
  self,
1152
1160
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
1153
1161
  _value: Union["types.MatchQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
1162
+ /,
1154
1163
  **kwargs: Any,
1155
1164
  ):
1156
1165
  if _field is not DEFAULT:
@@ -1216,6 +1225,7 @@ class MatchBoolPrefix(Query):
1216
1225
  _value: Union[
1217
1226
  "types.MatchBoolPrefixQuery", Dict[str, Any], "DefaultType"
1218
1227
  ] = DEFAULT,
1228
+ /,
1219
1229
  **kwargs: Any,
1220
1230
  ):
1221
1231
  if _field is not DEFAULT:
@@ -1276,6 +1286,7 @@ class MatchPhrase(Query):
1276
1286
  _value: Union[
1277
1287
  "types.MatchPhraseQuery", Dict[str, Any], "DefaultType"
1278
1288
  ] = DEFAULT,
1289
+ /,
1279
1290
  **kwargs: Any,
1280
1291
  ):
1281
1292
  if _field is not DEFAULT:
@@ -1301,6 +1312,7 @@ class MatchPhrasePrefix(Query):
1301
1312
  _value: Union[
1302
1313
  "types.MatchPhrasePrefixQuery", Dict[str, Any], "DefaultType"
1303
1314
  ] = DEFAULT,
1315
+ /,
1304
1316
  **kwargs: Any,
1305
1317
  ):
1306
1318
  if _field is not DEFAULT:
@@ -1385,7 +1397,7 @@ class MoreLikeThis(Query):
1385
1397
  minimum_should_match: Union[int, str, "DefaultType"] = DEFAULT,
1386
1398
  min_term_freq: Union[int, "DefaultType"] = DEFAULT,
1387
1399
  min_word_length: Union[int, "DefaultType"] = DEFAULT,
1388
- routing: Union[str, "DefaultType"] = DEFAULT,
1400
+ routing: Union[str, Sequence[str], "DefaultType"] = DEFAULT,
1389
1401
  stop_words: Union[
1390
1402
  Literal[
1391
1403
  "_arabic_",
@@ -1707,7 +1719,7 @@ class Percolate(Query):
1707
1719
  index: Union[str, "DefaultType"] = DEFAULT,
1708
1720
  name: Union[str, "DefaultType"] = DEFAULT,
1709
1721
  preference: Union[str, "DefaultType"] = DEFAULT,
1710
- routing: Union[str, "DefaultType"] = DEFAULT,
1722
+ routing: Union[str, Sequence[str], "DefaultType"] = DEFAULT,
1711
1723
  version: Union[int, "DefaultType"] = DEFAULT,
1712
1724
  boost: Union[float, "DefaultType"] = DEFAULT,
1713
1725
  _name: Union[str, "DefaultType"] = DEFAULT,
@@ -1784,6 +1796,7 @@ class Prefix(Query):
1784
1796
  self,
1785
1797
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
1786
1798
  _value: Union["types.PrefixQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
1799
+ /,
1787
1800
  **kwargs: Any,
1788
1801
  ):
1789
1802
  if _field is not DEFAULT:
@@ -1950,6 +1963,7 @@ class Range(Query):
1950
1963
  self,
1951
1964
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
1952
1965
  _value: Union["wrappers.Range[Any]", Dict[str, Any], "DefaultType"] = DEFAULT,
1966
+ /,
1953
1967
  **kwargs: Any,
1954
1968
  ):
1955
1969
  if _field is not DEFAULT:
@@ -2028,6 +2042,7 @@ class Regexp(Query):
2028
2042
  self,
2029
2043
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2030
2044
  _value: Union["types.RegexpQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2045
+ /,
2031
2046
  **kwargs: Any,
2032
2047
  ):
2033
2048
  if _field is not DEFAULT:
@@ -2198,6 +2213,7 @@ class Shape(Query):
2198
2213
  self,
2199
2214
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2200
2215
  _value: Union["types.ShapeFieldQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2216
+ /,
2201
2217
  *,
2202
2218
  ignore_unmapped: Union[bool, "DefaultType"] = DEFAULT,
2203
2219
  boost: Union[float, "DefaultType"] = DEFAULT,
@@ -2556,6 +2572,7 @@ class SpanTerm(Query):
2556
2572
  self,
2557
2573
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2558
2574
  _value: Union["types.SpanTermQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2575
+ /,
2559
2576
  **kwargs: Any,
2560
2577
  ):
2561
2578
  if _field is not DEFAULT:
@@ -2676,6 +2693,7 @@ class Term(Query):
2676
2693
  self,
2677
2694
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2678
2695
  _value: Union["types.TermQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2696
+ /,
2679
2697
  **kwargs: Any,
2680
2698
  ):
2681
2699
  if _field is not DEFAULT:
@@ -2710,6 +2728,7 @@ class Terms(Query):
2710
2728
  Dict[str, Any],
2711
2729
  "DefaultType",
2712
2730
  ] = DEFAULT,
2731
+ /,
2713
2732
  *,
2714
2733
  boost: Union[float, "DefaultType"] = DEFAULT,
2715
2734
  _name: Union[str, "DefaultType"] = DEFAULT,
@@ -2743,6 +2762,7 @@ class TermsSet(Query):
2743
2762
  self,
2744
2763
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2745
2764
  _value: Union["types.TermsSetQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2765
+ /,
2746
2766
  **kwargs: Any,
2747
2767
  ):
2748
2768
  if _field is not DEFAULT:
@@ -2768,6 +2788,7 @@ class TextExpansion(Query):
2768
2788
  _value: Union[
2769
2789
  "types.TextExpansionQuery", Dict[str, Any], "DefaultType"
2770
2790
  ] = DEFAULT,
2791
+ /,
2771
2792
  **kwargs: Any,
2772
2793
  ):
2773
2794
  if _field is not DEFAULT:
@@ -2792,6 +2813,7 @@ class WeightedTokens(Query):
2792
2813
  _value: Union[
2793
2814
  "types.WeightedTokensQuery", Dict[str, Any], "DefaultType"
2794
2815
  ] = DEFAULT,
2816
+ /,
2795
2817
  **kwargs: Any,
2796
2818
  ):
2797
2819
  if _field is not DEFAULT:
@@ -2813,6 +2835,7 @@ class Wildcard(Query):
2813
2835
  self,
2814
2836
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2815
2837
  _value: Union["types.WildcardQuery", Dict[str, Any], "DefaultType"] = DEFAULT,
2838
+ /,
2816
2839
  **kwargs: Any,
2817
2840
  ):
2818
2841
  if _field is not DEFAULT:
@@ -338,6 +338,7 @@ class UpdateByQueryResponse(AttrDict[Any], Generic[_R]):
338
338
  :arg retries: The number of retries attempted by update by query.
339
339
  `bulk` is the number of bulk actions retried. `search` is the
340
340
  number of search actions retried.
341
+ :arg slices: Status of each slice if the update by query was sliced
341
342
  :arg task:
342
343
  :arg timed_out: If true, some requests timed out during the update by
343
344
  query.
@@ -366,6 +367,7 @@ class UpdateByQueryResponse(AttrDict[Any], Generic[_R]):
366
367
  deleted: int
367
368
  requests_per_second: float
368
369
  retries: "types.Retries"
370
+ slices: Sequence["types.ReindexStatus"]
369
371
  task: str
370
372
  timed_out: bool
371
373
  took: Any
@@ -17,8 +17,7 @@
17
17
 
18
18
  from typing import Any
19
19
 
20
- from elasticsearch.serializer import JSONSerializer
21
-
20
+ from ..serializer import JSONSerializer
22
21
  from .utils import AttrList
23
22
 
24
23
 
@@ -401,7 +401,8 @@ class DenseVectorIndexOptions(AttrDict[Any]):
401
401
  applicable to `bbq_disk`, `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`,
402
402
  `bbq_flat`, `int4_flat`, and `int8_flat` index types.
403
403
  :arg on_disk_rescore: `true` if vector rescoring should be done on-
404
- disk Only applicable to `bbq_hnsw`
404
+ disk Only applicable to `bbq_disk`, `bbq_hnsw`, `int4_hnsw`,
405
+ `int8_hnsw`
405
406
  """
406
407
 
407
408
  type: Union[
@@ -608,7 +609,7 @@ class FieldLookup(AttrDict[Any]):
608
609
  id: Union[str, DefaultType]
609
610
  index: Union[str, DefaultType]
610
611
  path: Union[str, InstrumentedField, DefaultType]
611
- routing: Union[str, DefaultType]
612
+ routing: Union[str, Sequence[str], DefaultType]
612
613
 
613
614
  def __init__(
614
615
  self,
@@ -616,7 +617,7 @@ class FieldLookup(AttrDict[Any]):
616
617
  id: Union[str, DefaultType] = DEFAULT,
617
618
  index: Union[str, DefaultType] = DEFAULT,
618
619
  path: Union[str, InstrumentedField, DefaultType] = DEFAULT,
619
- routing: Union[str, DefaultType] = DEFAULT,
620
+ routing: Union[str, Sequence[str], DefaultType] = DEFAULT,
620
621
  **kwargs: Any,
621
622
  ):
622
623
  if id is not DEFAULT:
@@ -947,6 +948,7 @@ class GeoDistanceSort(AttrDict[Any]):
947
948
  Dict[str, Any],
948
949
  "DefaultType",
949
950
  ] = DEFAULT,
951
+ /,
950
952
  *,
951
953
  mode: Union[
952
954
  Literal["min", "max", "sum", "avg", "median"], DefaultType
@@ -2333,7 +2335,7 @@ class LikeDocument(AttrDict[Any]):
2333
2335
  _id: Union[str, DefaultType]
2334
2336
  _index: Union[str, DefaultType]
2335
2337
  per_field_analyzer: Union[Mapping[Union[str, InstrumentedField], str], DefaultType]
2336
- routing: Union[str, DefaultType]
2338
+ routing: Union[str, Sequence[str], DefaultType]
2337
2339
  version: Union[int, DefaultType]
2338
2340
  version_type: Union[Literal["internal", "external", "external_gte"], DefaultType]
2339
2341
 
@@ -2347,7 +2349,7 @@ class LikeDocument(AttrDict[Any]):
2347
2349
  per_field_analyzer: Union[
2348
2350
  Mapping[Union[str, InstrumentedField], str], DefaultType
2349
2351
  ] = DEFAULT,
2350
- routing: Union[str, DefaultType] = DEFAULT,
2352
+ routing: Union[str, Sequence[str], DefaultType] = DEFAULT,
2351
2353
  version: Union[int, DefaultType] = DEFAULT,
2352
2354
  version_type: Union[
2353
2355
  Literal["internal", "external", "external_gte"], DefaultType
@@ -3278,6 +3280,7 @@ class SortOptions(AttrDict[Any]):
3278
3280
  self,
3279
3281
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
3280
3282
  _value: Union["FieldSort", Dict[str, Any], "DefaultType"] = DEFAULT,
3283
+ /,
3281
3284
  *,
3282
3285
  _score: Union["ScoreSort", Dict[str, Any], DefaultType] = DEFAULT,
3283
3286
  _doc: Union["ScoreSort", Dict[str, Any], DefaultType] = DEFAULT,
@@ -3935,7 +3938,7 @@ class TermsLookup(AttrDict[Any]):
3935
3938
  index: Union[str, DefaultType]
3936
3939
  id: Union[str, DefaultType]
3937
3940
  path: Union[str, InstrumentedField, DefaultType]
3938
- routing: Union[str, DefaultType]
3941
+ routing: Union[str, Sequence[str], DefaultType]
3939
3942
 
3940
3943
  def __init__(
3941
3944
  self,
@@ -3943,7 +3946,7 @@ class TermsLookup(AttrDict[Any]):
3943
3946
  index: Union[str, DefaultType] = DEFAULT,
3944
3947
  id: Union[str, DefaultType] = DEFAULT,
3945
3948
  path: Union[str, InstrumentedField, DefaultType] = DEFAULT,
3946
- routing: Union[str, DefaultType] = DEFAULT,
3949
+ routing: Union[str, Sequence[str], DefaultType] = DEFAULT,
3947
3950
  **kwargs: Any,
3948
3951
  ):
3949
3952
  if index is not DEFAULT:
@@ -4898,7 +4901,7 @@ class CompletionSuggestOption(AttrDict[Any]):
4898
4901
  fields: Mapping[str, Any]
4899
4902
  _id: str
4900
4903
  _index: str
4901
- _routing: str
4904
+ _routing: Union[str, Sequence[str]]
4902
4905
  _score: float
4903
4906
  _source: Any
4904
4907
  score: float
@@ -6239,6 +6242,58 @@ class RateAggregate(AttrDict[Any]):
6239
6242
  meta: Mapping[str, Any]
6240
6243
 
6241
6244
 
6245
+ class ReindexStatus(AttrDict[Any]):
6246
+ """
6247
+ :arg batches: (required) The number of scroll responses pulled back by
6248
+ the reindex.
6249
+ :arg deleted: (required) The number of documents that were
6250
+ successfully deleted.
6251
+ :arg noops: (required) The number of documents that were ignored
6252
+ because the script used for the reindex returned a `noop` value
6253
+ for `ctx.op`.
6254
+ :arg requests_per_second: (required) The number of requests per second
6255
+ effectively executed during the reindex.
6256
+ :arg retries: (required) The number of retries attempted by reindex.
6257
+ `bulk` is the number of bulk actions retried and `search` is the
6258
+ number of search actions retried.
6259
+ :arg throttled_millis: (required) Number of milliseconds the request
6260
+ slept to conform to `requests_per_second`.
6261
+ :arg throttled_until_millis: (required) This field should always be
6262
+ equal to zero in a `_reindex` response. It only has meaning when
6263
+ using the Task API, where it indicates the next time (in
6264
+ milliseconds since epoch) a throttled request will be executed
6265
+ again in order to conform to `requests_per_second`.
6266
+ :arg total: (required) The number of documents that were successfully
6267
+ processed.
6268
+ :arg version_conflicts: (required) The number of version conflicts
6269
+ that reindex hits.
6270
+ :arg slice_id: The slice ID
6271
+ :arg created: The number of documents that were successfully created.
6272
+ :arg throttled:
6273
+ :arg throttled_until:
6274
+ :arg updated: The number of documents that were successfully updated,
6275
+ for example, a document with same ID already existed prior to
6276
+ reindex updating it.
6277
+ :arg cancelled: The reason for cancellation if the slice was canceled
6278
+ """
6279
+
6280
+ batches: int
6281
+ deleted: int
6282
+ noops: int
6283
+ requests_per_second: float
6284
+ retries: "Retries"
6285
+ throttled_millis: Any
6286
+ throttled_until_millis: Any
6287
+ total: int
6288
+ version_conflicts: int
6289
+ slice_id: int
6290
+ created: int
6291
+ throttled: Any
6292
+ throttled_until: Any
6293
+ updated: int
6294
+ cancelled: str
6295
+
6296
+
6242
6297
  class Retries(AttrDict[Any]):
6243
6298
  """
6244
6299
  :arg bulk: (required) The number of bulk actions retried.
@@ -44,8 +44,7 @@ from .exceptions import UnknownDslObject, ValidationException
44
44
  if TYPE_CHECKING:
45
45
  from elastic_transport import ObjectApiResponse
46
46
 
47
- from elasticsearch import AsyncElasticsearch, Elasticsearch
48
-
47
+ from .. import AsyncElasticsearch, Elasticsearch
49
48
  from .document_base import DocumentOptions
50
49
  from .field import Field
51
50
  from .index_base import IndexBase
@@ -612,8 +611,17 @@ class ObjectBase(AttrDict[Any]):
612
611
  if skip_empty:
613
612
  # don't serialize empty values
614
613
  # careful not to include numeric zeros
615
- if v in ([], {}, None):
616
- continue
614
+ try:
615
+ if v in ([], {}, None):
616
+ continue
617
+ except ValueError:
618
+ # the above fails when v is a numpy array
619
+ # try using len() instead
620
+ try:
621
+ if len(v) == 0:
622
+ continue
623
+ except TypeError:
624
+ pass
617
625
 
618
626
  out[k] = v
619
627
  return out
@@ -140,7 +140,7 @@ class ESQLBase(ABC):
140
140
  if re.fullmatch(r"[a-zA-Z_@][a-zA-Z0-9_\.]*", s):
141
141
  return s
142
142
  # this identifier needs to be escaped
143
- s.replace("`", "``")
143
+ s = s.replace("`", "``")
144
144
  return f"`{s}`"
145
145
 
146
146
  @staticmethod