elasticsearch 8.18.1__py3-none-any.whl → 8.19.1__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 (102) hide show
  1. elasticsearch/_async/client/__init__.py +68 -82
  2. elasticsearch/_async/client/async_search.py +5 -9
  3. elasticsearch/_async/client/autoscaling.py +4 -4
  4. elasticsearch/_async/client/cat.py +744 -75
  5. elasticsearch/_async/client/ccr.py +13 -13
  6. elasticsearch/_async/client/cluster.py +38 -24
  7. elasticsearch/_async/client/connector.py +30 -30
  8. elasticsearch/_async/client/dangling_indices.py +3 -3
  9. elasticsearch/_async/client/enrich.py +5 -5
  10. elasticsearch/_async/client/eql.py +13 -5
  11. elasticsearch/_async/client/esql.py +54 -15
  12. elasticsearch/_async/client/features.py +2 -2
  13. elasticsearch/_async/client/fleet.py +13 -13
  14. elasticsearch/_async/client/graph.py +1 -1
  15. elasticsearch/_async/client/ilm.py +11 -11
  16. elasticsearch/_async/client/indices.py +132 -83
  17. elasticsearch/_async/client/inference.py +519 -112
  18. elasticsearch/_async/client/ingest.py +9 -16
  19. elasticsearch/_async/client/license.py +10 -10
  20. elasticsearch/_async/client/logstash.py +3 -3
  21. elasticsearch/_async/client/migration.py +3 -3
  22. elasticsearch/_async/client/ml.py +76 -88
  23. elasticsearch/_async/client/nodes.py +9 -8
  24. elasticsearch/_async/client/query_rules.py +8 -8
  25. elasticsearch/_async/client/rollup.py +8 -8
  26. elasticsearch/_async/client/search_application.py +10 -10
  27. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  28. elasticsearch/_async/client/security.py +72 -80
  29. elasticsearch/_async/client/shutdown.py +3 -3
  30. elasticsearch/_async/client/simulate.py +1 -1
  31. elasticsearch/_async/client/slm.py +9 -9
  32. elasticsearch/_async/client/snapshot.py +286 -130
  33. elasticsearch/_async/client/sql.py +7 -7
  34. elasticsearch/_async/client/ssl.py +1 -1
  35. elasticsearch/_async/client/synonyms.py +7 -7
  36. elasticsearch/_async/client/tasks.py +3 -3
  37. elasticsearch/_async/client/text_structure.py +4 -4
  38. elasticsearch/_async/client/transform.py +69 -9
  39. elasticsearch/_async/client/xpack.py +1 -1
  40. elasticsearch/_sync/client/__init__.py +68 -82
  41. elasticsearch/_sync/client/async_search.py +5 -9
  42. elasticsearch/_sync/client/autoscaling.py +4 -4
  43. elasticsearch/_sync/client/cat.py +744 -75
  44. elasticsearch/_sync/client/ccr.py +13 -13
  45. elasticsearch/_sync/client/cluster.py +38 -24
  46. elasticsearch/_sync/client/connector.py +30 -30
  47. elasticsearch/_sync/client/dangling_indices.py +3 -3
  48. elasticsearch/_sync/client/enrich.py +5 -5
  49. elasticsearch/_sync/client/eql.py +13 -5
  50. elasticsearch/_sync/client/esql.py +54 -15
  51. elasticsearch/_sync/client/features.py +2 -2
  52. elasticsearch/_sync/client/fleet.py +13 -13
  53. elasticsearch/_sync/client/graph.py +1 -1
  54. elasticsearch/_sync/client/ilm.py +11 -11
  55. elasticsearch/_sync/client/indices.py +132 -83
  56. elasticsearch/_sync/client/inference.py +519 -112
  57. elasticsearch/_sync/client/ingest.py +9 -16
  58. elasticsearch/_sync/client/license.py +10 -10
  59. elasticsearch/_sync/client/logstash.py +3 -3
  60. elasticsearch/_sync/client/migration.py +3 -3
  61. elasticsearch/_sync/client/ml.py +76 -88
  62. elasticsearch/_sync/client/nodes.py +9 -8
  63. elasticsearch/_sync/client/query_rules.py +8 -8
  64. elasticsearch/_sync/client/rollup.py +8 -8
  65. elasticsearch/_sync/client/search_application.py +10 -10
  66. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  67. elasticsearch/_sync/client/security.py +72 -80
  68. elasticsearch/_sync/client/shutdown.py +3 -3
  69. elasticsearch/_sync/client/simulate.py +1 -1
  70. elasticsearch/_sync/client/slm.py +9 -9
  71. elasticsearch/_sync/client/snapshot.py +286 -130
  72. elasticsearch/_sync/client/sql.py +7 -7
  73. elasticsearch/_sync/client/ssl.py +1 -1
  74. elasticsearch/_sync/client/synonyms.py +7 -7
  75. elasticsearch/_sync/client/tasks.py +3 -3
  76. elasticsearch/_sync/client/text_structure.py +4 -4
  77. elasticsearch/_sync/client/transform.py +69 -9
  78. elasticsearch/_sync/client/xpack.py +1 -1
  79. elasticsearch/_version.py +1 -1
  80. elasticsearch/compat.py +5 -0
  81. elasticsearch/dsl/__init__.py +2 -1
  82. elasticsearch/dsl/_async/document.py +85 -1
  83. elasticsearch/dsl/_sync/document.py +85 -1
  84. elasticsearch/dsl/aggs.py +22 -3
  85. elasticsearch/dsl/document_base.py +219 -16
  86. elasticsearch/dsl/field.py +272 -48
  87. elasticsearch/dsl/query.py +49 -4
  88. elasticsearch/dsl/response/aggs.py +1 -1
  89. elasticsearch/dsl/types.py +247 -27
  90. elasticsearch/dsl/utils.py +2 -2
  91. elasticsearch/esql/__init__.py +19 -0
  92. elasticsearch/esql/esql.py +1156 -0
  93. elasticsearch/esql/functions.py +1750 -0
  94. elasticsearch/exceptions.py +2 -0
  95. {elasticsearch-8.18.1.dist-info → elasticsearch-8.19.1.dist-info}/METADATA +1 -5
  96. elasticsearch-8.19.1.dist-info/RECORD +164 -0
  97. elasticsearch-8.18.1.dist-info/RECORD +0 -163
  98. elasticsearch-8.18.1.dist-info/licenses/LICENSE.txt +0 -175
  99. elasticsearch-8.18.1.dist-info/licenses/NOTICE.txt +0 -559
  100. {elasticsearch-8.18.1.dist-info → elasticsearch-8.19.1.dist-info}/WHEEL +0 -0
  101. {elasticsearch-8.18.1.dist-info → elasticsearch-8.19.1.dist-info}/licenses/LICENSE +0 -0
  102. {elasticsearch-8.18.1.dist-info → elasticsearch-8.19.1.dist-info}/licenses/NOTICE +0 -0
@@ -119,9 +119,16 @@ class Field(DslBase):
119
119
  def __getitem__(self, subfield: str) -> "Field":
120
120
  return cast(Field, self._params.get("fields", {})[subfield])
121
121
 
122
- def _serialize(self, data: Any) -> Any:
122
+ def _serialize(self, data: Any, skip_empty: bool) -> Any:
123
123
  return data
124
124
 
125
+ def _safe_serialize(self, data: Any, skip_empty: bool) -> Any:
126
+ try:
127
+ return self._serialize(data, skip_empty)
128
+ except TypeError:
129
+ # older method signature, without skip_empty
130
+ return self._serialize(data) # type: ignore[call-arg]
131
+
125
132
  def _deserialize(self, data: Any) -> Any:
126
133
  return data
127
134
 
@@ -133,10 +140,16 @@ class Field(DslBase):
133
140
  return AttrList([])
134
141
  return self._empty()
135
142
 
136
- def serialize(self, data: Any) -> Any:
143
+ def serialize(self, data: Any, skip_empty: bool = True) -> Any:
137
144
  if isinstance(data, (list, AttrList, tuple)):
138
- return list(map(self._serialize, cast(Iterable[Any], data)))
139
- return self._serialize(data)
145
+ return list(
146
+ map(
147
+ self._safe_serialize,
148
+ cast(Iterable[Any], data),
149
+ [skip_empty] * len(data),
150
+ )
151
+ )
152
+ return self._safe_serialize(data, skip_empty)
140
153
 
141
154
  def deserialize(self, data: Any) -> Any:
142
155
  if isinstance(data, (list, AttrList, tuple)):
@@ -186,7 +199,7 @@ class RangeField(Field):
186
199
  data = {k: self._core_field.deserialize(v) for k, v in data.items()} # type: ignore[union-attr]
187
200
  return Range(data)
188
201
 
189
- def _serialize(self, data: Any) -> Optional[Dict[str, Any]]:
202
+ def _serialize(self, data: Any, skip_empty: bool) -> Optional[Dict[str, Any]]:
190
203
  if data is None:
191
204
  return None
192
205
  if not isinstance(data, collections.abc.Mapping):
@@ -280,7 +293,10 @@ class Float(Field):
280
293
  if doc_values is not DEFAULT:
281
294
  kwargs["doc_values"] = doc_values
282
295
  if copy_to is not DEFAULT:
283
- kwargs["copy_to"] = str(copy_to)
296
+ if isinstance(copy_to, list):
297
+ kwargs["copy_to"] = [str(field) for field in copy_to]
298
+ else:
299
+ kwargs["copy_to"] = str(copy_to)
284
300
  if store is not DEFAULT:
285
301
  kwargs["store"] = store
286
302
  if meta is not DEFAULT:
@@ -387,7 +403,10 @@ class Integer(Field):
387
403
  if doc_values is not DEFAULT:
388
404
  kwargs["doc_values"] = doc_values
389
405
  if copy_to is not DEFAULT:
390
- kwargs["copy_to"] = str(copy_to)
406
+ if isinstance(copy_to, list):
407
+ kwargs["copy_to"] = [str(field) for field in copy_to]
408
+ else:
409
+ kwargs["copy_to"] = str(copy_to)
391
410
  if store is not DEFAULT:
392
411
  kwargs["store"] = store
393
412
  if meta is not DEFAULT:
@@ -463,7 +482,10 @@ class Object(Field):
463
482
  if subobjects is not DEFAULT:
464
483
  kwargs["subobjects"] = subobjects
465
484
  if copy_to is not DEFAULT:
466
- kwargs["copy_to"] = str(copy_to)
485
+ if isinstance(copy_to, list):
486
+ kwargs["copy_to"] = [str(field) for field in copy_to]
487
+ else:
488
+ kwargs["copy_to"] = str(copy_to)
467
489
  if store is not DEFAULT:
468
490
  kwargs["store"] = store
469
491
  if meta is not DEFAULT:
@@ -541,7 +563,7 @@ class Object(Field):
541
563
  return self._wrap(data)
542
564
 
543
565
  def _serialize(
544
- self, data: Optional[Union[Dict[str, Any], "InnerDoc"]]
566
+ self, data: Optional[Union[Dict[str, Any], "InnerDoc"]], skip_empty: bool
545
567
  ) -> Optional[Dict[str, Any]]:
546
568
  if data is None:
547
569
  return None
@@ -550,7 +572,7 @@ class Object(Field):
550
572
  if isinstance(data, collections.abc.Mapping):
551
573
  return data
552
574
 
553
- return data.to_dict()
575
+ return data.to_dict(skip_empty=skip_empty)
554
576
 
555
577
  def clean(self, data: Any) -> Any:
556
578
  data = super().clean(data)
@@ -575,6 +597,7 @@ class AggregateMetricDouble(Field):
575
597
  """
576
598
  :arg default_metric: (required)
577
599
  :arg metrics: (required)
600
+ :arg ignore_malformed:
578
601
  :arg time_series_metric:
579
602
  :arg meta: Metadata about the field.
580
603
  :arg properties:
@@ -595,6 +618,7 @@ class AggregateMetricDouble(Field):
595
618
  *args: Any,
596
619
  default_metric: Union[str, "DefaultType"] = DEFAULT,
597
620
  metrics: Union[Sequence[str], "DefaultType"] = DEFAULT,
621
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
598
622
  time_series_metric: Union[
599
623
  Literal["gauge", "counter", "summary", "histogram", "position"],
600
624
  "DefaultType",
@@ -615,6 +639,8 @@ class AggregateMetricDouble(Field):
615
639
  kwargs["default_metric"] = default_metric
616
640
  if metrics is not DEFAULT:
617
641
  kwargs["metrics"] = metrics
642
+ if ignore_malformed is not DEFAULT:
643
+ kwargs["ignore_malformed"] = ignore_malformed
618
644
  if time_series_metric is not DEFAULT:
619
645
  kwargs["time_series_metric"] = time_series_metric
620
646
  if meta is not DEFAULT:
@@ -727,7 +753,10 @@ class Binary(Field):
727
753
  if doc_values is not DEFAULT:
728
754
  kwargs["doc_values"] = doc_values
729
755
  if copy_to is not DEFAULT:
730
- kwargs["copy_to"] = str(copy_to)
756
+ if isinstance(copy_to, list):
757
+ kwargs["copy_to"] = [str(field) for field in copy_to]
758
+ else:
759
+ kwargs["copy_to"] = str(copy_to)
731
760
  if store is not DEFAULT:
732
761
  kwargs["store"] = store
733
762
  if meta is not DEFAULT:
@@ -752,7 +781,7 @@ class Binary(Field):
752
781
  def _deserialize(self, data: Any) -> bytes:
753
782
  return base64.b64decode(data)
754
783
 
755
- def _serialize(self, data: Any) -> Optional[str]:
784
+ def _serialize(self, data: Any, skip_empty: bool) -> Optional[str]:
756
785
  if data is None:
757
786
  return None
758
787
  return base64.b64encode(data).decode()
@@ -838,7 +867,10 @@ class Boolean(Field):
838
867
  if doc_values is not DEFAULT:
839
868
  kwargs["doc_values"] = doc_values
840
869
  if copy_to is not DEFAULT:
841
- kwargs["copy_to"] = str(copy_to)
870
+ if isinstance(copy_to, list):
871
+ kwargs["copy_to"] = [str(field) for field in copy_to]
872
+ else:
873
+ kwargs["copy_to"] = str(copy_to)
842
874
  if store is not DEFAULT:
843
875
  kwargs["store"] = store
844
876
  if meta is not DEFAULT:
@@ -953,7 +985,10 @@ class Byte(Integer):
953
985
  if doc_values is not DEFAULT:
954
986
  kwargs["doc_values"] = doc_values
955
987
  if copy_to is not DEFAULT:
956
- kwargs["copy_to"] = str(copy_to)
988
+ if isinstance(copy_to, list):
989
+ kwargs["copy_to"] = [str(field) for field in copy_to]
990
+ else:
991
+ kwargs["copy_to"] = str(copy_to)
957
992
  if store is not DEFAULT:
958
993
  kwargs["store"] = store
959
994
  if meta is not DEFAULT:
@@ -1043,7 +1078,10 @@ class Completion(Field):
1043
1078
  if doc_values is not DEFAULT:
1044
1079
  kwargs["doc_values"] = doc_values
1045
1080
  if copy_to is not DEFAULT:
1046
- kwargs["copy_to"] = str(copy_to)
1081
+ if isinstance(copy_to, list):
1082
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1083
+ else:
1084
+ kwargs["copy_to"] = str(copy_to)
1047
1085
  if store is not DEFAULT:
1048
1086
  kwargs["store"] = store
1049
1087
  if meta is not DEFAULT:
@@ -1251,7 +1289,10 @@ class Date(Field):
1251
1289
  if doc_values is not DEFAULT:
1252
1290
  kwargs["doc_values"] = doc_values
1253
1291
  if copy_to is not DEFAULT:
1254
- kwargs["copy_to"] = str(copy_to)
1292
+ if isinstance(copy_to, list):
1293
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1294
+ else:
1295
+ kwargs["copy_to"] = str(copy_to)
1255
1296
  if store is not DEFAULT:
1256
1297
  kwargs["store"] = store
1257
1298
  if meta is not DEFAULT:
@@ -1290,7 +1331,7 @@ class Date(Field):
1290
1331
  if isinstance(data, datetime):
1291
1332
  if self._default_timezone and data.tzinfo is None:
1292
1333
  data = data.replace(tzinfo=self._default_timezone)
1293
- return data
1334
+ return cast(datetime, data)
1294
1335
  if isinstance(data, date):
1295
1336
  return data
1296
1337
  if isinstance(data, int):
@@ -1376,7 +1417,10 @@ class DateNanos(Field):
1376
1417
  if doc_values is not DEFAULT:
1377
1418
  kwargs["doc_values"] = doc_values
1378
1419
  if copy_to is not DEFAULT:
1379
- kwargs["copy_to"] = str(copy_to)
1420
+ if isinstance(copy_to, list):
1421
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1422
+ else:
1423
+ kwargs["copy_to"] = str(copy_to)
1380
1424
  if store is not DEFAULT:
1381
1425
  kwargs["store"] = store
1382
1426
  if meta is not DEFAULT:
@@ -1455,7 +1499,10 @@ class DateRange(RangeField):
1455
1499
  if doc_values is not DEFAULT:
1456
1500
  kwargs["doc_values"] = doc_values
1457
1501
  if copy_to is not DEFAULT:
1458
- kwargs["copy_to"] = str(copy_to)
1502
+ if isinstance(copy_to, list):
1503
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1504
+ else:
1505
+ kwargs["copy_to"] = str(copy_to)
1459
1506
  if store is not DEFAULT:
1460
1507
  kwargs["store"] = store
1461
1508
  if meta is not DEFAULT:
@@ -1658,7 +1705,10 @@ class Double(Float):
1658
1705
  if doc_values is not DEFAULT:
1659
1706
  kwargs["doc_values"] = doc_values
1660
1707
  if copy_to is not DEFAULT:
1661
- kwargs["copy_to"] = str(copy_to)
1708
+ if isinstance(copy_to, list):
1709
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1710
+ else:
1711
+ kwargs["copy_to"] = str(copy_to)
1662
1712
  if store is not DEFAULT:
1663
1713
  kwargs["store"] = store
1664
1714
  if meta is not DEFAULT:
@@ -1733,7 +1783,10 @@ class DoubleRange(RangeField):
1733
1783
  if doc_values is not DEFAULT:
1734
1784
  kwargs["doc_values"] = doc_values
1735
1785
  if copy_to is not DEFAULT:
1736
- kwargs["copy_to"] = str(copy_to)
1786
+ if isinstance(copy_to, list):
1787
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1788
+ else:
1789
+ kwargs["copy_to"] = str(copy_to)
1737
1790
  if store is not DEFAULT:
1738
1791
  kwargs["store"] = store
1739
1792
  if meta is not DEFAULT:
@@ -1762,6 +1815,7 @@ class Flattened(Field):
1762
1815
  :arg null_value:
1763
1816
  :arg similarity:
1764
1817
  :arg split_queries_on_whitespace:
1818
+ :arg time_series_dimensions:
1765
1819
  :arg meta: Metadata about the field.
1766
1820
  :arg properties:
1767
1821
  :arg ignore_above:
@@ -1790,6 +1844,7 @@ class Flattened(Field):
1790
1844
  null_value: Union[str, "DefaultType"] = DEFAULT,
1791
1845
  similarity: Union[str, "DefaultType"] = DEFAULT,
1792
1846
  split_queries_on_whitespace: Union[bool, "DefaultType"] = DEFAULT,
1847
+ time_series_dimensions: Union[Sequence[str], "DefaultType"] = DEFAULT,
1793
1848
  meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1794
1849
  properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1795
1850
  ignore_above: Union[int, "DefaultType"] = DEFAULT,
@@ -1820,6 +1875,8 @@ class Flattened(Field):
1820
1875
  kwargs["similarity"] = similarity
1821
1876
  if split_queries_on_whitespace is not DEFAULT:
1822
1877
  kwargs["split_queries_on_whitespace"] = split_queries_on_whitespace
1878
+ if time_series_dimensions is not DEFAULT:
1879
+ kwargs["time_series_dimensions"] = time_series_dimensions
1823
1880
  if meta is not DEFAULT:
1824
1881
  kwargs["meta"] = meta
1825
1882
  if properties is not DEFAULT:
@@ -1892,7 +1949,10 @@ class FloatRange(RangeField):
1892
1949
  if doc_values is not DEFAULT:
1893
1950
  kwargs["doc_values"] = doc_values
1894
1951
  if copy_to is not DEFAULT:
1895
- kwargs["copy_to"] = str(copy_to)
1952
+ if isinstance(copy_to, list):
1953
+ kwargs["copy_to"] = [str(field) for field in copy_to]
1954
+ else:
1955
+ kwargs["copy_to"] = str(copy_to)
1896
1956
  if store is not DEFAULT:
1897
1957
  kwargs["store"] = store
1898
1958
  if meta is not DEFAULT:
@@ -1918,6 +1978,7 @@ class GeoPoint(Field):
1918
1978
  :arg index:
1919
1979
  :arg on_script_error:
1920
1980
  :arg script:
1981
+ :arg time_series_metric:
1921
1982
  :arg doc_values:
1922
1983
  :arg copy_to:
1923
1984
  :arg store:
@@ -1951,6 +2012,9 @@ class GeoPoint(Field):
1951
2012
  index: Union[bool, "DefaultType"] = DEFAULT,
1952
2013
  on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
1953
2014
  script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
2015
+ time_series_metric: Union[
2016
+ Literal["gauge", "counter", "position"], "DefaultType"
2017
+ ] = DEFAULT,
1954
2018
  doc_values: Union[bool, "DefaultType"] = DEFAULT,
1955
2019
  copy_to: Union[
1956
2020
  Union[str, "InstrumentedField"],
@@ -1982,10 +2046,15 @@ class GeoPoint(Field):
1982
2046
  kwargs["on_script_error"] = on_script_error
1983
2047
  if script is not DEFAULT:
1984
2048
  kwargs["script"] = script
2049
+ if time_series_metric is not DEFAULT:
2050
+ kwargs["time_series_metric"] = time_series_metric
1985
2051
  if doc_values is not DEFAULT:
1986
2052
  kwargs["doc_values"] = doc_values
1987
2053
  if copy_to is not DEFAULT:
1988
- kwargs["copy_to"] = str(copy_to)
2054
+ if isinstance(copy_to, list):
2055
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2056
+ else:
2057
+ kwargs["copy_to"] = str(copy_to)
1989
2058
  if store is not DEFAULT:
1990
2059
  kwargs["store"] = store
1991
2060
  if meta is not DEFAULT:
@@ -2074,7 +2143,10 @@ class GeoShape(Field):
2074
2143
  if doc_values is not DEFAULT:
2075
2144
  kwargs["doc_values"] = doc_values
2076
2145
  if copy_to is not DEFAULT:
2077
- kwargs["copy_to"] = str(copy_to)
2146
+ if isinstance(copy_to, list):
2147
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2148
+ else:
2149
+ kwargs["copy_to"] = str(copy_to)
2078
2150
  if store is not DEFAULT:
2079
2151
  kwargs["store"] = store
2080
2152
  if meta is not DEFAULT:
@@ -2177,7 +2249,10 @@ class HalfFloat(Float):
2177
2249
  if doc_values is not DEFAULT:
2178
2250
  kwargs["doc_values"] = doc_values
2179
2251
  if copy_to is not DEFAULT:
2180
- kwargs["copy_to"] = str(copy_to)
2252
+ if isinstance(copy_to, list):
2253
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2254
+ else:
2255
+ kwargs["copy_to"] = str(copy_to)
2181
2256
  if store is not DEFAULT:
2182
2257
  kwargs["store"] = store
2183
2258
  if meta is not DEFAULT:
@@ -2360,7 +2435,10 @@ class IcuCollationKeyword(Field):
2360
2435
  if doc_values is not DEFAULT:
2361
2436
  kwargs["doc_values"] = doc_values
2362
2437
  if copy_to is not DEFAULT:
2363
- kwargs["copy_to"] = str(copy_to)
2438
+ if isinstance(copy_to, list):
2439
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2440
+ else:
2441
+ kwargs["copy_to"] = str(copy_to)
2364
2442
  if store is not DEFAULT:
2365
2443
  kwargs["store"] = store
2366
2444
  if meta is not DEFAULT:
@@ -2435,7 +2513,10 @@ class IntegerRange(RangeField):
2435
2513
  if doc_values is not DEFAULT:
2436
2514
  kwargs["doc_values"] = doc_values
2437
2515
  if copy_to is not DEFAULT:
2438
- kwargs["copy_to"] = str(copy_to)
2516
+ if isinstance(copy_to, list):
2517
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2518
+ else:
2519
+ kwargs["copy_to"] = str(copy_to)
2439
2520
  if store is not DEFAULT:
2440
2521
  kwargs["store"] = store
2441
2522
  if meta is not DEFAULT:
@@ -2527,7 +2608,10 @@ class Ip(Field):
2527
2608
  if doc_values is not DEFAULT:
2528
2609
  kwargs["doc_values"] = doc_values
2529
2610
  if copy_to is not DEFAULT:
2530
- kwargs["copy_to"] = str(copy_to)
2611
+ if isinstance(copy_to, list):
2612
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2613
+ else:
2614
+ kwargs["copy_to"] = str(copy_to)
2531
2615
  if store is not DEFAULT:
2532
2616
  kwargs["store"] = store
2533
2617
  if meta is not DEFAULT:
@@ -2548,7 +2632,7 @@ class Ip(Field):
2548
2632
  # the ipaddress library for pypy only accepts unicode.
2549
2633
  return ipaddress.ip_address(unicode(data))
2550
2634
 
2551
- def _serialize(self, data: Any) -> Optional[str]:
2635
+ def _serialize(self, data: Any, skip_empty: bool) -> Optional[str]:
2552
2636
  if data is None:
2553
2637
  return None
2554
2638
  return str(data)
@@ -2611,7 +2695,10 @@ class IpRange(Field):
2611
2695
  if doc_values is not DEFAULT:
2612
2696
  kwargs["doc_values"] = doc_values
2613
2697
  if copy_to is not DEFAULT:
2614
- kwargs["copy_to"] = str(copy_to)
2698
+ if isinstance(copy_to, list):
2699
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2700
+ else:
2701
+ kwargs["copy_to"] = str(copy_to)
2615
2702
  if store is not DEFAULT:
2616
2703
  kwargs["store"] = store
2617
2704
  if meta is not DEFAULT:
@@ -2781,7 +2868,10 @@ class Keyword(Field):
2781
2868
  if doc_values is not DEFAULT:
2782
2869
  kwargs["doc_values"] = doc_values
2783
2870
  if copy_to is not DEFAULT:
2784
- kwargs["copy_to"] = str(copy_to)
2871
+ if isinstance(copy_to, list):
2872
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2873
+ else:
2874
+ kwargs["copy_to"] = str(copy_to)
2785
2875
  if store is not DEFAULT:
2786
2876
  kwargs["store"] = store
2787
2877
  if meta is not DEFAULT:
@@ -2884,7 +2974,10 @@ class Long(Integer):
2884
2974
  if doc_values is not DEFAULT:
2885
2975
  kwargs["doc_values"] = doc_values
2886
2976
  if copy_to is not DEFAULT:
2887
- kwargs["copy_to"] = str(copy_to)
2977
+ if isinstance(copy_to, list):
2978
+ kwargs["copy_to"] = [str(field) for field in copy_to]
2979
+ else:
2980
+ kwargs["copy_to"] = str(copy_to)
2888
2981
  if store is not DEFAULT:
2889
2982
  kwargs["store"] = store
2890
2983
  if meta is not DEFAULT:
@@ -2959,7 +3052,10 @@ class LongRange(RangeField):
2959
3052
  if doc_values is not DEFAULT:
2960
3053
  kwargs["doc_values"] = doc_values
2961
3054
  if copy_to is not DEFAULT:
2962
- kwargs["copy_to"] = str(copy_to)
3055
+ if isinstance(copy_to, list):
3056
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3057
+ else:
3058
+ kwargs["copy_to"] = str(copy_to)
2963
3059
  if store is not DEFAULT:
2964
3060
  kwargs["store"] = store
2965
3061
  if meta is not DEFAULT:
@@ -3016,7 +3112,10 @@ class MatchOnlyText(Field):
3016
3112
  if meta is not DEFAULT:
3017
3113
  kwargs["meta"] = meta
3018
3114
  if copy_to is not DEFAULT:
3019
- kwargs["copy_to"] = str(copy_to)
3115
+ if isinstance(copy_to, list):
3116
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3117
+ else:
3118
+ kwargs["copy_to"] = str(copy_to)
3020
3119
  super().__init__(*args, **kwargs)
3021
3120
 
3022
3121
 
@@ -3064,7 +3163,10 @@ class Murmur3(Field):
3064
3163
  if doc_values is not DEFAULT:
3065
3164
  kwargs["doc_values"] = doc_values
3066
3165
  if copy_to is not DEFAULT:
3067
- kwargs["copy_to"] = str(copy_to)
3166
+ if isinstance(copy_to, list):
3167
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3168
+ else:
3169
+ kwargs["copy_to"] = str(copy_to)
3068
3170
  if store is not DEFAULT:
3069
3171
  kwargs["store"] = store
3070
3172
  if meta is not DEFAULT:
@@ -3134,7 +3236,10 @@ class Nested(Object):
3134
3236
  if include_in_root is not DEFAULT:
3135
3237
  kwargs["include_in_root"] = include_in_root
3136
3238
  if copy_to is not DEFAULT:
3137
- kwargs["copy_to"] = str(copy_to)
3239
+ if isinstance(copy_to, list):
3240
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3241
+ else:
3242
+ kwargs["copy_to"] = str(copy_to)
3138
3243
  if store is not DEFAULT:
3139
3244
  kwargs["store"] = store
3140
3245
  if meta is not DEFAULT:
@@ -3205,7 +3310,10 @@ class Passthrough(Field):
3205
3310
  if time_series_dimension is not DEFAULT:
3206
3311
  kwargs["time_series_dimension"] = time_series_dimension
3207
3312
  if copy_to is not DEFAULT:
3208
- kwargs["copy_to"] = str(copy_to)
3313
+ if isinstance(copy_to, list):
3314
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3315
+ else:
3316
+ kwargs["copy_to"] = str(copy_to)
3209
3317
  if store is not DEFAULT:
3210
3318
  kwargs["store"] = store
3211
3319
  if meta is not DEFAULT:
@@ -3272,7 +3380,7 @@ class Percolator(Field):
3272
3380
  def _deserialize(self, data: Any) -> "Query":
3273
3381
  return Q(data) # type: ignore[no-any-return]
3274
3382
 
3275
- def _serialize(self, data: Any) -> Optional[Dict[str, Any]]:
3383
+ def _serialize(self, data: Any, skip_empty: bool) -> Optional[Dict[str, Any]]:
3276
3384
  if data is None:
3277
3385
  return None
3278
3386
  return data.to_dict() # type: ignore[no-any-return]
@@ -3334,7 +3442,10 @@ class Point(Field):
3334
3442
  if doc_values is not DEFAULT:
3335
3443
  kwargs["doc_values"] = doc_values
3336
3444
  if copy_to is not DEFAULT:
3337
- kwargs["copy_to"] = str(copy_to)
3445
+ if isinstance(copy_to, list):
3446
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3447
+ else:
3448
+ kwargs["copy_to"] = str(copy_to)
3338
3449
  if store is not DEFAULT:
3339
3450
  kwargs["store"] = store
3340
3451
  if meta is not DEFAULT:
@@ -3452,6 +3563,62 @@ class RankFeatures(Field):
3452
3563
  super().__init__(*args, **kwargs)
3453
3564
 
3454
3565
 
3566
+ class RankVectors(Field):
3567
+ """
3568
+ Technical preview
3569
+
3570
+ :arg element_type:
3571
+ :arg dims:
3572
+ :arg meta: Metadata about the field.
3573
+ :arg properties:
3574
+ :arg ignore_above:
3575
+ :arg dynamic:
3576
+ :arg fields:
3577
+ :arg synthetic_source_keep:
3578
+ """
3579
+
3580
+ name = "rank_vectors"
3581
+ _param_defs = {
3582
+ "properties": {"type": "field", "hash": True},
3583
+ "fields": {"type": "field", "hash": True},
3584
+ }
3585
+
3586
+ def __init__(
3587
+ self,
3588
+ *args: Any,
3589
+ element_type: Union[Literal["byte", "float", "bit"], "DefaultType"] = DEFAULT,
3590
+ dims: Union[int, "DefaultType"] = DEFAULT,
3591
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3592
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3593
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3594
+ dynamic: Union[
3595
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3596
+ ] = DEFAULT,
3597
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3598
+ synthetic_source_keep: Union[
3599
+ Literal["none", "arrays", "all"], "DefaultType"
3600
+ ] = DEFAULT,
3601
+ **kwargs: Any,
3602
+ ):
3603
+ if element_type is not DEFAULT:
3604
+ kwargs["element_type"] = element_type
3605
+ if dims is not DEFAULT:
3606
+ kwargs["dims"] = dims
3607
+ if meta is not DEFAULT:
3608
+ kwargs["meta"] = meta
3609
+ if properties is not DEFAULT:
3610
+ kwargs["properties"] = properties
3611
+ if ignore_above is not DEFAULT:
3612
+ kwargs["ignore_above"] = ignore_above
3613
+ if dynamic is not DEFAULT:
3614
+ kwargs["dynamic"] = dynamic
3615
+ if fields is not DEFAULT:
3616
+ kwargs["fields"] = fields
3617
+ if synthetic_source_keep is not DEFAULT:
3618
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3619
+ super().__init__(*args, **kwargs)
3620
+
3621
+
3455
3622
  class ScaledFloat(Float):
3456
3623
  """
3457
3624
  :arg null_value:
@@ -3541,7 +3708,10 @@ class ScaledFloat(Float):
3541
3708
  if doc_values is not DEFAULT:
3542
3709
  kwargs["doc_values"] = doc_values
3543
3710
  if copy_to is not DEFAULT:
3544
- kwargs["copy_to"] = str(copy_to)
3711
+ if isinstance(copy_to, list):
3712
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3713
+ else:
3714
+ kwargs["copy_to"] = str(copy_to)
3545
3715
  if store is not DEFAULT:
3546
3716
  kwargs["store"] = store
3547
3717
  if meta is not DEFAULT:
@@ -3657,7 +3827,10 @@ class SearchAsYouType(Field):
3657
3827
  if term_vector is not DEFAULT:
3658
3828
  kwargs["term_vector"] = term_vector
3659
3829
  if copy_to is not DEFAULT:
3660
- kwargs["copy_to"] = str(copy_to)
3830
+ if isinstance(copy_to, list):
3831
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3832
+ else:
3833
+ kwargs["copy_to"] = str(copy_to)
3661
3834
  if store is not DEFAULT:
3662
3835
  kwargs["store"] = store
3663
3836
  if meta is not DEFAULT:
@@ -3689,6 +3862,14 @@ class SemanticText(Field):
3689
3862
  by using the Update mapping API. Use the Create inference API to
3690
3863
  create the endpoint. If not specified, the inference endpoint
3691
3864
  defined by inference_id will be used at both index and query time.
3865
+ :arg index_options: Settings for index_options that override any
3866
+ defaults used by semantic_text, for example specific quantization
3867
+ settings.
3868
+ :arg chunking_settings: Settings for chunking text into smaller
3869
+ passages. If specified, these will override the chunking settings
3870
+ sent in the inference endpoint associated with inference_id. If
3871
+ chunking settings are updated, they will not be applied to
3872
+ existing documents until they are reindexed.
3692
3873
  """
3693
3874
 
3694
3875
  name = "semantic_text"
@@ -3699,6 +3880,12 @@ class SemanticText(Field):
3699
3880
  meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3700
3881
  inference_id: Union[str, "DefaultType"] = DEFAULT,
3701
3882
  search_inference_id: Union[str, "DefaultType"] = DEFAULT,
3883
+ index_options: Union[
3884
+ "types.SemanticTextIndexOptions", Dict[str, Any], "DefaultType"
3885
+ ] = DEFAULT,
3886
+ chunking_settings: Union[
3887
+ "types.ChunkingSettings", Dict[str, Any], "DefaultType"
3888
+ ] = DEFAULT,
3702
3889
  **kwargs: Any,
3703
3890
  ):
3704
3891
  if meta is not DEFAULT:
@@ -3707,6 +3894,10 @@ class SemanticText(Field):
3707
3894
  kwargs["inference_id"] = inference_id
3708
3895
  if search_inference_id is not DEFAULT:
3709
3896
  kwargs["search_inference_id"] = search_inference_id
3897
+ if index_options is not DEFAULT:
3898
+ kwargs["index_options"] = index_options
3899
+ if chunking_settings is not DEFAULT:
3900
+ kwargs["chunking_settings"] = chunking_settings
3710
3901
  super().__init__(*args, **kwargs)
3711
3902
 
3712
3903
 
@@ -3773,7 +3964,10 @@ class Shape(Field):
3773
3964
  if doc_values is not DEFAULT:
3774
3965
  kwargs["doc_values"] = doc_values
3775
3966
  if copy_to is not DEFAULT:
3776
- kwargs["copy_to"] = str(copy_to)
3967
+ if isinstance(copy_to, list):
3968
+ kwargs["copy_to"] = [str(field) for field in copy_to]
3969
+ else:
3970
+ kwargs["copy_to"] = str(copy_to)
3777
3971
  if store is not DEFAULT:
3778
3972
  kwargs["store"] = store
3779
3973
  if meta is not DEFAULT:
@@ -3876,7 +4070,10 @@ class Short(Integer):
3876
4070
  if doc_values is not DEFAULT:
3877
4071
  kwargs["doc_values"] = doc_values
3878
4072
  if copy_to is not DEFAULT:
3879
- kwargs["copy_to"] = str(copy_to)
4073
+ if isinstance(copy_to, list):
4074
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4075
+ else:
4076
+ kwargs["copy_to"] = str(copy_to)
3880
4077
  if store is not DEFAULT:
3881
4078
  kwargs["store"] = store
3882
4079
  if meta is not DEFAULT:
@@ -3896,6 +4093,10 @@ class Short(Integer):
3896
4093
 
3897
4094
  class SparseVector(Field):
3898
4095
  """
4096
+ :arg store:
4097
+ :arg index_options: Additional index options for the sparse vector
4098
+ field that controls the token pruning behavior of the sparse
4099
+ vector field.
3899
4100
  :arg meta: Metadata about the field.
3900
4101
  :arg properties:
3901
4102
  :arg ignore_above:
@@ -3913,6 +4114,10 @@ class SparseVector(Field):
3913
4114
  def __init__(
3914
4115
  self,
3915
4116
  *args: Any,
4117
+ store: Union[bool, "DefaultType"] = DEFAULT,
4118
+ index_options: Union[
4119
+ "types.SparseVectorIndexOptions", Dict[str, Any], "DefaultType"
4120
+ ] = DEFAULT,
3916
4121
  meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3917
4122
  properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3918
4123
  ignore_above: Union[int, "DefaultType"] = DEFAULT,
@@ -3925,6 +4130,10 @@ class SparseVector(Field):
3925
4130
  ] = DEFAULT,
3926
4131
  **kwargs: Any,
3927
4132
  ):
4133
+ if store is not DEFAULT:
4134
+ kwargs["store"] = store
4135
+ if index_options is not DEFAULT:
4136
+ kwargs["index_options"] = index_options
3928
4137
  if meta is not DEFAULT:
3929
4138
  kwargs["meta"] = meta
3930
4139
  if properties is not DEFAULT:
@@ -4060,7 +4269,10 @@ class Text(Field):
4060
4269
  if term_vector is not DEFAULT:
4061
4270
  kwargs["term_vector"] = term_vector
4062
4271
  if copy_to is not DEFAULT:
4063
- kwargs["copy_to"] = str(copy_to)
4272
+ if isinstance(copy_to, list):
4273
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4274
+ else:
4275
+ kwargs["copy_to"] = str(copy_to)
4064
4276
  if store is not DEFAULT:
4065
4277
  kwargs["store"] = store
4066
4278
  if meta is not DEFAULT:
@@ -4143,7 +4355,10 @@ class TokenCount(Field):
4143
4355
  if doc_values is not DEFAULT:
4144
4356
  kwargs["doc_values"] = doc_values
4145
4357
  if copy_to is not DEFAULT:
4146
- kwargs["copy_to"] = str(copy_to)
4358
+ if isinstance(copy_to, list):
4359
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4360
+ else:
4361
+ kwargs["copy_to"] = str(copy_to)
4147
4362
  if store is not DEFAULT:
4148
4363
  kwargs["store"] = store
4149
4364
  if meta is not DEFAULT:
@@ -4246,7 +4461,10 @@ class UnsignedLong(Field):
4246
4461
  if doc_values is not DEFAULT:
4247
4462
  kwargs["doc_values"] = doc_values
4248
4463
  if copy_to is not DEFAULT:
4249
- kwargs["copy_to"] = str(copy_to)
4464
+ if isinstance(copy_to, list):
4465
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4466
+ else:
4467
+ kwargs["copy_to"] = str(copy_to)
4250
4468
  if store is not DEFAULT:
4251
4469
  kwargs["store"] = store
4252
4470
  if meta is not DEFAULT:
@@ -4308,7 +4526,10 @@ class Version(Field):
4308
4526
  if doc_values is not DEFAULT:
4309
4527
  kwargs["doc_values"] = doc_values
4310
4528
  if copy_to is not DEFAULT:
4311
- kwargs["copy_to"] = str(copy_to)
4529
+ if isinstance(copy_to, list):
4530
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4531
+ else:
4532
+ kwargs["copy_to"] = str(copy_to)
4312
4533
  if store is not DEFAULT:
4313
4534
  kwargs["store"] = store
4314
4535
  if meta is not DEFAULT:
@@ -4374,7 +4595,10 @@ class Wildcard(Field):
4374
4595
  if doc_values is not DEFAULT:
4375
4596
  kwargs["doc_values"] = doc_values
4376
4597
  if copy_to is not DEFAULT:
4377
- kwargs["copy_to"] = str(copy_to)
4598
+ if isinstance(copy_to, list):
4599
+ kwargs["copy_to"] = [str(field) for field in copy_to]
4600
+ else:
4601
+ kwargs["copy_to"] = str(copy_to)
4378
4602
  if store is not DEFAULT:
4379
4603
  kwargs["store"] = store
4380
4604
  if meta is not DEFAULT: