elasticsearch 9.0.2__py3-none-any.whl → 9.0.4__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.
- elasticsearch/_async/client/__init__.py +59 -202
- elasticsearch/_async/client/cat.py +1011 -59
- elasticsearch/_async/client/cluster.py +14 -4
- elasticsearch/_async/client/eql.py +10 -2
- elasticsearch/_async/client/esql.py +33 -10
- elasticsearch/_async/client/indices.py +88 -44
- elasticsearch/_async/client/inference.py +108 -3
- elasticsearch/_async/client/ingest.py +0 -7
- elasticsearch/_async/client/license.py +4 -4
- elasticsearch/_async/client/ml.py +6 -17
- elasticsearch/_async/client/monitoring.py +1 -1
- elasticsearch/_async/client/rollup.py +1 -22
- elasticsearch/_async/client/security.py +11 -17
- elasticsearch/_async/client/snapshot.py +6 -0
- elasticsearch/_async/client/sql.py +1 -1
- elasticsearch/_async/client/synonyms.py +1 -0
- elasticsearch/_async/client/transform.py +60 -0
- elasticsearch/_async/client/watcher.py +4 -2
- elasticsearch/_sync/client/__init__.py +59 -202
- elasticsearch/_sync/client/cat.py +1011 -59
- elasticsearch/_sync/client/cluster.py +14 -4
- elasticsearch/_sync/client/eql.py +10 -2
- elasticsearch/_sync/client/esql.py +33 -10
- elasticsearch/_sync/client/indices.py +88 -44
- elasticsearch/_sync/client/inference.py +108 -3
- elasticsearch/_sync/client/ingest.py +0 -7
- elasticsearch/_sync/client/license.py +4 -4
- elasticsearch/_sync/client/ml.py +6 -17
- elasticsearch/_sync/client/monitoring.py +1 -1
- elasticsearch/_sync/client/rollup.py +1 -22
- elasticsearch/_sync/client/security.py +11 -17
- elasticsearch/_sync/client/snapshot.py +6 -0
- elasticsearch/_sync/client/sql.py +1 -1
- elasticsearch/_sync/client/synonyms.py +1 -0
- elasticsearch/_sync/client/transform.py +60 -0
- elasticsearch/_sync/client/watcher.py +4 -2
- elasticsearch/_version.py +1 -1
- elasticsearch/compat.py +5 -0
- elasticsearch/dsl/__init__.py +2 -1
- elasticsearch/dsl/_async/document.py +84 -0
- elasticsearch/dsl/_sync/document.py +84 -0
- elasticsearch/dsl/document_base.py +219 -16
- elasticsearch/dsl/field.py +245 -57
- elasticsearch/dsl/query.py +7 -4
- elasticsearch/dsl/response/aggs.py +1 -1
- elasticsearch/dsl/types.py +125 -88
- elasticsearch/dsl/utils.py +2 -2
- elasticsearch/{dsl/_sync/_sync_check → esql}/__init__.py +3 -0
- elasticsearch/esql/esql.py +1156 -0
- elasticsearch/esql/functions.py +1750 -0
- {elasticsearch-9.0.2.dist-info → elasticsearch-9.0.4.dist-info}/METADATA +1 -3
- {elasticsearch-9.0.2.dist-info → elasticsearch-9.0.4.dist-info}/RECORD +55 -59
- elasticsearch/dsl/_sync/_sync_check/document.py +0 -514
- elasticsearch/dsl/_sync/_sync_check/faceted_search.py +0 -50
- elasticsearch/dsl/_sync/_sync_check/index.py +0 -597
- elasticsearch/dsl/_sync/_sync_check/mapping.py +0 -49
- elasticsearch/dsl/_sync/_sync_check/search.py +0 -230
- elasticsearch/dsl/_sync/_sync_check/update_by_query.py +0 -45
- {elasticsearch-9.0.2.dist-info → elasticsearch-9.0.4.dist-info}/WHEEL +0 -0
- {elasticsearch-9.0.2.dist-info → elasticsearch-9.0.4.dist-info}/licenses/LICENSE +0 -0
- {elasticsearch-9.0.2.dist-info → elasticsearch-9.0.4.dist-info}/licenses/NOTICE +0 -0
elasticsearch/dsl/field.py
CHANGED
|
@@ -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(
|
|
139
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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:
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,11 +3862,6 @@ 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.
|
|
3692
|
-
:arg chunking_settings: Settings for chunking text into smaller
|
|
3693
|
-
passages. If specified, these will override the chunking settings
|
|
3694
|
-
sent in the inference endpoint associated with inference_id. If
|
|
3695
|
-
chunking settings are updated, they will not be applied to
|
|
3696
|
-
existing documents until they are reindexed.
|
|
3697
3865
|
"""
|
|
3698
3866
|
|
|
3699
3867
|
name = "semantic_text"
|
|
@@ -3704,9 +3872,6 @@ class SemanticText(Field):
|
|
|
3704
3872
|
meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
|
|
3705
3873
|
inference_id: Union[str, "DefaultType"] = DEFAULT,
|
|
3706
3874
|
search_inference_id: Union[str, "DefaultType"] = DEFAULT,
|
|
3707
|
-
chunking_settings: Union[
|
|
3708
|
-
"types.ChunkingSettings", Dict[str, Any], "DefaultType"
|
|
3709
|
-
] = DEFAULT,
|
|
3710
3875
|
**kwargs: Any,
|
|
3711
3876
|
):
|
|
3712
3877
|
if meta is not DEFAULT:
|
|
@@ -3715,8 +3880,6 @@ class SemanticText(Field):
|
|
|
3715
3880
|
kwargs["inference_id"] = inference_id
|
|
3716
3881
|
if search_inference_id is not DEFAULT:
|
|
3717
3882
|
kwargs["search_inference_id"] = search_inference_id
|
|
3718
|
-
if chunking_settings is not DEFAULT:
|
|
3719
|
-
kwargs["chunking_settings"] = chunking_settings
|
|
3720
3883
|
super().__init__(*args, **kwargs)
|
|
3721
3884
|
|
|
3722
3885
|
|
|
@@ -3783,7 +3946,10 @@ class Shape(Field):
|
|
|
3783
3946
|
if doc_values is not DEFAULT:
|
|
3784
3947
|
kwargs["doc_values"] = doc_values
|
|
3785
3948
|
if copy_to is not DEFAULT:
|
|
3786
|
-
|
|
3949
|
+
if isinstance(copy_to, list):
|
|
3950
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
3951
|
+
else:
|
|
3952
|
+
kwargs["copy_to"] = str(copy_to)
|
|
3787
3953
|
if store is not DEFAULT:
|
|
3788
3954
|
kwargs["store"] = store
|
|
3789
3955
|
if meta is not DEFAULT:
|
|
@@ -3886,7 +4052,10 @@ class Short(Integer):
|
|
|
3886
4052
|
if doc_values is not DEFAULT:
|
|
3887
4053
|
kwargs["doc_values"] = doc_values
|
|
3888
4054
|
if copy_to is not DEFAULT:
|
|
3889
|
-
|
|
4055
|
+
if isinstance(copy_to, list):
|
|
4056
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4057
|
+
else:
|
|
4058
|
+
kwargs["copy_to"] = str(copy_to)
|
|
3890
4059
|
if store is not DEFAULT:
|
|
3891
4060
|
kwargs["store"] = store
|
|
3892
4061
|
if meta is not DEFAULT:
|
|
@@ -3906,6 +4075,7 @@ class Short(Integer):
|
|
|
3906
4075
|
|
|
3907
4076
|
class SparseVector(Field):
|
|
3908
4077
|
"""
|
|
4078
|
+
:arg store:
|
|
3909
4079
|
:arg meta: Metadata about the field.
|
|
3910
4080
|
:arg properties:
|
|
3911
4081
|
:arg ignore_above:
|
|
@@ -3923,6 +4093,7 @@ class SparseVector(Field):
|
|
|
3923
4093
|
def __init__(
|
|
3924
4094
|
self,
|
|
3925
4095
|
*args: Any,
|
|
4096
|
+
store: Union[bool, "DefaultType"] = DEFAULT,
|
|
3926
4097
|
meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
|
|
3927
4098
|
properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
|
|
3928
4099
|
ignore_above: Union[int, "DefaultType"] = DEFAULT,
|
|
@@ -3935,6 +4106,8 @@ class SparseVector(Field):
|
|
|
3935
4106
|
] = DEFAULT,
|
|
3936
4107
|
**kwargs: Any,
|
|
3937
4108
|
):
|
|
4109
|
+
if store is not DEFAULT:
|
|
4110
|
+
kwargs["store"] = store
|
|
3938
4111
|
if meta is not DEFAULT:
|
|
3939
4112
|
kwargs["meta"] = meta
|
|
3940
4113
|
if properties is not DEFAULT:
|
|
@@ -4070,7 +4243,10 @@ class Text(Field):
|
|
|
4070
4243
|
if term_vector is not DEFAULT:
|
|
4071
4244
|
kwargs["term_vector"] = term_vector
|
|
4072
4245
|
if copy_to is not DEFAULT:
|
|
4073
|
-
|
|
4246
|
+
if isinstance(copy_to, list):
|
|
4247
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4248
|
+
else:
|
|
4249
|
+
kwargs["copy_to"] = str(copy_to)
|
|
4074
4250
|
if store is not DEFAULT:
|
|
4075
4251
|
kwargs["store"] = store
|
|
4076
4252
|
if meta is not DEFAULT:
|
|
@@ -4153,7 +4329,10 @@ class TokenCount(Field):
|
|
|
4153
4329
|
if doc_values is not DEFAULT:
|
|
4154
4330
|
kwargs["doc_values"] = doc_values
|
|
4155
4331
|
if copy_to is not DEFAULT:
|
|
4156
|
-
|
|
4332
|
+
if isinstance(copy_to, list):
|
|
4333
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4334
|
+
else:
|
|
4335
|
+
kwargs["copy_to"] = str(copy_to)
|
|
4157
4336
|
if store is not DEFAULT:
|
|
4158
4337
|
kwargs["store"] = store
|
|
4159
4338
|
if meta is not DEFAULT:
|
|
@@ -4256,7 +4435,10 @@ class UnsignedLong(Field):
|
|
|
4256
4435
|
if doc_values is not DEFAULT:
|
|
4257
4436
|
kwargs["doc_values"] = doc_values
|
|
4258
4437
|
if copy_to is not DEFAULT:
|
|
4259
|
-
|
|
4438
|
+
if isinstance(copy_to, list):
|
|
4439
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4440
|
+
else:
|
|
4441
|
+
kwargs["copy_to"] = str(copy_to)
|
|
4260
4442
|
if store is not DEFAULT:
|
|
4261
4443
|
kwargs["store"] = store
|
|
4262
4444
|
if meta is not DEFAULT:
|
|
@@ -4318,7 +4500,10 @@ class Version(Field):
|
|
|
4318
4500
|
if doc_values is not DEFAULT:
|
|
4319
4501
|
kwargs["doc_values"] = doc_values
|
|
4320
4502
|
if copy_to is not DEFAULT:
|
|
4321
|
-
|
|
4503
|
+
if isinstance(copy_to, list):
|
|
4504
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4505
|
+
else:
|
|
4506
|
+
kwargs["copy_to"] = str(copy_to)
|
|
4322
4507
|
if store is not DEFAULT:
|
|
4323
4508
|
kwargs["store"] = store
|
|
4324
4509
|
if meta is not DEFAULT:
|
|
@@ -4384,7 +4569,10 @@ class Wildcard(Field):
|
|
|
4384
4569
|
if doc_values is not DEFAULT:
|
|
4385
4570
|
kwargs["doc_values"] = doc_values
|
|
4386
4571
|
if copy_to is not DEFAULT:
|
|
4387
|
-
|
|
4572
|
+
if isinstance(copy_to, list):
|
|
4573
|
+
kwargs["copy_to"] = [str(field) for field in copy_to]
|
|
4574
|
+
else:
|
|
4575
|
+
kwargs["copy_to"] = str(copy_to)
|
|
4388
4576
|
if store is not DEFAULT:
|
|
4389
4577
|
kwargs["store"] = store
|
|
4390
4578
|
if meta is not DEFAULT:
|