elasticsearch9 9.0.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 (160) hide show
  1. elasticsearch9/__init__.py +98 -0
  2. elasticsearch9/_async/__init__.py +16 -0
  3. elasticsearch9/_async/client/__init__.py +6531 -0
  4. elasticsearch9/_async/client/_base.py +430 -0
  5. elasticsearch9/_async/client/async_search.py +637 -0
  6. elasticsearch9/_async/client/autoscaling.py +252 -0
  7. elasticsearch9/_async/client/cat.py +2995 -0
  8. elasticsearch9/_async/client/ccr.py +1043 -0
  9. elasticsearch9/_async/client/cluster.py +1223 -0
  10. elasticsearch9/_async/client/connector.py +1978 -0
  11. elasticsearch9/_async/client/dangling_indices.py +192 -0
  12. elasticsearch9/_async/client/enrich.py +291 -0
  13. elasticsearch9/_async/client/eql.py +359 -0
  14. elasticsearch9/_async/client/esql.py +490 -0
  15. elasticsearch9/_async/client/features.py +130 -0
  16. elasticsearch9/_async/client/fleet.py +658 -0
  17. elasticsearch9/_async/client/graph.py +113 -0
  18. elasticsearch9/_async/client/ilm.py +668 -0
  19. elasticsearch9/_async/client/indices.py +5582 -0
  20. elasticsearch9/_async/client/inference.py +2247 -0
  21. elasticsearch9/_async/client/ingest.py +766 -0
  22. elasticsearch9/_async/client/license.py +400 -0
  23. elasticsearch9/_async/client/logstash.py +176 -0
  24. elasticsearch9/_async/client/migration.py +160 -0
  25. elasticsearch9/_async/client/ml.py +5835 -0
  26. elasticsearch9/_async/client/monitoring.py +100 -0
  27. elasticsearch9/_async/client/nodes.py +543 -0
  28. elasticsearch9/_async/client/query_rules.py +485 -0
  29. elasticsearch9/_async/client/rollup.py +616 -0
  30. elasticsearch9/_async/client/search_application.py +574 -0
  31. elasticsearch9/_async/client/searchable_snapshots.py +313 -0
  32. elasticsearch9/_async/client/security.py +4688 -0
  33. elasticsearch9/_async/client/shutdown.py +268 -0
  34. elasticsearch9/_async/client/simulate.py +145 -0
  35. elasticsearch9/_async/client/slm.py +559 -0
  36. elasticsearch9/_async/client/snapshot.py +1338 -0
  37. elasticsearch9/_async/client/sql.py +469 -0
  38. elasticsearch9/_async/client/ssl.py +76 -0
  39. elasticsearch9/_async/client/synonyms.py +413 -0
  40. elasticsearch9/_async/client/tasks.py +295 -0
  41. elasticsearch9/_async/client/text_structure.py +664 -0
  42. elasticsearch9/_async/client/transform.py +922 -0
  43. elasticsearch9/_async/client/utils.py +48 -0
  44. elasticsearch9/_async/client/watcher.py +894 -0
  45. elasticsearch9/_async/client/xpack.py +134 -0
  46. elasticsearch9/_async/helpers.py +596 -0
  47. elasticsearch9/_otel.py +110 -0
  48. elasticsearch9/_sync/__init__.py +16 -0
  49. elasticsearch9/_sync/client/__init__.py +6529 -0
  50. elasticsearch9/_sync/client/_base.py +430 -0
  51. elasticsearch9/_sync/client/async_search.py +637 -0
  52. elasticsearch9/_sync/client/autoscaling.py +252 -0
  53. elasticsearch9/_sync/client/cat.py +2995 -0
  54. elasticsearch9/_sync/client/ccr.py +1043 -0
  55. elasticsearch9/_sync/client/cluster.py +1223 -0
  56. elasticsearch9/_sync/client/connector.py +1978 -0
  57. elasticsearch9/_sync/client/dangling_indices.py +192 -0
  58. elasticsearch9/_sync/client/enrich.py +291 -0
  59. elasticsearch9/_sync/client/eql.py +359 -0
  60. elasticsearch9/_sync/client/esql.py +490 -0
  61. elasticsearch9/_sync/client/features.py +130 -0
  62. elasticsearch9/_sync/client/fleet.py +658 -0
  63. elasticsearch9/_sync/client/graph.py +113 -0
  64. elasticsearch9/_sync/client/ilm.py +668 -0
  65. elasticsearch9/_sync/client/indices.py +5582 -0
  66. elasticsearch9/_sync/client/inference.py +2247 -0
  67. elasticsearch9/_sync/client/ingest.py +766 -0
  68. elasticsearch9/_sync/client/license.py +400 -0
  69. elasticsearch9/_sync/client/logstash.py +176 -0
  70. elasticsearch9/_sync/client/migration.py +160 -0
  71. elasticsearch9/_sync/client/ml.py +5835 -0
  72. elasticsearch9/_sync/client/monitoring.py +100 -0
  73. elasticsearch9/_sync/client/nodes.py +543 -0
  74. elasticsearch9/_sync/client/query_rules.py +485 -0
  75. elasticsearch9/_sync/client/rollup.py +616 -0
  76. elasticsearch9/_sync/client/search_application.py +574 -0
  77. elasticsearch9/_sync/client/searchable_snapshots.py +313 -0
  78. elasticsearch9/_sync/client/security.py +4688 -0
  79. elasticsearch9/_sync/client/shutdown.py +268 -0
  80. elasticsearch9/_sync/client/simulate.py +145 -0
  81. elasticsearch9/_sync/client/slm.py +559 -0
  82. elasticsearch9/_sync/client/snapshot.py +1338 -0
  83. elasticsearch9/_sync/client/sql.py +469 -0
  84. elasticsearch9/_sync/client/ssl.py +76 -0
  85. elasticsearch9/_sync/client/synonyms.py +413 -0
  86. elasticsearch9/_sync/client/tasks.py +295 -0
  87. elasticsearch9/_sync/client/text_structure.py +664 -0
  88. elasticsearch9/_sync/client/transform.py +922 -0
  89. elasticsearch9/_sync/client/utils.py +475 -0
  90. elasticsearch9/_sync/client/watcher.py +894 -0
  91. elasticsearch9/_sync/client/xpack.py +134 -0
  92. elasticsearch9/_utils.py +34 -0
  93. elasticsearch9/_version.py +18 -0
  94. elasticsearch9/client.py +126 -0
  95. elasticsearch9/compat.py +79 -0
  96. elasticsearch9/dsl/__init__.py +203 -0
  97. elasticsearch9/dsl/_async/__init__.py +16 -0
  98. elasticsearch9/dsl/_async/document.py +522 -0
  99. elasticsearch9/dsl/_async/faceted_search.py +50 -0
  100. elasticsearch9/dsl/_async/index.py +639 -0
  101. elasticsearch9/dsl/_async/mapping.py +49 -0
  102. elasticsearch9/dsl/_async/search.py +237 -0
  103. elasticsearch9/dsl/_async/update_by_query.py +47 -0
  104. elasticsearch9/dsl/_sync/__init__.py +16 -0
  105. elasticsearch9/dsl/_sync/document.py +514 -0
  106. elasticsearch9/dsl/_sync/faceted_search.py +50 -0
  107. elasticsearch9/dsl/_sync/index.py +597 -0
  108. elasticsearch9/dsl/_sync/mapping.py +49 -0
  109. elasticsearch9/dsl/_sync/search.py +230 -0
  110. elasticsearch9/dsl/_sync/update_by_query.py +45 -0
  111. elasticsearch9/dsl/aggs.py +3734 -0
  112. elasticsearch9/dsl/analysis.py +341 -0
  113. elasticsearch9/dsl/async_connections.py +37 -0
  114. elasticsearch9/dsl/connections.py +142 -0
  115. elasticsearch9/dsl/document.py +20 -0
  116. elasticsearch9/dsl/document_base.py +444 -0
  117. elasticsearch9/dsl/exceptions.py +32 -0
  118. elasticsearch9/dsl/faceted_search.py +28 -0
  119. elasticsearch9/dsl/faceted_search_base.py +489 -0
  120. elasticsearch9/dsl/field.py +4392 -0
  121. elasticsearch9/dsl/function.py +180 -0
  122. elasticsearch9/dsl/index.py +23 -0
  123. elasticsearch9/dsl/index_base.py +178 -0
  124. elasticsearch9/dsl/mapping.py +19 -0
  125. elasticsearch9/dsl/mapping_base.py +219 -0
  126. elasticsearch9/dsl/query.py +2822 -0
  127. elasticsearch9/dsl/response/__init__.py +388 -0
  128. elasticsearch9/dsl/response/aggs.py +100 -0
  129. elasticsearch9/dsl/response/hit.py +53 -0
  130. elasticsearch9/dsl/search.py +20 -0
  131. elasticsearch9/dsl/search_base.py +1053 -0
  132. elasticsearch9/dsl/serializer.py +34 -0
  133. elasticsearch9/dsl/types.py +6453 -0
  134. elasticsearch9/dsl/update_by_query.py +19 -0
  135. elasticsearch9/dsl/update_by_query_base.py +149 -0
  136. elasticsearch9/dsl/utils.py +687 -0
  137. elasticsearch9/dsl/wrappers.py +144 -0
  138. elasticsearch9/exceptions.py +133 -0
  139. elasticsearch9/helpers/__init__.py +41 -0
  140. elasticsearch9/helpers/actions.py +875 -0
  141. elasticsearch9/helpers/errors.py +40 -0
  142. elasticsearch9/helpers/vectorstore/__init__.py +62 -0
  143. elasticsearch9/helpers/vectorstore/_async/__init__.py +16 -0
  144. elasticsearch9/helpers/vectorstore/_async/_utils.py +39 -0
  145. elasticsearch9/helpers/vectorstore/_async/embedding_service.py +89 -0
  146. elasticsearch9/helpers/vectorstore/_async/strategies.py +487 -0
  147. elasticsearch9/helpers/vectorstore/_async/vectorstore.py +421 -0
  148. elasticsearch9/helpers/vectorstore/_sync/__init__.py +16 -0
  149. elasticsearch9/helpers/vectorstore/_sync/_utils.py +39 -0
  150. elasticsearch9/helpers/vectorstore/_sync/embedding_service.py +89 -0
  151. elasticsearch9/helpers/vectorstore/_sync/strategies.py +487 -0
  152. elasticsearch9/helpers/vectorstore/_sync/vectorstore.py +421 -0
  153. elasticsearch9/helpers/vectorstore/_utils.py +116 -0
  154. elasticsearch9/py.typed +0 -0
  155. elasticsearch9/serializer.py +250 -0
  156. elasticsearch9-9.0.0.dist-info/METADATA +175 -0
  157. elasticsearch9-9.0.0.dist-info/RECORD +160 -0
  158. elasticsearch9-9.0.0.dist-info/WHEEL +4 -0
  159. elasticsearch9-9.0.0.dist-info/licenses/LICENSE +176 -0
  160. elasticsearch9-9.0.0.dist-info/licenses/NOTICE +2 -0
@@ -0,0 +1,4392 @@
1
+ # Licensed to Elasticsearch B.V. under one or more contributor
2
+ # license agreements. See the NOTICE file distributed with
3
+ # this work for additional information regarding copyright
4
+ # ownership. Elasticsearch B.V. licenses this file to you under
5
+ # the Apache License, Version 2.0 (the "License"); you may
6
+ # not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing,
12
+ # software distributed under the License is distributed on an
13
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ # KIND, either express or implied. See the License for the
15
+ # specific language governing permissions and limitations
16
+ # under the License.
17
+
18
+ import base64
19
+ import collections.abc
20
+ import ipaddress
21
+ from copy import deepcopy
22
+ from datetime import date, datetime
23
+ from typing import (
24
+ TYPE_CHECKING,
25
+ Any,
26
+ Dict,
27
+ Iterable,
28
+ Iterator,
29
+ Literal,
30
+ Mapping,
31
+ Optional,
32
+ Sequence,
33
+ Tuple,
34
+ Type,
35
+ Union,
36
+ cast,
37
+ )
38
+
39
+ from dateutil import parser, tz
40
+ from elastic_transport.client_utils import DEFAULT, DefaultType
41
+
42
+ from .exceptions import ValidationException
43
+ from .query import Q
44
+ from .utils import AttrDict, AttrList, DslBase
45
+ from .wrappers import Range
46
+
47
+ if TYPE_CHECKING:
48
+ from datetime import tzinfo
49
+ from ipaddress import IPv4Address, IPv6Address
50
+
51
+ from _operator import _SupportsComparison
52
+
53
+ from . import types
54
+ from .document import InnerDoc
55
+ from .document_base import InstrumentedField
56
+ from .mapping_base import MappingBase
57
+ from .query import Query
58
+
59
+ unicode = str
60
+
61
+
62
+ def construct_field(
63
+ name_or_field: Union[
64
+ str,
65
+ "Field",
66
+ Dict[str, Any],
67
+ ],
68
+ **params: Any,
69
+ ) -> "Field":
70
+ # {"type": "text", "analyzer": "snowball"}
71
+ if isinstance(name_or_field, collections.abc.Mapping):
72
+ if params:
73
+ raise ValueError(
74
+ "construct_field() cannot accept parameters when passing in a dict."
75
+ )
76
+ params = deepcopy(name_or_field)
77
+ if "type" not in params:
78
+ # inner object can be implicitly defined
79
+ if "properties" in params:
80
+ name = "object"
81
+ else:
82
+ raise ValueError('construct_field() needs to have a "type" key.')
83
+ else:
84
+ name = params.pop("type")
85
+ return Field.get_dsl_class(name)(**params)
86
+
87
+ # Text()
88
+ if isinstance(name_or_field, Field):
89
+ if params:
90
+ raise ValueError(
91
+ "construct_field() cannot accept parameters "
92
+ "when passing in a construct_field object."
93
+ )
94
+ return name_or_field
95
+
96
+ # "text", analyzer="snowball"
97
+ return Field.get_dsl_class(name_or_field)(**params)
98
+
99
+
100
+ class Field(DslBase):
101
+ _type_name = "field"
102
+ _type_shortcut = staticmethod(construct_field)
103
+ # all fields can be multifields
104
+ _param_defs = {"fields": {"type": "field", "hash": True}}
105
+ name = ""
106
+ _coerce = False
107
+
108
+ def __init__(
109
+ self, multi: bool = False, required: bool = False, *args: Any, **kwargs: Any
110
+ ):
111
+ """
112
+ :arg bool multi: specifies whether field can contain array of values
113
+ :arg bool required: specifies whether field is required
114
+ """
115
+ self._multi = multi
116
+ self._required = required
117
+ super().__init__(*args, **kwargs)
118
+
119
+ def __getitem__(self, subfield: str) -> "Field":
120
+ return cast(Field, self._params.get("fields", {})[subfield])
121
+
122
+ def _serialize(self, data: Any) -> Any:
123
+ return data
124
+
125
+ def _deserialize(self, data: Any) -> Any:
126
+ return data
127
+
128
+ def _empty(self) -> Optional[Any]:
129
+ return None
130
+
131
+ def empty(self) -> Optional[Any]:
132
+ if self._multi:
133
+ return AttrList([])
134
+ return self._empty()
135
+
136
+ def serialize(self, data: Any) -> Any:
137
+ if isinstance(data, (list, AttrList, tuple)):
138
+ return list(map(self._serialize, cast(Iterable[Any], data)))
139
+ return self._serialize(data)
140
+
141
+ def deserialize(self, data: Any) -> Any:
142
+ if isinstance(data, (list, AttrList, tuple)):
143
+ data = [
144
+ None if d is None else self._deserialize(d)
145
+ for d in cast(Iterable[Any], data)
146
+ ]
147
+ return data
148
+ if data is None:
149
+ return None
150
+ return self._deserialize(data)
151
+
152
+ def clean(self, data: Any) -> Any:
153
+ if data is not None:
154
+ data = self.deserialize(data)
155
+ if data in (None, [], {}) and self._required:
156
+ raise ValidationException("Value required for this field.")
157
+ return data
158
+
159
+ def to_dict(self) -> Dict[str, Any]:
160
+ d = super().to_dict()
161
+ name, value = cast(Tuple[str, Dict[str, Any]], d.popitem())
162
+ value["type"] = name
163
+ return value
164
+
165
+
166
+ class CustomField(Field):
167
+ name = "custom"
168
+ _coerce = True
169
+
170
+ def to_dict(self) -> Dict[str, Any]:
171
+ if isinstance(self.builtin_type, Field):
172
+ return self.builtin_type.to_dict()
173
+
174
+ d = super().to_dict()
175
+ d["type"] = self.builtin_type
176
+ return d
177
+
178
+
179
+ class RangeField(Field):
180
+ _coerce = True
181
+ _core_field: Optional[Field] = None
182
+
183
+ def _deserialize(self, data: Any) -> Range["_SupportsComparison"]:
184
+ if isinstance(data, Range):
185
+ return data
186
+ data = {k: self._core_field.deserialize(v) for k, v in data.items()} # type: ignore[union-attr]
187
+ return Range(data)
188
+
189
+ def _serialize(self, data: Any) -> Optional[Dict[str, Any]]:
190
+ if data is None:
191
+ return None
192
+ if not isinstance(data, collections.abc.Mapping):
193
+ data = data.to_dict()
194
+ return {k: self._core_field.serialize(v) for k, v in data.items()} # type: ignore[union-attr]
195
+
196
+
197
+ class Float(Field):
198
+ """
199
+ :arg null_value:
200
+ :arg boost:
201
+ :arg coerce:
202
+ :arg ignore_malformed:
203
+ :arg index:
204
+ :arg on_script_error:
205
+ :arg script:
206
+ :arg time_series_metric: For internal use by Elastic only. Marks the
207
+ field as a time series dimension. Defaults to false.
208
+ :arg time_series_dimension: For internal use by Elastic only. Marks
209
+ the field as a time series dimension. Defaults to false.
210
+ :arg doc_values:
211
+ :arg copy_to:
212
+ :arg store:
213
+ :arg meta: Metadata about the field.
214
+ :arg properties:
215
+ :arg ignore_above:
216
+ :arg dynamic:
217
+ :arg fields:
218
+ :arg synthetic_source_keep:
219
+ """
220
+
221
+ name = "float"
222
+ _coerce = True
223
+ _param_defs = {
224
+ "properties": {"type": "field", "hash": True},
225
+ "fields": {"type": "field", "hash": True},
226
+ }
227
+
228
+ def __init__(
229
+ self,
230
+ *args: Any,
231
+ null_value: Union[float, "DefaultType"] = DEFAULT,
232
+ boost: Union[float, "DefaultType"] = DEFAULT,
233
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
234
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
235
+ index: Union[bool, "DefaultType"] = DEFAULT,
236
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
237
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
238
+ time_series_metric: Union[
239
+ Literal["gauge", "counter", "summary", "histogram", "position"],
240
+ "DefaultType",
241
+ ] = DEFAULT,
242
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
243
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
244
+ copy_to: Union[
245
+ Union[str, "InstrumentedField"],
246
+ Sequence[Union[str, "InstrumentedField"]],
247
+ "DefaultType",
248
+ ] = DEFAULT,
249
+ store: Union[bool, "DefaultType"] = DEFAULT,
250
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
251
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
252
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
253
+ dynamic: Union[
254
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
255
+ ] = DEFAULT,
256
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
257
+ synthetic_source_keep: Union[
258
+ Literal["none", "arrays", "all"], "DefaultType"
259
+ ] = DEFAULT,
260
+ **kwargs: Any,
261
+ ):
262
+ if null_value is not DEFAULT:
263
+ kwargs["null_value"] = null_value
264
+ if boost is not DEFAULT:
265
+ kwargs["boost"] = boost
266
+ if coerce is not DEFAULT:
267
+ kwargs["coerce"] = coerce
268
+ if ignore_malformed is not DEFAULT:
269
+ kwargs["ignore_malformed"] = ignore_malformed
270
+ if index is not DEFAULT:
271
+ kwargs["index"] = index
272
+ if on_script_error is not DEFAULT:
273
+ kwargs["on_script_error"] = on_script_error
274
+ if script is not DEFAULT:
275
+ kwargs["script"] = script
276
+ if time_series_metric is not DEFAULT:
277
+ kwargs["time_series_metric"] = time_series_metric
278
+ if time_series_dimension is not DEFAULT:
279
+ kwargs["time_series_dimension"] = time_series_dimension
280
+ if doc_values is not DEFAULT:
281
+ kwargs["doc_values"] = doc_values
282
+ if copy_to is not DEFAULT:
283
+ kwargs["copy_to"] = str(copy_to)
284
+ if store is not DEFAULT:
285
+ kwargs["store"] = store
286
+ if meta is not DEFAULT:
287
+ kwargs["meta"] = meta
288
+ if properties is not DEFAULT:
289
+ kwargs["properties"] = properties
290
+ if ignore_above is not DEFAULT:
291
+ kwargs["ignore_above"] = ignore_above
292
+ if dynamic is not DEFAULT:
293
+ kwargs["dynamic"] = dynamic
294
+ if fields is not DEFAULT:
295
+ kwargs["fields"] = fields
296
+ if synthetic_source_keep is not DEFAULT:
297
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
298
+ super().__init__(*args, **kwargs)
299
+
300
+ def _deserialize(self, data: Any) -> float:
301
+ return float(data)
302
+
303
+
304
+ class Integer(Field):
305
+ """
306
+ :arg null_value:
307
+ :arg boost:
308
+ :arg coerce:
309
+ :arg ignore_malformed:
310
+ :arg index:
311
+ :arg on_script_error:
312
+ :arg script:
313
+ :arg time_series_metric: For internal use by Elastic only. Marks the
314
+ field as a time series dimension. Defaults to false.
315
+ :arg time_series_dimension: For internal use by Elastic only. Marks
316
+ the field as a time series dimension. Defaults to false.
317
+ :arg doc_values:
318
+ :arg copy_to:
319
+ :arg store:
320
+ :arg meta: Metadata about the field.
321
+ :arg properties:
322
+ :arg ignore_above:
323
+ :arg dynamic:
324
+ :arg fields:
325
+ :arg synthetic_source_keep:
326
+ """
327
+
328
+ name = "integer"
329
+ _coerce = True
330
+ _param_defs = {
331
+ "properties": {"type": "field", "hash": True},
332
+ "fields": {"type": "field", "hash": True},
333
+ }
334
+
335
+ def __init__(
336
+ self,
337
+ *args: Any,
338
+ null_value: Union[int, "DefaultType"] = DEFAULT,
339
+ boost: Union[float, "DefaultType"] = DEFAULT,
340
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
341
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
342
+ index: Union[bool, "DefaultType"] = DEFAULT,
343
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
344
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
345
+ time_series_metric: Union[
346
+ Literal["gauge", "counter", "summary", "histogram", "position"],
347
+ "DefaultType",
348
+ ] = DEFAULT,
349
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
350
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
351
+ copy_to: Union[
352
+ Union[str, "InstrumentedField"],
353
+ Sequence[Union[str, "InstrumentedField"]],
354
+ "DefaultType",
355
+ ] = DEFAULT,
356
+ store: Union[bool, "DefaultType"] = DEFAULT,
357
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
358
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
359
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
360
+ dynamic: Union[
361
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
362
+ ] = DEFAULT,
363
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
364
+ synthetic_source_keep: Union[
365
+ Literal["none", "arrays", "all"], "DefaultType"
366
+ ] = DEFAULT,
367
+ **kwargs: Any,
368
+ ):
369
+ if null_value is not DEFAULT:
370
+ kwargs["null_value"] = null_value
371
+ if boost is not DEFAULT:
372
+ kwargs["boost"] = boost
373
+ if coerce is not DEFAULT:
374
+ kwargs["coerce"] = coerce
375
+ if ignore_malformed is not DEFAULT:
376
+ kwargs["ignore_malformed"] = ignore_malformed
377
+ if index is not DEFAULT:
378
+ kwargs["index"] = index
379
+ if on_script_error is not DEFAULT:
380
+ kwargs["on_script_error"] = on_script_error
381
+ if script is not DEFAULT:
382
+ kwargs["script"] = script
383
+ if time_series_metric is not DEFAULT:
384
+ kwargs["time_series_metric"] = time_series_metric
385
+ if time_series_dimension is not DEFAULT:
386
+ kwargs["time_series_dimension"] = time_series_dimension
387
+ if doc_values is not DEFAULT:
388
+ kwargs["doc_values"] = doc_values
389
+ if copy_to is not DEFAULT:
390
+ kwargs["copy_to"] = str(copy_to)
391
+ if store is not DEFAULT:
392
+ kwargs["store"] = store
393
+ if meta is not DEFAULT:
394
+ kwargs["meta"] = meta
395
+ if properties is not DEFAULT:
396
+ kwargs["properties"] = properties
397
+ if ignore_above is not DEFAULT:
398
+ kwargs["ignore_above"] = ignore_above
399
+ if dynamic is not DEFAULT:
400
+ kwargs["dynamic"] = dynamic
401
+ if fields is not DEFAULT:
402
+ kwargs["fields"] = fields
403
+ if synthetic_source_keep is not DEFAULT:
404
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
405
+ super().__init__(*args, **kwargs)
406
+
407
+ def _deserialize(self, data: Any) -> int:
408
+ return int(data)
409
+
410
+
411
+ class Object(Field):
412
+ """
413
+ :arg doc_class: base doc class that handles mapping.
414
+ If no `doc_class` is provided, new instance of `InnerDoc` will be created,
415
+ populated with `properties` and used. Can not be provided together with `properties`
416
+ :arg enabled:
417
+ :arg subobjects:
418
+ :arg copy_to:
419
+ :arg store:
420
+ :arg meta: Metadata about the field.
421
+ :arg properties:
422
+ :arg ignore_above:
423
+ :arg dynamic:
424
+ :arg fields:
425
+ :arg synthetic_source_keep:
426
+ """
427
+
428
+ name = "object"
429
+ _coerce = True
430
+ _param_defs = {
431
+ "properties": {"type": "field", "hash": True},
432
+ "fields": {"type": "field", "hash": True},
433
+ }
434
+
435
+ def __init__(
436
+ self,
437
+ doc_class: Union[Type["InnerDoc"], "DefaultType"] = DEFAULT,
438
+ *args: Any,
439
+ enabled: Union[bool, "DefaultType"] = DEFAULT,
440
+ subobjects: Union[
441
+ Literal["true", "false", "auto"], bool, "DefaultType"
442
+ ] = DEFAULT,
443
+ copy_to: Union[
444
+ Union[str, "InstrumentedField"],
445
+ Sequence[Union[str, "InstrumentedField"]],
446
+ "DefaultType",
447
+ ] = DEFAULT,
448
+ store: Union[bool, "DefaultType"] = DEFAULT,
449
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
450
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
451
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
452
+ dynamic: Union[
453
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
454
+ ] = DEFAULT,
455
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
456
+ synthetic_source_keep: Union[
457
+ Literal["none", "arrays", "all"], "DefaultType"
458
+ ] = DEFAULT,
459
+ **kwargs: Any,
460
+ ):
461
+ if enabled is not DEFAULT:
462
+ kwargs["enabled"] = enabled
463
+ if subobjects is not DEFAULT:
464
+ kwargs["subobjects"] = subobjects
465
+ if copy_to is not DEFAULT:
466
+ kwargs["copy_to"] = str(copy_to)
467
+ if store is not DEFAULT:
468
+ kwargs["store"] = store
469
+ if meta is not DEFAULT:
470
+ kwargs["meta"] = meta
471
+ if properties is not DEFAULT:
472
+ kwargs["properties"] = properties
473
+ if ignore_above is not DEFAULT:
474
+ kwargs["ignore_above"] = ignore_above
475
+ if dynamic is not DEFAULT:
476
+ kwargs["dynamic"] = dynamic
477
+ if fields is not DEFAULT:
478
+ kwargs["fields"] = fields
479
+ if synthetic_source_keep is not DEFAULT:
480
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
481
+
482
+ if doc_class is not DEFAULT and (
483
+ properties is not DEFAULT or dynamic is not DEFAULT
484
+ ):
485
+ raise ValidationException(
486
+ "doc_class and properties/dynamic should not be provided together"
487
+ )
488
+ if doc_class is not DEFAULT:
489
+ self._doc_class: Type["InnerDoc"] = doc_class
490
+ else:
491
+ # FIXME import
492
+ from .document import InnerDoc
493
+
494
+ # no InnerDoc subclass, creating one instead...
495
+ self._doc_class = type("InnerDoc", (InnerDoc,), {})
496
+ for name, field in (
497
+ properties if properties is not DEFAULT else {}
498
+ ).items():
499
+ self._doc_class._doc_type.mapping.field(name, field)
500
+ if "properties" in kwargs:
501
+ del kwargs["properties"]
502
+ if dynamic is not DEFAULT:
503
+ self._doc_class._doc_type.mapping.meta("dynamic", dynamic)
504
+
505
+ self._mapping: "MappingBase" = deepcopy(self._doc_class._doc_type.mapping)
506
+ super().__init__(**kwargs)
507
+
508
+ def __getitem__(self, name: str) -> Field:
509
+ return self._mapping[name]
510
+
511
+ def __contains__(self, name: str) -> bool:
512
+ return name in self._mapping
513
+
514
+ def _empty(self) -> "InnerDoc":
515
+ return self._wrap({})
516
+
517
+ def _wrap(self, data: Dict[str, Any]) -> "InnerDoc":
518
+ return self._doc_class.from_es(data, data_only=True)
519
+
520
+ def empty(self) -> Union["InnerDoc", AttrList[Any]]:
521
+ if self._multi:
522
+ return AttrList[Any]([], self._wrap)
523
+ return self._empty()
524
+
525
+ def to_dict(self) -> Dict[str, Any]:
526
+ d = self._mapping.to_dict()
527
+ d.update(super().to_dict())
528
+ return d
529
+
530
+ def _collect_fields(self) -> Iterator[Field]:
531
+ return self._mapping.properties._collect_fields()
532
+
533
+ def _deserialize(self, data: Any) -> "InnerDoc":
534
+ # don't wrap already wrapped data
535
+ if isinstance(data, self._doc_class):
536
+ return data
537
+
538
+ if isinstance(data, AttrDict):
539
+ data = data._d_
540
+
541
+ return self._wrap(data)
542
+
543
+ def _serialize(
544
+ self, data: Optional[Union[Dict[str, Any], "InnerDoc"]]
545
+ ) -> Optional[Dict[str, Any]]:
546
+ if data is None:
547
+ return None
548
+
549
+ # somebody assigned raw dict to the field, we should tolerate that
550
+ if isinstance(data, collections.abc.Mapping):
551
+ return data
552
+
553
+ return data.to_dict()
554
+
555
+ def clean(self, data: Any) -> Any:
556
+ data = super().clean(data)
557
+ if data is None:
558
+ return None
559
+ if isinstance(data, (list, AttrList)):
560
+ for d in cast(Iterator["InnerDoc"], data):
561
+ d.full_clean()
562
+ else:
563
+ data.full_clean()
564
+ return data
565
+
566
+ def update(self, other: Any, update_only: bool = False) -> None:
567
+ if not isinstance(other, Object):
568
+ # not an inner/nested object, no merge possible
569
+ return
570
+
571
+ self._mapping.update(other._mapping, update_only)
572
+
573
+
574
+ class AggregateMetricDouble(Field):
575
+ """
576
+ :arg default_metric: (required)
577
+ :arg metrics: (required)
578
+ :arg time_series_metric:
579
+ :arg meta: Metadata about the field.
580
+ :arg properties:
581
+ :arg ignore_above:
582
+ :arg dynamic:
583
+ :arg fields:
584
+ :arg synthetic_source_keep:
585
+ """
586
+
587
+ name = "aggregate_metric_double"
588
+ _param_defs = {
589
+ "properties": {"type": "field", "hash": True},
590
+ "fields": {"type": "field", "hash": True},
591
+ }
592
+
593
+ def __init__(
594
+ self,
595
+ *args: Any,
596
+ default_metric: Union[str, "DefaultType"] = DEFAULT,
597
+ metrics: Union[Sequence[str], "DefaultType"] = DEFAULT,
598
+ time_series_metric: Union[
599
+ Literal["gauge", "counter", "summary", "histogram", "position"],
600
+ "DefaultType",
601
+ ] = DEFAULT,
602
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
603
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
604
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
605
+ dynamic: Union[
606
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
607
+ ] = DEFAULT,
608
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
609
+ synthetic_source_keep: Union[
610
+ Literal["none", "arrays", "all"], "DefaultType"
611
+ ] = DEFAULT,
612
+ **kwargs: Any,
613
+ ):
614
+ if default_metric is not DEFAULT:
615
+ kwargs["default_metric"] = default_metric
616
+ if metrics is not DEFAULT:
617
+ kwargs["metrics"] = metrics
618
+ if time_series_metric is not DEFAULT:
619
+ kwargs["time_series_metric"] = time_series_metric
620
+ if meta is not DEFAULT:
621
+ kwargs["meta"] = meta
622
+ if properties is not DEFAULT:
623
+ kwargs["properties"] = properties
624
+ if ignore_above is not DEFAULT:
625
+ kwargs["ignore_above"] = ignore_above
626
+ if dynamic is not DEFAULT:
627
+ kwargs["dynamic"] = dynamic
628
+ if fields is not DEFAULT:
629
+ kwargs["fields"] = fields
630
+ if synthetic_source_keep is not DEFAULT:
631
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
632
+ super().__init__(*args, **kwargs)
633
+
634
+
635
+ class Alias(Field):
636
+ """
637
+ :arg path:
638
+ :arg meta: Metadata about the field.
639
+ :arg properties:
640
+ :arg ignore_above:
641
+ :arg dynamic:
642
+ :arg fields:
643
+ :arg synthetic_source_keep:
644
+ """
645
+
646
+ name = "alias"
647
+ _param_defs = {
648
+ "properties": {"type": "field", "hash": True},
649
+ "fields": {"type": "field", "hash": True},
650
+ }
651
+
652
+ def __init__(
653
+ self,
654
+ *args: Any,
655
+ path: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
656
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
657
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
658
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
659
+ dynamic: Union[
660
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
661
+ ] = DEFAULT,
662
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
663
+ synthetic_source_keep: Union[
664
+ Literal["none", "arrays", "all"], "DefaultType"
665
+ ] = DEFAULT,
666
+ **kwargs: Any,
667
+ ):
668
+ if path is not DEFAULT:
669
+ kwargs["path"] = str(path)
670
+ if meta is not DEFAULT:
671
+ kwargs["meta"] = meta
672
+ if properties is not DEFAULT:
673
+ kwargs["properties"] = properties
674
+ if ignore_above is not DEFAULT:
675
+ kwargs["ignore_above"] = ignore_above
676
+ if dynamic is not DEFAULT:
677
+ kwargs["dynamic"] = dynamic
678
+ if fields is not DEFAULT:
679
+ kwargs["fields"] = fields
680
+ if synthetic_source_keep is not DEFAULT:
681
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
682
+ super().__init__(*args, **kwargs)
683
+
684
+
685
+ class Binary(Field):
686
+ """
687
+ :arg doc_values:
688
+ :arg copy_to:
689
+ :arg store:
690
+ :arg meta: Metadata about the field.
691
+ :arg properties:
692
+ :arg ignore_above:
693
+ :arg dynamic:
694
+ :arg fields:
695
+ :arg synthetic_source_keep:
696
+ """
697
+
698
+ name = "binary"
699
+ _coerce = True
700
+ _param_defs = {
701
+ "properties": {"type": "field", "hash": True},
702
+ "fields": {"type": "field", "hash": True},
703
+ }
704
+
705
+ def __init__(
706
+ self,
707
+ *args: Any,
708
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
709
+ copy_to: Union[
710
+ Union[str, "InstrumentedField"],
711
+ Sequence[Union[str, "InstrumentedField"]],
712
+ "DefaultType",
713
+ ] = DEFAULT,
714
+ store: Union[bool, "DefaultType"] = DEFAULT,
715
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
716
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
717
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
718
+ dynamic: Union[
719
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
720
+ ] = DEFAULT,
721
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
722
+ synthetic_source_keep: Union[
723
+ Literal["none", "arrays", "all"], "DefaultType"
724
+ ] = DEFAULT,
725
+ **kwargs: Any,
726
+ ):
727
+ if doc_values is not DEFAULT:
728
+ kwargs["doc_values"] = doc_values
729
+ if copy_to is not DEFAULT:
730
+ kwargs["copy_to"] = str(copy_to)
731
+ if store is not DEFAULT:
732
+ kwargs["store"] = store
733
+ if meta is not DEFAULT:
734
+ kwargs["meta"] = meta
735
+ if properties is not DEFAULT:
736
+ kwargs["properties"] = properties
737
+ if ignore_above is not DEFAULT:
738
+ kwargs["ignore_above"] = ignore_above
739
+ if dynamic is not DEFAULT:
740
+ kwargs["dynamic"] = dynamic
741
+ if fields is not DEFAULT:
742
+ kwargs["fields"] = fields
743
+ if synthetic_source_keep is not DEFAULT:
744
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
745
+ super().__init__(*args, **kwargs)
746
+
747
+ def clean(self, data: str) -> str:
748
+ # Binary fields are opaque, so there's not much cleaning
749
+ # that can be done.
750
+ return data
751
+
752
+ def _deserialize(self, data: Any) -> bytes:
753
+ return base64.b64decode(data)
754
+
755
+ def _serialize(self, data: Any) -> Optional[str]:
756
+ if data is None:
757
+ return None
758
+ return base64.b64encode(data).decode()
759
+
760
+
761
+ class Boolean(Field):
762
+ """
763
+ :arg boost:
764
+ :arg fielddata:
765
+ :arg index:
766
+ :arg null_value:
767
+ :arg ignore_malformed:
768
+ :arg script:
769
+ :arg on_script_error:
770
+ :arg time_series_dimension: For internal use by Elastic only. Marks
771
+ the field as a time series dimension. Defaults to false.
772
+ :arg doc_values:
773
+ :arg copy_to:
774
+ :arg store:
775
+ :arg meta: Metadata about the field.
776
+ :arg properties:
777
+ :arg ignore_above:
778
+ :arg dynamic:
779
+ :arg fields:
780
+ :arg synthetic_source_keep:
781
+ """
782
+
783
+ name = "boolean"
784
+ _coerce = True
785
+ _param_defs = {
786
+ "properties": {"type": "field", "hash": True},
787
+ "fields": {"type": "field", "hash": True},
788
+ }
789
+
790
+ def __init__(
791
+ self,
792
+ *args: Any,
793
+ boost: Union[float, "DefaultType"] = DEFAULT,
794
+ fielddata: Union[
795
+ "types.NumericFielddata", Dict[str, Any], "DefaultType"
796
+ ] = DEFAULT,
797
+ index: Union[bool, "DefaultType"] = DEFAULT,
798
+ null_value: Union[bool, "DefaultType"] = DEFAULT,
799
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
800
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
801
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
802
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
803
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
804
+ copy_to: Union[
805
+ Union[str, "InstrumentedField"],
806
+ Sequence[Union[str, "InstrumentedField"]],
807
+ "DefaultType",
808
+ ] = DEFAULT,
809
+ store: Union[bool, "DefaultType"] = DEFAULT,
810
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
811
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
812
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
813
+ dynamic: Union[
814
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
815
+ ] = DEFAULT,
816
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
817
+ synthetic_source_keep: Union[
818
+ Literal["none", "arrays", "all"], "DefaultType"
819
+ ] = DEFAULT,
820
+ **kwargs: Any,
821
+ ):
822
+ if boost is not DEFAULT:
823
+ kwargs["boost"] = boost
824
+ if fielddata is not DEFAULT:
825
+ kwargs["fielddata"] = fielddata
826
+ if index is not DEFAULT:
827
+ kwargs["index"] = index
828
+ if null_value is not DEFAULT:
829
+ kwargs["null_value"] = null_value
830
+ if ignore_malformed is not DEFAULT:
831
+ kwargs["ignore_malformed"] = ignore_malformed
832
+ if script is not DEFAULT:
833
+ kwargs["script"] = script
834
+ if on_script_error is not DEFAULT:
835
+ kwargs["on_script_error"] = on_script_error
836
+ if time_series_dimension is not DEFAULT:
837
+ kwargs["time_series_dimension"] = time_series_dimension
838
+ if doc_values is not DEFAULT:
839
+ kwargs["doc_values"] = doc_values
840
+ if copy_to is not DEFAULT:
841
+ kwargs["copy_to"] = str(copy_to)
842
+ if store is not DEFAULT:
843
+ kwargs["store"] = store
844
+ if meta is not DEFAULT:
845
+ kwargs["meta"] = meta
846
+ if properties is not DEFAULT:
847
+ kwargs["properties"] = properties
848
+ if ignore_above is not DEFAULT:
849
+ kwargs["ignore_above"] = ignore_above
850
+ if dynamic is not DEFAULT:
851
+ kwargs["dynamic"] = dynamic
852
+ if fields is not DEFAULT:
853
+ kwargs["fields"] = fields
854
+ if synthetic_source_keep is not DEFAULT:
855
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
856
+ super().__init__(*args, **kwargs)
857
+
858
+ def _deserialize(self, data: Any) -> bool:
859
+ if data == "false":
860
+ return False
861
+ return bool(data)
862
+
863
+ def clean(self, data: Any) -> Optional[bool]:
864
+ if data is not None:
865
+ data = self.deserialize(data)
866
+ if data is None and self._required:
867
+ raise ValidationException("Value required for this field.")
868
+ return data # type: ignore[no-any-return]
869
+
870
+
871
+ class Byte(Integer):
872
+ """
873
+ :arg null_value:
874
+ :arg boost:
875
+ :arg coerce:
876
+ :arg ignore_malformed:
877
+ :arg index:
878
+ :arg on_script_error:
879
+ :arg script:
880
+ :arg time_series_metric: For internal use by Elastic only. Marks the
881
+ field as a time series dimension. Defaults to false.
882
+ :arg time_series_dimension: For internal use by Elastic only. Marks
883
+ the field as a time series dimension. Defaults to false.
884
+ :arg doc_values:
885
+ :arg copy_to:
886
+ :arg store:
887
+ :arg meta: Metadata about the field.
888
+ :arg properties:
889
+ :arg ignore_above:
890
+ :arg dynamic:
891
+ :arg fields:
892
+ :arg synthetic_source_keep:
893
+ """
894
+
895
+ name = "byte"
896
+ _param_defs = {
897
+ "properties": {"type": "field", "hash": True},
898
+ "fields": {"type": "field", "hash": True},
899
+ }
900
+
901
+ def __init__(
902
+ self,
903
+ *args: Any,
904
+ null_value: Union[float, "DefaultType"] = DEFAULT,
905
+ boost: Union[float, "DefaultType"] = DEFAULT,
906
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
907
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
908
+ index: Union[bool, "DefaultType"] = DEFAULT,
909
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
910
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
911
+ time_series_metric: Union[
912
+ Literal["gauge", "counter", "summary", "histogram", "position"],
913
+ "DefaultType",
914
+ ] = DEFAULT,
915
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
916
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
917
+ copy_to: Union[
918
+ Union[str, "InstrumentedField"],
919
+ Sequence[Union[str, "InstrumentedField"]],
920
+ "DefaultType",
921
+ ] = DEFAULT,
922
+ store: Union[bool, "DefaultType"] = DEFAULT,
923
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
924
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
925
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
926
+ dynamic: Union[
927
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
928
+ ] = DEFAULT,
929
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
930
+ synthetic_source_keep: Union[
931
+ Literal["none", "arrays", "all"], "DefaultType"
932
+ ] = DEFAULT,
933
+ **kwargs: Any,
934
+ ):
935
+ if null_value is not DEFAULT:
936
+ kwargs["null_value"] = null_value
937
+ if boost is not DEFAULT:
938
+ kwargs["boost"] = boost
939
+ if coerce is not DEFAULT:
940
+ kwargs["coerce"] = coerce
941
+ if ignore_malformed is not DEFAULT:
942
+ kwargs["ignore_malformed"] = ignore_malformed
943
+ if index is not DEFAULT:
944
+ kwargs["index"] = index
945
+ if on_script_error is not DEFAULT:
946
+ kwargs["on_script_error"] = on_script_error
947
+ if script is not DEFAULT:
948
+ kwargs["script"] = script
949
+ if time_series_metric is not DEFAULT:
950
+ kwargs["time_series_metric"] = time_series_metric
951
+ if time_series_dimension is not DEFAULT:
952
+ kwargs["time_series_dimension"] = time_series_dimension
953
+ if doc_values is not DEFAULT:
954
+ kwargs["doc_values"] = doc_values
955
+ if copy_to is not DEFAULT:
956
+ kwargs["copy_to"] = str(copy_to)
957
+ if store is not DEFAULT:
958
+ kwargs["store"] = store
959
+ if meta is not DEFAULT:
960
+ kwargs["meta"] = meta
961
+ if properties is not DEFAULT:
962
+ kwargs["properties"] = properties
963
+ if ignore_above is not DEFAULT:
964
+ kwargs["ignore_above"] = ignore_above
965
+ if dynamic is not DEFAULT:
966
+ kwargs["dynamic"] = dynamic
967
+ if fields is not DEFAULT:
968
+ kwargs["fields"] = fields
969
+ if synthetic_source_keep is not DEFAULT:
970
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
971
+ super().__init__(*args, **kwargs)
972
+
973
+
974
+ class Completion(Field):
975
+ """
976
+ :arg analyzer:
977
+ :arg contexts:
978
+ :arg max_input_length:
979
+ :arg preserve_position_increments:
980
+ :arg preserve_separators:
981
+ :arg search_analyzer:
982
+ :arg doc_values:
983
+ :arg copy_to:
984
+ :arg store:
985
+ :arg meta: Metadata about the field.
986
+ :arg properties:
987
+ :arg ignore_above:
988
+ :arg dynamic:
989
+ :arg fields:
990
+ :arg synthetic_source_keep:
991
+ """
992
+
993
+ name = "completion"
994
+ _param_defs = {
995
+ "analyzer": {"type": "analyzer"},
996
+ "search_analyzer": {"type": "analyzer"},
997
+ "properties": {"type": "field", "hash": True},
998
+ "fields": {"type": "field", "hash": True},
999
+ }
1000
+
1001
+ def __init__(
1002
+ self,
1003
+ *args: Any,
1004
+ analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
1005
+ contexts: Union[
1006
+ Sequence["types.SuggestContext"], Sequence[Dict[str, Any]], "DefaultType"
1007
+ ] = DEFAULT,
1008
+ max_input_length: Union[int, "DefaultType"] = DEFAULT,
1009
+ preserve_position_increments: Union[bool, "DefaultType"] = DEFAULT,
1010
+ preserve_separators: Union[bool, "DefaultType"] = DEFAULT,
1011
+ search_analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
1012
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1013
+ copy_to: Union[
1014
+ Union[str, "InstrumentedField"],
1015
+ Sequence[Union[str, "InstrumentedField"]],
1016
+ "DefaultType",
1017
+ ] = DEFAULT,
1018
+ store: Union[bool, "DefaultType"] = DEFAULT,
1019
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1020
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1021
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1022
+ dynamic: Union[
1023
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1024
+ ] = DEFAULT,
1025
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1026
+ synthetic_source_keep: Union[
1027
+ Literal["none", "arrays", "all"], "DefaultType"
1028
+ ] = DEFAULT,
1029
+ **kwargs: Any,
1030
+ ):
1031
+ if analyzer is not DEFAULT:
1032
+ kwargs["analyzer"] = analyzer
1033
+ if contexts is not DEFAULT:
1034
+ kwargs["contexts"] = contexts
1035
+ if max_input_length is not DEFAULT:
1036
+ kwargs["max_input_length"] = max_input_length
1037
+ if preserve_position_increments is not DEFAULT:
1038
+ kwargs["preserve_position_increments"] = preserve_position_increments
1039
+ if preserve_separators is not DEFAULT:
1040
+ kwargs["preserve_separators"] = preserve_separators
1041
+ if search_analyzer is not DEFAULT:
1042
+ kwargs["search_analyzer"] = search_analyzer
1043
+ if doc_values is not DEFAULT:
1044
+ kwargs["doc_values"] = doc_values
1045
+ if copy_to is not DEFAULT:
1046
+ kwargs["copy_to"] = str(copy_to)
1047
+ if store is not DEFAULT:
1048
+ kwargs["store"] = store
1049
+ if meta is not DEFAULT:
1050
+ kwargs["meta"] = meta
1051
+ if properties is not DEFAULT:
1052
+ kwargs["properties"] = properties
1053
+ if ignore_above is not DEFAULT:
1054
+ kwargs["ignore_above"] = ignore_above
1055
+ if dynamic is not DEFAULT:
1056
+ kwargs["dynamic"] = dynamic
1057
+ if fields is not DEFAULT:
1058
+ kwargs["fields"] = fields
1059
+ if synthetic_source_keep is not DEFAULT:
1060
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1061
+ super().__init__(*args, **kwargs)
1062
+
1063
+
1064
+ class ConstantKeyword(Field):
1065
+ """
1066
+ :arg value:
1067
+ :arg meta: Metadata about the field.
1068
+ :arg properties:
1069
+ :arg ignore_above:
1070
+ :arg dynamic:
1071
+ :arg fields:
1072
+ :arg synthetic_source_keep:
1073
+ """
1074
+
1075
+ name = "constant_keyword"
1076
+ _param_defs = {
1077
+ "properties": {"type": "field", "hash": True},
1078
+ "fields": {"type": "field", "hash": True},
1079
+ }
1080
+
1081
+ def __init__(
1082
+ self,
1083
+ *args: Any,
1084
+ value: Any = DEFAULT,
1085
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1086
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1087
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1088
+ dynamic: Union[
1089
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1090
+ ] = DEFAULT,
1091
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1092
+ synthetic_source_keep: Union[
1093
+ Literal["none", "arrays", "all"], "DefaultType"
1094
+ ] = DEFAULT,
1095
+ **kwargs: Any,
1096
+ ):
1097
+ if value is not DEFAULT:
1098
+ kwargs["value"] = value
1099
+ if meta is not DEFAULT:
1100
+ kwargs["meta"] = meta
1101
+ if properties is not DEFAULT:
1102
+ kwargs["properties"] = properties
1103
+ if ignore_above is not DEFAULT:
1104
+ kwargs["ignore_above"] = ignore_above
1105
+ if dynamic is not DEFAULT:
1106
+ kwargs["dynamic"] = dynamic
1107
+ if fields is not DEFAULT:
1108
+ kwargs["fields"] = fields
1109
+ if synthetic_source_keep is not DEFAULT:
1110
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1111
+ super().__init__(*args, **kwargs)
1112
+
1113
+
1114
+ class CountedKeyword(Field):
1115
+ """
1116
+ :arg index:
1117
+ :arg meta: Metadata about the field.
1118
+ :arg properties:
1119
+ :arg ignore_above:
1120
+ :arg dynamic:
1121
+ :arg fields:
1122
+ :arg synthetic_source_keep:
1123
+ """
1124
+
1125
+ name = "counted_keyword"
1126
+ _param_defs = {
1127
+ "properties": {"type": "field", "hash": True},
1128
+ "fields": {"type": "field", "hash": True},
1129
+ }
1130
+
1131
+ def __init__(
1132
+ self,
1133
+ *args: Any,
1134
+ index: Union[bool, "DefaultType"] = DEFAULT,
1135
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1136
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1137
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1138
+ dynamic: Union[
1139
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1140
+ ] = DEFAULT,
1141
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1142
+ synthetic_source_keep: Union[
1143
+ Literal["none", "arrays", "all"], "DefaultType"
1144
+ ] = DEFAULT,
1145
+ **kwargs: Any,
1146
+ ):
1147
+ if index is not DEFAULT:
1148
+ kwargs["index"] = index
1149
+ if meta is not DEFAULT:
1150
+ kwargs["meta"] = meta
1151
+ if properties is not DEFAULT:
1152
+ kwargs["properties"] = properties
1153
+ if ignore_above is not DEFAULT:
1154
+ kwargs["ignore_above"] = ignore_above
1155
+ if dynamic is not DEFAULT:
1156
+ kwargs["dynamic"] = dynamic
1157
+ if fields is not DEFAULT:
1158
+ kwargs["fields"] = fields
1159
+ if synthetic_source_keep is not DEFAULT:
1160
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1161
+ super().__init__(*args, **kwargs)
1162
+
1163
+
1164
+ class Date(Field):
1165
+ """
1166
+ :arg default_timezone: timezone that will be automatically used for tz-naive values
1167
+ May be instance of `datetime.tzinfo` or string containing TZ offset
1168
+ :arg boost:
1169
+ :arg fielddata:
1170
+ :arg format:
1171
+ :arg ignore_malformed:
1172
+ :arg index:
1173
+ :arg script:
1174
+ :arg on_script_error:
1175
+ :arg null_value:
1176
+ :arg precision_step:
1177
+ :arg locale:
1178
+ :arg doc_values:
1179
+ :arg copy_to:
1180
+ :arg store:
1181
+ :arg meta: Metadata about the field.
1182
+ :arg properties:
1183
+ :arg ignore_above:
1184
+ :arg dynamic:
1185
+ :arg fields:
1186
+ :arg synthetic_source_keep:
1187
+ """
1188
+
1189
+ name = "date"
1190
+ _coerce = True
1191
+ _param_defs = {
1192
+ "properties": {"type": "field", "hash": True},
1193
+ "fields": {"type": "field", "hash": True},
1194
+ }
1195
+
1196
+ def __init__(
1197
+ self,
1198
+ default_timezone: Union[str, "tzinfo", "DefaultType"] = DEFAULT,
1199
+ *args: Any,
1200
+ boost: Union[float, "DefaultType"] = DEFAULT,
1201
+ fielddata: Union[
1202
+ "types.NumericFielddata", Dict[str, Any], "DefaultType"
1203
+ ] = DEFAULT,
1204
+ format: Union[str, "DefaultType"] = DEFAULT,
1205
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1206
+ index: Union[bool, "DefaultType"] = DEFAULT,
1207
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
1208
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
1209
+ null_value: Any = DEFAULT,
1210
+ precision_step: Union[int, "DefaultType"] = DEFAULT,
1211
+ locale: Union[str, "DefaultType"] = DEFAULT,
1212
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1213
+ copy_to: Union[
1214
+ Union[str, "InstrumentedField"],
1215
+ Sequence[Union[str, "InstrumentedField"]],
1216
+ "DefaultType",
1217
+ ] = DEFAULT,
1218
+ store: Union[bool, "DefaultType"] = DEFAULT,
1219
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1220
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1221
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1222
+ dynamic: Union[
1223
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1224
+ ] = DEFAULT,
1225
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1226
+ synthetic_source_keep: Union[
1227
+ Literal["none", "arrays", "all"], "DefaultType"
1228
+ ] = DEFAULT,
1229
+ **kwargs: Any,
1230
+ ):
1231
+ if boost is not DEFAULT:
1232
+ kwargs["boost"] = boost
1233
+ if fielddata is not DEFAULT:
1234
+ kwargs["fielddata"] = fielddata
1235
+ if format is not DEFAULT:
1236
+ kwargs["format"] = format
1237
+ if ignore_malformed is not DEFAULT:
1238
+ kwargs["ignore_malformed"] = ignore_malformed
1239
+ if index is not DEFAULT:
1240
+ kwargs["index"] = index
1241
+ if script is not DEFAULT:
1242
+ kwargs["script"] = script
1243
+ if on_script_error is not DEFAULT:
1244
+ kwargs["on_script_error"] = on_script_error
1245
+ if null_value is not DEFAULT:
1246
+ kwargs["null_value"] = null_value
1247
+ if precision_step is not DEFAULT:
1248
+ kwargs["precision_step"] = precision_step
1249
+ if locale is not DEFAULT:
1250
+ kwargs["locale"] = locale
1251
+ if doc_values is not DEFAULT:
1252
+ kwargs["doc_values"] = doc_values
1253
+ if copy_to is not DEFAULT:
1254
+ kwargs["copy_to"] = str(copy_to)
1255
+ if store is not DEFAULT:
1256
+ kwargs["store"] = store
1257
+ if meta is not DEFAULT:
1258
+ kwargs["meta"] = meta
1259
+ if properties is not DEFAULT:
1260
+ kwargs["properties"] = properties
1261
+ if ignore_above is not DEFAULT:
1262
+ kwargs["ignore_above"] = ignore_above
1263
+ if dynamic is not DEFAULT:
1264
+ kwargs["dynamic"] = dynamic
1265
+ if fields is not DEFAULT:
1266
+ kwargs["fields"] = fields
1267
+ if synthetic_source_keep is not DEFAULT:
1268
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1269
+
1270
+ if default_timezone is DEFAULT:
1271
+ self._default_timezone = None
1272
+ elif isinstance(default_timezone, str):
1273
+ self._default_timezone = tz.gettz(default_timezone)
1274
+ else:
1275
+ self._default_timezone = default_timezone
1276
+ super().__init__(*args, **kwargs)
1277
+
1278
+ def _deserialize(self, data: Any) -> Union[datetime, date]:
1279
+ if isinstance(data, str):
1280
+ try:
1281
+ data = parser.parse(data)
1282
+ except Exception as e:
1283
+ raise ValidationException(
1284
+ f"Could not parse date from the value ({data!r})", e
1285
+ )
1286
+ # we treat the yyyy-MM-dd format as a special case
1287
+ if hasattr(self, "format") and self.format == "yyyy-MM-dd":
1288
+ data = data.date()
1289
+
1290
+ if isinstance(data, datetime):
1291
+ if self._default_timezone and data.tzinfo is None:
1292
+ data = data.replace(tzinfo=self._default_timezone)
1293
+ return data
1294
+ if isinstance(data, date):
1295
+ return data
1296
+ if isinstance(data, int):
1297
+ # Divide by a float to preserve milliseconds on the datetime.
1298
+ return datetime.utcfromtimestamp(data / 1000.0)
1299
+
1300
+ raise ValidationException(f"Could not parse date from the value ({data!r})")
1301
+
1302
+
1303
+ class DateNanos(Field):
1304
+ """
1305
+ :arg boost:
1306
+ :arg format:
1307
+ :arg ignore_malformed:
1308
+ :arg index:
1309
+ :arg script:
1310
+ :arg on_script_error:
1311
+ :arg null_value:
1312
+ :arg precision_step:
1313
+ :arg doc_values:
1314
+ :arg copy_to:
1315
+ :arg store:
1316
+ :arg meta: Metadata about the field.
1317
+ :arg properties:
1318
+ :arg ignore_above:
1319
+ :arg dynamic:
1320
+ :arg fields:
1321
+ :arg synthetic_source_keep:
1322
+ """
1323
+
1324
+ name = "date_nanos"
1325
+ _param_defs = {
1326
+ "properties": {"type": "field", "hash": True},
1327
+ "fields": {"type": "field", "hash": True},
1328
+ }
1329
+
1330
+ def __init__(
1331
+ self,
1332
+ *args: Any,
1333
+ boost: Union[float, "DefaultType"] = DEFAULT,
1334
+ format: Union[str, "DefaultType"] = DEFAULT,
1335
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1336
+ index: Union[bool, "DefaultType"] = DEFAULT,
1337
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
1338
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
1339
+ null_value: Any = DEFAULT,
1340
+ precision_step: Union[int, "DefaultType"] = DEFAULT,
1341
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1342
+ copy_to: Union[
1343
+ Union[str, "InstrumentedField"],
1344
+ Sequence[Union[str, "InstrumentedField"]],
1345
+ "DefaultType",
1346
+ ] = DEFAULT,
1347
+ store: Union[bool, "DefaultType"] = DEFAULT,
1348
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1349
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1350
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1351
+ dynamic: Union[
1352
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1353
+ ] = DEFAULT,
1354
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1355
+ synthetic_source_keep: Union[
1356
+ Literal["none", "arrays", "all"], "DefaultType"
1357
+ ] = DEFAULT,
1358
+ **kwargs: Any,
1359
+ ):
1360
+ if boost is not DEFAULT:
1361
+ kwargs["boost"] = boost
1362
+ if format is not DEFAULT:
1363
+ kwargs["format"] = format
1364
+ if ignore_malformed is not DEFAULT:
1365
+ kwargs["ignore_malformed"] = ignore_malformed
1366
+ if index is not DEFAULT:
1367
+ kwargs["index"] = index
1368
+ if script is not DEFAULT:
1369
+ kwargs["script"] = script
1370
+ if on_script_error is not DEFAULT:
1371
+ kwargs["on_script_error"] = on_script_error
1372
+ if null_value is not DEFAULT:
1373
+ kwargs["null_value"] = null_value
1374
+ if precision_step is not DEFAULT:
1375
+ kwargs["precision_step"] = precision_step
1376
+ if doc_values is not DEFAULT:
1377
+ kwargs["doc_values"] = doc_values
1378
+ if copy_to is not DEFAULT:
1379
+ kwargs["copy_to"] = str(copy_to)
1380
+ if store is not DEFAULT:
1381
+ kwargs["store"] = store
1382
+ if meta is not DEFAULT:
1383
+ kwargs["meta"] = meta
1384
+ if properties is not DEFAULT:
1385
+ kwargs["properties"] = properties
1386
+ if ignore_above is not DEFAULT:
1387
+ kwargs["ignore_above"] = ignore_above
1388
+ if dynamic is not DEFAULT:
1389
+ kwargs["dynamic"] = dynamic
1390
+ if fields is not DEFAULT:
1391
+ kwargs["fields"] = fields
1392
+ if synthetic_source_keep is not DEFAULT:
1393
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1394
+ super().__init__(*args, **kwargs)
1395
+
1396
+
1397
+ class DateRange(RangeField):
1398
+ """
1399
+ :arg format:
1400
+ :arg boost:
1401
+ :arg coerce:
1402
+ :arg index:
1403
+ :arg doc_values:
1404
+ :arg copy_to:
1405
+ :arg store:
1406
+ :arg meta: Metadata about the field.
1407
+ :arg properties:
1408
+ :arg ignore_above:
1409
+ :arg dynamic:
1410
+ :arg fields:
1411
+ :arg synthetic_source_keep:
1412
+ """
1413
+
1414
+ name = "date_range"
1415
+ _core_field = Date()
1416
+ _param_defs = {
1417
+ "properties": {"type": "field", "hash": True},
1418
+ "fields": {"type": "field", "hash": True},
1419
+ }
1420
+
1421
+ def __init__(
1422
+ self,
1423
+ *args: Any,
1424
+ format: Union[str, "DefaultType"] = DEFAULT,
1425
+ boost: Union[float, "DefaultType"] = DEFAULT,
1426
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
1427
+ index: Union[bool, "DefaultType"] = DEFAULT,
1428
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1429
+ copy_to: Union[
1430
+ Union[str, "InstrumentedField"],
1431
+ Sequence[Union[str, "InstrumentedField"]],
1432
+ "DefaultType",
1433
+ ] = DEFAULT,
1434
+ store: Union[bool, "DefaultType"] = DEFAULT,
1435
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1436
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1437
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1438
+ dynamic: Union[
1439
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1440
+ ] = DEFAULT,
1441
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1442
+ synthetic_source_keep: Union[
1443
+ Literal["none", "arrays", "all"], "DefaultType"
1444
+ ] = DEFAULT,
1445
+ **kwargs: Any,
1446
+ ):
1447
+ if format is not DEFAULT:
1448
+ kwargs["format"] = format
1449
+ if boost is not DEFAULT:
1450
+ kwargs["boost"] = boost
1451
+ if coerce is not DEFAULT:
1452
+ kwargs["coerce"] = coerce
1453
+ if index is not DEFAULT:
1454
+ kwargs["index"] = index
1455
+ if doc_values is not DEFAULT:
1456
+ kwargs["doc_values"] = doc_values
1457
+ if copy_to is not DEFAULT:
1458
+ kwargs["copy_to"] = str(copy_to)
1459
+ if store is not DEFAULT:
1460
+ kwargs["store"] = store
1461
+ if meta is not DEFAULT:
1462
+ kwargs["meta"] = meta
1463
+ if properties is not DEFAULT:
1464
+ kwargs["properties"] = properties
1465
+ if ignore_above is not DEFAULT:
1466
+ kwargs["ignore_above"] = ignore_above
1467
+ if dynamic is not DEFAULT:
1468
+ kwargs["dynamic"] = dynamic
1469
+ if fields is not DEFAULT:
1470
+ kwargs["fields"] = fields
1471
+ if synthetic_source_keep is not DEFAULT:
1472
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1473
+ super().__init__(*args, **kwargs)
1474
+
1475
+
1476
+ class DenseVector(Field):
1477
+ """
1478
+ :arg dims: Number of vector dimensions. Can't exceed `4096`. If `dims`
1479
+ is not specified, it will be set to the length of the first vector
1480
+ added to the field.
1481
+ :arg element_type: The data type used to encode vectors. The supported
1482
+ data types are `float` (default), `byte`, and `bit`. Defaults to
1483
+ `float` if omitted.
1484
+ :arg index: If `true`, you can search this field using the kNN search
1485
+ API. Defaults to `True` if omitted.
1486
+ :arg index_options: An optional section that configures the kNN
1487
+ indexing algorithm. The HNSW algorithm has two internal parameters
1488
+ that influence how the data structure is built. These can be
1489
+ adjusted to improve the accuracy of results, at the expense of
1490
+ slower indexing speed. This parameter can only be specified when
1491
+ `index` is `true`.
1492
+ :arg similarity: The vector similarity metric to use in kNN search.
1493
+ Documents are ranked by their vector field's similarity to the
1494
+ query vector. The `_score` of each document will be derived from
1495
+ the similarity, in a way that ensures scores are positive and that
1496
+ a larger score corresponds to a higher ranking. Defaults to
1497
+ `l2_norm` when `element_type` is `bit` otherwise defaults to
1498
+ `cosine`. `bit` vectors only support `l2_norm` as their
1499
+ similarity metric. This parameter can only be specified when
1500
+ `index` is `true`.
1501
+ :arg meta: Metadata about the field.
1502
+ :arg properties:
1503
+ :arg ignore_above:
1504
+ :arg dynamic:
1505
+ :arg fields:
1506
+ :arg synthetic_source_keep:
1507
+ """
1508
+
1509
+ name = "dense_vector"
1510
+ _coerce = True
1511
+ _param_defs = {
1512
+ "properties": {"type": "field", "hash": True},
1513
+ "fields": {"type": "field", "hash": True},
1514
+ }
1515
+
1516
+ def __init__(
1517
+ self,
1518
+ *args: Any,
1519
+ dims: Union[int, "DefaultType"] = DEFAULT,
1520
+ element_type: Union[Literal["bit", "byte", "float"], "DefaultType"] = DEFAULT,
1521
+ index: Union[bool, "DefaultType"] = DEFAULT,
1522
+ index_options: Union[
1523
+ "types.DenseVectorIndexOptions", Dict[str, Any], "DefaultType"
1524
+ ] = DEFAULT,
1525
+ similarity: Union[
1526
+ Literal["cosine", "dot_product", "l2_norm", "max_inner_product"],
1527
+ "DefaultType",
1528
+ ] = DEFAULT,
1529
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1530
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1531
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1532
+ dynamic: Union[
1533
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1534
+ ] = DEFAULT,
1535
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1536
+ synthetic_source_keep: Union[
1537
+ Literal["none", "arrays", "all"], "DefaultType"
1538
+ ] = DEFAULT,
1539
+ **kwargs: Any,
1540
+ ):
1541
+ if dims is not DEFAULT:
1542
+ kwargs["dims"] = dims
1543
+ if element_type is not DEFAULT:
1544
+ kwargs["element_type"] = element_type
1545
+ if index is not DEFAULT:
1546
+ kwargs["index"] = index
1547
+ if index_options is not DEFAULT:
1548
+ kwargs["index_options"] = index_options
1549
+ if similarity is not DEFAULT:
1550
+ kwargs["similarity"] = similarity
1551
+ if meta is not DEFAULT:
1552
+ kwargs["meta"] = meta
1553
+ if properties is not DEFAULT:
1554
+ kwargs["properties"] = properties
1555
+ if ignore_above is not DEFAULT:
1556
+ kwargs["ignore_above"] = ignore_above
1557
+ if dynamic is not DEFAULT:
1558
+ kwargs["dynamic"] = dynamic
1559
+ if fields is not DEFAULT:
1560
+ kwargs["fields"] = fields
1561
+ if synthetic_source_keep is not DEFAULT:
1562
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1563
+ self._element_type = kwargs.get("element_type", "float")
1564
+ if self._element_type in ["float", "byte"]:
1565
+ kwargs["multi"] = True
1566
+ super().__init__(*args, **kwargs)
1567
+
1568
+ def _deserialize(self, data: Any) -> Any:
1569
+ if self._element_type == "float":
1570
+ return float(data)
1571
+ elif self._element_type == "byte":
1572
+ return int(data)
1573
+ return data
1574
+
1575
+
1576
+ class Double(Float):
1577
+ """
1578
+ :arg null_value:
1579
+ :arg boost:
1580
+ :arg coerce:
1581
+ :arg ignore_malformed:
1582
+ :arg index:
1583
+ :arg on_script_error:
1584
+ :arg script:
1585
+ :arg time_series_metric: For internal use by Elastic only. Marks the
1586
+ field as a time series dimension. Defaults to false.
1587
+ :arg time_series_dimension: For internal use by Elastic only. Marks
1588
+ the field as a time series dimension. Defaults to false.
1589
+ :arg doc_values:
1590
+ :arg copy_to:
1591
+ :arg store:
1592
+ :arg meta: Metadata about the field.
1593
+ :arg properties:
1594
+ :arg ignore_above:
1595
+ :arg dynamic:
1596
+ :arg fields:
1597
+ :arg synthetic_source_keep:
1598
+ """
1599
+
1600
+ name = "double"
1601
+ _param_defs = {
1602
+ "properties": {"type": "field", "hash": True},
1603
+ "fields": {"type": "field", "hash": True},
1604
+ }
1605
+
1606
+ def __init__(
1607
+ self,
1608
+ *args: Any,
1609
+ null_value: Union[float, "DefaultType"] = DEFAULT,
1610
+ boost: Union[float, "DefaultType"] = DEFAULT,
1611
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
1612
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1613
+ index: Union[bool, "DefaultType"] = DEFAULT,
1614
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
1615
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
1616
+ time_series_metric: Union[
1617
+ Literal["gauge", "counter", "summary", "histogram", "position"],
1618
+ "DefaultType",
1619
+ ] = DEFAULT,
1620
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
1621
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1622
+ copy_to: Union[
1623
+ Union[str, "InstrumentedField"],
1624
+ Sequence[Union[str, "InstrumentedField"]],
1625
+ "DefaultType",
1626
+ ] = DEFAULT,
1627
+ store: Union[bool, "DefaultType"] = DEFAULT,
1628
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1629
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1630
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1631
+ dynamic: Union[
1632
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1633
+ ] = DEFAULT,
1634
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1635
+ synthetic_source_keep: Union[
1636
+ Literal["none", "arrays", "all"], "DefaultType"
1637
+ ] = DEFAULT,
1638
+ **kwargs: Any,
1639
+ ):
1640
+ if null_value is not DEFAULT:
1641
+ kwargs["null_value"] = null_value
1642
+ if boost is not DEFAULT:
1643
+ kwargs["boost"] = boost
1644
+ if coerce is not DEFAULT:
1645
+ kwargs["coerce"] = coerce
1646
+ if ignore_malformed is not DEFAULT:
1647
+ kwargs["ignore_malformed"] = ignore_malformed
1648
+ if index is not DEFAULT:
1649
+ kwargs["index"] = index
1650
+ if on_script_error is not DEFAULT:
1651
+ kwargs["on_script_error"] = on_script_error
1652
+ if script is not DEFAULT:
1653
+ kwargs["script"] = script
1654
+ if time_series_metric is not DEFAULT:
1655
+ kwargs["time_series_metric"] = time_series_metric
1656
+ if time_series_dimension is not DEFAULT:
1657
+ kwargs["time_series_dimension"] = time_series_dimension
1658
+ if doc_values is not DEFAULT:
1659
+ kwargs["doc_values"] = doc_values
1660
+ if copy_to is not DEFAULT:
1661
+ kwargs["copy_to"] = str(copy_to)
1662
+ if store is not DEFAULT:
1663
+ kwargs["store"] = store
1664
+ if meta is not DEFAULT:
1665
+ kwargs["meta"] = meta
1666
+ if properties is not DEFAULT:
1667
+ kwargs["properties"] = properties
1668
+ if ignore_above is not DEFAULT:
1669
+ kwargs["ignore_above"] = ignore_above
1670
+ if dynamic is not DEFAULT:
1671
+ kwargs["dynamic"] = dynamic
1672
+ if fields is not DEFAULT:
1673
+ kwargs["fields"] = fields
1674
+ if synthetic_source_keep is not DEFAULT:
1675
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1676
+ super().__init__(*args, **kwargs)
1677
+
1678
+
1679
+ class DoubleRange(RangeField):
1680
+ """
1681
+ :arg boost:
1682
+ :arg coerce:
1683
+ :arg index:
1684
+ :arg doc_values:
1685
+ :arg copy_to:
1686
+ :arg store:
1687
+ :arg meta: Metadata about the field.
1688
+ :arg properties:
1689
+ :arg ignore_above:
1690
+ :arg dynamic:
1691
+ :arg fields:
1692
+ :arg synthetic_source_keep:
1693
+ """
1694
+
1695
+ name = "double_range"
1696
+ _core_field = Double()
1697
+ _param_defs = {
1698
+ "properties": {"type": "field", "hash": True},
1699
+ "fields": {"type": "field", "hash": True},
1700
+ }
1701
+
1702
+ def __init__(
1703
+ self,
1704
+ *args: Any,
1705
+ boost: Union[float, "DefaultType"] = DEFAULT,
1706
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
1707
+ index: Union[bool, "DefaultType"] = DEFAULT,
1708
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1709
+ copy_to: Union[
1710
+ Union[str, "InstrumentedField"],
1711
+ Sequence[Union[str, "InstrumentedField"]],
1712
+ "DefaultType",
1713
+ ] = DEFAULT,
1714
+ store: Union[bool, "DefaultType"] = DEFAULT,
1715
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1716
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1717
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1718
+ dynamic: Union[
1719
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1720
+ ] = DEFAULT,
1721
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1722
+ synthetic_source_keep: Union[
1723
+ Literal["none", "arrays", "all"], "DefaultType"
1724
+ ] = DEFAULT,
1725
+ **kwargs: Any,
1726
+ ):
1727
+ if boost is not DEFAULT:
1728
+ kwargs["boost"] = boost
1729
+ if coerce is not DEFAULT:
1730
+ kwargs["coerce"] = coerce
1731
+ if index is not DEFAULT:
1732
+ kwargs["index"] = index
1733
+ if doc_values is not DEFAULT:
1734
+ kwargs["doc_values"] = doc_values
1735
+ if copy_to is not DEFAULT:
1736
+ kwargs["copy_to"] = str(copy_to)
1737
+ if store is not DEFAULT:
1738
+ kwargs["store"] = store
1739
+ if meta is not DEFAULT:
1740
+ kwargs["meta"] = meta
1741
+ if properties is not DEFAULT:
1742
+ kwargs["properties"] = properties
1743
+ if ignore_above is not DEFAULT:
1744
+ kwargs["ignore_above"] = ignore_above
1745
+ if dynamic is not DEFAULT:
1746
+ kwargs["dynamic"] = dynamic
1747
+ if fields is not DEFAULT:
1748
+ kwargs["fields"] = fields
1749
+ if synthetic_source_keep is not DEFAULT:
1750
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1751
+ super().__init__(*args, **kwargs)
1752
+
1753
+
1754
+ class Flattened(Field):
1755
+ """
1756
+ :arg boost:
1757
+ :arg depth_limit:
1758
+ :arg doc_values:
1759
+ :arg eager_global_ordinals:
1760
+ :arg index:
1761
+ :arg index_options:
1762
+ :arg null_value:
1763
+ :arg similarity:
1764
+ :arg split_queries_on_whitespace:
1765
+ :arg meta: Metadata about the field.
1766
+ :arg properties:
1767
+ :arg ignore_above:
1768
+ :arg dynamic:
1769
+ :arg fields:
1770
+ :arg synthetic_source_keep:
1771
+ """
1772
+
1773
+ name = "flattened"
1774
+ _param_defs = {
1775
+ "properties": {"type": "field", "hash": True},
1776
+ "fields": {"type": "field", "hash": True},
1777
+ }
1778
+
1779
+ def __init__(
1780
+ self,
1781
+ *args: Any,
1782
+ boost: Union[float, "DefaultType"] = DEFAULT,
1783
+ depth_limit: Union[int, "DefaultType"] = DEFAULT,
1784
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1785
+ eager_global_ordinals: Union[bool, "DefaultType"] = DEFAULT,
1786
+ index: Union[bool, "DefaultType"] = DEFAULT,
1787
+ index_options: Union[
1788
+ Literal["docs", "freqs", "positions", "offsets"], "DefaultType"
1789
+ ] = DEFAULT,
1790
+ null_value: Union[str, "DefaultType"] = DEFAULT,
1791
+ similarity: Union[str, "DefaultType"] = DEFAULT,
1792
+ split_queries_on_whitespace: Union[bool, "DefaultType"] = DEFAULT,
1793
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1794
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1795
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1796
+ dynamic: Union[
1797
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1798
+ ] = DEFAULT,
1799
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1800
+ synthetic_source_keep: Union[
1801
+ Literal["none", "arrays", "all"], "DefaultType"
1802
+ ] = DEFAULT,
1803
+ **kwargs: Any,
1804
+ ):
1805
+ if boost is not DEFAULT:
1806
+ kwargs["boost"] = boost
1807
+ if depth_limit is not DEFAULT:
1808
+ kwargs["depth_limit"] = depth_limit
1809
+ if doc_values is not DEFAULT:
1810
+ kwargs["doc_values"] = doc_values
1811
+ if eager_global_ordinals is not DEFAULT:
1812
+ kwargs["eager_global_ordinals"] = eager_global_ordinals
1813
+ if index is not DEFAULT:
1814
+ kwargs["index"] = index
1815
+ if index_options is not DEFAULT:
1816
+ kwargs["index_options"] = index_options
1817
+ if null_value is not DEFAULT:
1818
+ kwargs["null_value"] = null_value
1819
+ if similarity is not DEFAULT:
1820
+ kwargs["similarity"] = similarity
1821
+ if split_queries_on_whitespace is not DEFAULT:
1822
+ kwargs["split_queries_on_whitespace"] = split_queries_on_whitespace
1823
+ if meta is not DEFAULT:
1824
+ kwargs["meta"] = meta
1825
+ if properties is not DEFAULT:
1826
+ kwargs["properties"] = properties
1827
+ if ignore_above is not DEFAULT:
1828
+ kwargs["ignore_above"] = ignore_above
1829
+ if dynamic is not DEFAULT:
1830
+ kwargs["dynamic"] = dynamic
1831
+ if fields is not DEFAULT:
1832
+ kwargs["fields"] = fields
1833
+ if synthetic_source_keep is not DEFAULT:
1834
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1835
+ super().__init__(*args, **kwargs)
1836
+
1837
+
1838
+ class FloatRange(RangeField):
1839
+ """
1840
+ :arg boost:
1841
+ :arg coerce:
1842
+ :arg index:
1843
+ :arg doc_values:
1844
+ :arg copy_to:
1845
+ :arg store:
1846
+ :arg meta: Metadata about the field.
1847
+ :arg properties:
1848
+ :arg ignore_above:
1849
+ :arg dynamic:
1850
+ :arg fields:
1851
+ :arg synthetic_source_keep:
1852
+ """
1853
+
1854
+ name = "float_range"
1855
+ _core_field = Float()
1856
+ _param_defs = {
1857
+ "properties": {"type": "field", "hash": True},
1858
+ "fields": {"type": "field", "hash": True},
1859
+ }
1860
+
1861
+ def __init__(
1862
+ self,
1863
+ *args: Any,
1864
+ boost: Union[float, "DefaultType"] = DEFAULT,
1865
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
1866
+ index: Union[bool, "DefaultType"] = DEFAULT,
1867
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1868
+ copy_to: Union[
1869
+ Union[str, "InstrumentedField"],
1870
+ Sequence[Union[str, "InstrumentedField"]],
1871
+ "DefaultType",
1872
+ ] = DEFAULT,
1873
+ store: Union[bool, "DefaultType"] = DEFAULT,
1874
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1875
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1876
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1877
+ dynamic: Union[
1878
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1879
+ ] = DEFAULT,
1880
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1881
+ synthetic_source_keep: Union[
1882
+ Literal["none", "arrays", "all"], "DefaultType"
1883
+ ] = DEFAULT,
1884
+ **kwargs: Any,
1885
+ ):
1886
+ if boost is not DEFAULT:
1887
+ kwargs["boost"] = boost
1888
+ if coerce is not DEFAULT:
1889
+ kwargs["coerce"] = coerce
1890
+ if index is not DEFAULT:
1891
+ kwargs["index"] = index
1892
+ if doc_values is not DEFAULT:
1893
+ kwargs["doc_values"] = doc_values
1894
+ if copy_to is not DEFAULT:
1895
+ kwargs["copy_to"] = str(copy_to)
1896
+ if store is not DEFAULT:
1897
+ kwargs["store"] = store
1898
+ if meta is not DEFAULT:
1899
+ kwargs["meta"] = meta
1900
+ if properties is not DEFAULT:
1901
+ kwargs["properties"] = properties
1902
+ if ignore_above is not DEFAULT:
1903
+ kwargs["ignore_above"] = ignore_above
1904
+ if dynamic is not DEFAULT:
1905
+ kwargs["dynamic"] = dynamic
1906
+ if fields is not DEFAULT:
1907
+ kwargs["fields"] = fields
1908
+ if synthetic_source_keep is not DEFAULT:
1909
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
1910
+ super().__init__(*args, **kwargs)
1911
+
1912
+
1913
+ class GeoPoint(Field):
1914
+ """
1915
+ :arg ignore_malformed:
1916
+ :arg ignore_z_value:
1917
+ :arg null_value:
1918
+ :arg index:
1919
+ :arg on_script_error:
1920
+ :arg script:
1921
+ :arg doc_values:
1922
+ :arg copy_to:
1923
+ :arg store:
1924
+ :arg meta: Metadata about the field.
1925
+ :arg properties:
1926
+ :arg ignore_above:
1927
+ :arg dynamic:
1928
+ :arg fields:
1929
+ :arg synthetic_source_keep:
1930
+ """
1931
+
1932
+ name = "geo_point"
1933
+ _param_defs = {
1934
+ "properties": {"type": "field", "hash": True},
1935
+ "fields": {"type": "field", "hash": True},
1936
+ }
1937
+
1938
+ def __init__(
1939
+ self,
1940
+ *args: Any,
1941
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1942
+ ignore_z_value: Union[bool, "DefaultType"] = DEFAULT,
1943
+ null_value: Union[
1944
+ "types.LatLonGeoLocation",
1945
+ "types.GeoHashLocation",
1946
+ Sequence[float],
1947
+ str,
1948
+ Dict[str, Any],
1949
+ "DefaultType",
1950
+ ] = DEFAULT,
1951
+ index: Union[bool, "DefaultType"] = DEFAULT,
1952
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
1953
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
1954
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
1955
+ copy_to: Union[
1956
+ Union[str, "InstrumentedField"],
1957
+ Sequence[Union[str, "InstrumentedField"]],
1958
+ "DefaultType",
1959
+ ] = DEFAULT,
1960
+ store: Union[bool, "DefaultType"] = DEFAULT,
1961
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
1962
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1963
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
1964
+ dynamic: Union[
1965
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
1966
+ ] = DEFAULT,
1967
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
1968
+ synthetic_source_keep: Union[
1969
+ Literal["none", "arrays", "all"], "DefaultType"
1970
+ ] = DEFAULT,
1971
+ **kwargs: Any,
1972
+ ):
1973
+ if ignore_malformed is not DEFAULT:
1974
+ kwargs["ignore_malformed"] = ignore_malformed
1975
+ if ignore_z_value is not DEFAULT:
1976
+ kwargs["ignore_z_value"] = ignore_z_value
1977
+ if null_value is not DEFAULT:
1978
+ kwargs["null_value"] = null_value
1979
+ if index is not DEFAULT:
1980
+ kwargs["index"] = index
1981
+ if on_script_error is not DEFAULT:
1982
+ kwargs["on_script_error"] = on_script_error
1983
+ if script is not DEFAULT:
1984
+ kwargs["script"] = script
1985
+ if doc_values is not DEFAULT:
1986
+ kwargs["doc_values"] = doc_values
1987
+ if copy_to is not DEFAULT:
1988
+ kwargs["copy_to"] = str(copy_to)
1989
+ if store is not DEFAULT:
1990
+ kwargs["store"] = store
1991
+ if meta is not DEFAULT:
1992
+ kwargs["meta"] = meta
1993
+ if properties is not DEFAULT:
1994
+ kwargs["properties"] = properties
1995
+ if ignore_above is not DEFAULT:
1996
+ kwargs["ignore_above"] = ignore_above
1997
+ if dynamic is not DEFAULT:
1998
+ kwargs["dynamic"] = dynamic
1999
+ if fields is not DEFAULT:
2000
+ kwargs["fields"] = fields
2001
+ if synthetic_source_keep is not DEFAULT:
2002
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2003
+ super().__init__(*args, **kwargs)
2004
+
2005
+
2006
+ class GeoShape(Field):
2007
+ """
2008
+ The `geo_shape` data type facilitates the indexing of and searching
2009
+ with arbitrary geo shapes such as rectangles and polygons.
2010
+
2011
+ :arg coerce:
2012
+ :arg ignore_malformed:
2013
+ :arg ignore_z_value:
2014
+ :arg index:
2015
+ :arg orientation:
2016
+ :arg strategy:
2017
+ :arg doc_values:
2018
+ :arg copy_to:
2019
+ :arg store:
2020
+ :arg meta: Metadata about the field.
2021
+ :arg properties:
2022
+ :arg ignore_above:
2023
+ :arg dynamic:
2024
+ :arg fields:
2025
+ :arg synthetic_source_keep:
2026
+ """
2027
+
2028
+ name = "geo_shape"
2029
+ _param_defs = {
2030
+ "properties": {"type": "field", "hash": True},
2031
+ "fields": {"type": "field", "hash": True},
2032
+ }
2033
+
2034
+ def __init__(
2035
+ self,
2036
+ *args: Any,
2037
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2038
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2039
+ ignore_z_value: Union[bool, "DefaultType"] = DEFAULT,
2040
+ index: Union[bool, "DefaultType"] = DEFAULT,
2041
+ orientation: Union[Literal["right", "left"], "DefaultType"] = DEFAULT,
2042
+ strategy: Union[Literal["recursive", "term"], "DefaultType"] = DEFAULT,
2043
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2044
+ copy_to: Union[
2045
+ Union[str, "InstrumentedField"],
2046
+ Sequence[Union[str, "InstrumentedField"]],
2047
+ "DefaultType",
2048
+ ] = DEFAULT,
2049
+ store: Union[bool, "DefaultType"] = DEFAULT,
2050
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2051
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2052
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2053
+ dynamic: Union[
2054
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2055
+ ] = DEFAULT,
2056
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2057
+ synthetic_source_keep: Union[
2058
+ Literal["none", "arrays", "all"], "DefaultType"
2059
+ ] = DEFAULT,
2060
+ **kwargs: Any,
2061
+ ):
2062
+ if coerce is not DEFAULT:
2063
+ kwargs["coerce"] = coerce
2064
+ if ignore_malformed is not DEFAULT:
2065
+ kwargs["ignore_malformed"] = ignore_malformed
2066
+ if ignore_z_value is not DEFAULT:
2067
+ kwargs["ignore_z_value"] = ignore_z_value
2068
+ if index is not DEFAULT:
2069
+ kwargs["index"] = index
2070
+ if orientation is not DEFAULT:
2071
+ kwargs["orientation"] = orientation
2072
+ if strategy is not DEFAULT:
2073
+ kwargs["strategy"] = strategy
2074
+ if doc_values is not DEFAULT:
2075
+ kwargs["doc_values"] = doc_values
2076
+ if copy_to is not DEFAULT:
2077
+ kwargs["copy_to"] = str(copy_to)
2078
+ if store is not DEFAULT:
2079
+ kwargs["store"] = store
2080
+ if meta is not DEFAULT:
2081
+ kwargs["meta"] = meta
2082
+ if properties is not DEFAULT:
2083
+ kwargs["properties"] = properties
2084
+ if ignore_above is not DEFAULT:
2085
+ kwargs["ignore_above"] = ignore_above
2086
+ if dynamic is not DEFAULT:
2087
+ kwargs["dynamic"] = dynamic
2088
+ if fields is not DEFAULT:
2089
+ kwargs["fields"] = fields
2090
+ if synthetic_source_keep is not DEFAULT:
2091
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2092
+ super().__init__(*args, **kwargs)
2093
+
2094
+
2095
+ class HalfFloat(Float):
2096
+ """
2097
+ :arg null_value:
2098
+ :arg boost:
2099
+ :arg coerce:
2100
+ :arg ignore_malformed:
2101
+ :arg index:
2102
+ :arg on_script_error:
2103
+ :arg script:
2104
+ :arg time_series_metric: For internal use by Elastic only. Marks the
2105
+ field as a time series dimension. Defaults to false.
2106
+ :arg time_series_dimension: For internal use by Elastic only. Marks
2107
+ the field as a time series dimension. Defaults to false.
2108
+ :arg doc_values:
2109
+ :arg copy_to:
2110
+ :arg store:
2111
+ :arg meta: Metadata about the field.
2112
+ :arg properties:
2113
+ :arg ignore_above:
2114
+ :arg dynamic:
2115
+ :arg fields:
2116
+ :arg synthetic_source_keep:
2117
+ """
2118
+
2119
+ name = "half_float"
2120
+ _param_defs = {
2121
+ "properties": {"type": "field", "hash": True},
2122
+ "fields": {"type": "field", "hash": True},
2123
+ }
2124
+
2125
+ def __init__(
2126
+ self,
2127
+ *args: Any,
2128
+ null_value: Union[float, "DefaultType"] = DEFAULT,
2129
+ boost: Union[float, "DefaultType"] = DEFAULT,
2130
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2131
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2132
+ index: Union[bool, "DefaultType"] = DEFAULT,
2133
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
2134
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
2135
+ time_series_metric: Union[
2136
+ Literal["gauge", "counter", "summary", "histogram", "position"],
2137
+ "DefaultType",
2138
+ ] = DEFAULT,
2139
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
2140
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2141
+ copy_to: Union[
2142
+ Union[str, "InstrumentedField"],
2143
+ Sequence[Union[str, "InstrumentedField"]],
2144
+ "DefaultType",
2145
+ ] = DEFAULT,
2146
+ store: Union[bool, "DefaultType"] = DEFAULT,
2147
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2148
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2149
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2150
+ dynamic: Union[
2151
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2152
+ ] = DEFAULT,
2153
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2154
+ synthetic_source_keep: Union[
2155
+ Literal["none", "arrays", "all"], "DefaultType"
2156
+ ] = DEFAULT,
2157
+ **kwargs: Any,
2158
+ ):
2159
+ if null_value is not DEFAULT:
2160
+ kwargs["null_value"] = null_value
2161
+ if boost is not DEFAULT:
2162
+ kwargs["boost"] = boost
2163
+ if coerce is not DEFAULT:
2164
+ kwargs["coerce"] = coerce
2165
+ if ignore_malformed is not DEFAULT:
2166
+ kwargs["ignore_malformed"] = ignore_malformed
2167
+ if index is not DEFAULT:
2168
+ kwargs["index"] = index
2169
+ if on_script_error is not DEFAULT:
2170
+ kwargs["on_script_error"] = on_script_error
2171
+ if script is not DEFAULT:
2172
+ kwargs["script"] = script
2173
+ if time_series_metric is not DEFAULT:
2174
+ kwargs["time_series_metric"] = time_series_metric
2175
+ if time_series_dimension is not DEFAULT:
2176
+ kwargs["time_series_dimension"] = time_series_dimension
2177
+ if doc_values is not DEFAULT:
2178
+ kwargs["doc_values"] = doc_values
2179
+ if copy_to is not DEFAULT:
2180
+ kwargs["copy_to"] = str(copy_to)
2181
+ if store is not DEFAULT:
2182
+ kwargs["store"] = store
2183
+ if meta is not DEFAULT:
2184
+ kwargs["meta"] = meta
2185
+ if properties is not DEFAULT:
2186
+ kwargs["properties"] = properties
2187
+ if ignore_above is not DEFAULT:
2188
+ kwargs["ignore_above"] = ignore_above
2189
+ if dynamic is not DEFAULT:
2190
+ kwargs["dynamic"] = dynamic
2191
+ if fields is not DEFAULT:
2192
+ kwargs["fields"] = fields
2193
+ if synthetic_source_keep is not DEFAULT:
2194
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2195
+ super().__init__(*args, **kwargs)
2196
+
2197
+
2198
+ class Histogram(Field):
2199
+ """
2200
+ :arg ignore_malformed:
2201
+ :arg meta: Metadata about the field.
2202
+ :arg properties:
2203
+ :arg ignore_above:
2204
+ :arg dynamic:
2205
+ :arg fields:
2206
+ :arg synthetic_source_keep:
2207
+ """
2208
+
2209
+ name = "histogram"
2210
+ _param_defs = {
2211
+ "properties": {"type": "field", "hash": True},
2212
+ "fields": {"type": "field", "hash": True},
2213
+ }
2214
+
2215
+ def __init__(
2216
+ self,
2217
+ *args: Any,
2218
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2219
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2220
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2221
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2222
+ dynamic: Union[
2223
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2224
+ ] = DEFAULT,
2225
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2226
+ synthetic_source_keep: Union[
2227
+ Literal["none", "arrays", "all"], "DefaultType"
2228
+ ] = DEFAULT,
2229
+ **kwargs: Any,
2230
+ ):
2231
+ if ignore_malformed is not DEFAULT:
2232
+ kwargs["ignore_malformed"] = ignore_malformed
2233
+ if meta is not DEFAULT:
2234
+ kwargs["meta"] = meta
2235
+ if properties is not DEFAULT:
2236
+ kwargs["properties"] = properties
2237
+ if ignore_above is not DEFAULT:
2238
+ kwargs["ignore_above"] = ignore_above
2239
+ if dynamic is not DEFAULT:
2240
+ kwargs["dynamic"] = dynamic
2241
+ if fields is not DEFAULT:
2242
+ kwargs["fields"] = fields
2243
+ if synthetic_source_keep is not DEFAULT:
2244
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2245
+ super().__init__(*args, **kwargs)
2246
+
2247
+
2248
+ class IcuCollationKeyword(Field):
2249
+ """
2250
+ :arg norms:
2251
+ :arg index_options:
2252
+ :arg index: Should the field be searchable?
2253
+ :arg null_value: Accepts a string value which is substituted for any
2254
+ explicit null values. Defaults to null, which means the field is
2255
+ treated as missing.
2256
+ :arg rules:
2257
+ :arg language:
2258
+ :arg country:
2259
+ :arg variant:
2260
+ :arg strength:
2261
+ :arg decomposition:
2262
+ :arg alternate:
2263
+ :arg case_level:
2264
+ :arg case_first:
2265
+ :arg numeric:
2266
+ :arg variable_top:
2267
+ :arg hiragana_quaternary_mode:
2268
+ :arg doc_values:
2269
+ :arg copy_to:
2270
+ :arg store:
2271
+ :arg meta: Metadata about the field.
2272
+ :arg properties:
2273
+ :arg ignore_above:
2274
+ :arg dynamic:
2275
+ :arg fields:
2276
+ :arg synthetic_source_keep:
2277
+ """
2278
+
2279
+ name = "icu_collation_keyword"
2280
+ _param_defs = {
2281
+ "properties": {"type": "field", "hash": True},
2282
+ "fields": {"type": "field", "hash": True},
2283
+ }
2284
+
2285
+ def __init__(
2286
+ self,
2287
+ *args: Any,
2288
+ norms: Union[bool, "DefaultType"] = DEFAULT,
2289
+ index_options: Union[
2290
+ Literal["docs", "freqs", "positions", "offsets"], "DefaultType"
2291
+ ] = DEFAULT,
2292
+ index: Union[bool, "DefaultType"] = DEFAULT,
2293
+ null_value: Union[str, "DefaultType"] = DEFAULT,
2294
+ rules: Union[str, "DefaultType"] = DEFAULT,
2295
+ language: Union[str, "DefaultType"] = DEFAULT,
2296
+ country: Union[str, "DefaultType"] = DEFAULT,
2297
+ variant: Union[str, "DefaultType"] = DEFAULT,
2298
+ strength: Union[
2299
+ Literal["primary", "secondary", "tertiary", "quaternary", "identical"],
2300
+ "DefaultType",
2301
+ ] = DEFAULT,
2302
+ decomposition: Union[Literal["no", "identical"], "DefaultType"] = DEFAULT,
2303
+ alternate: Union[Literal["shifted", "non-ignorable"], "DefaultType"] = DEFAULT,
2304
+ case_level: Union[bool, "DefaultType"] = DEFAULT,
2305
+ case_first: Union[Literal["lower", "upper"], "DefaultType"] = DEFAULT,
2306
+ numeric: Union[bool, "DefaultType"] = DEFAULT,
2307
+ variable_top: Union[str, "DefaultType"] = DEFAULT,
2308
+ hiragana_quaternary_mode: Union[bool, "DefaultType"] = DEFAULT,
2309
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2310
+ copy_to: Union[
2311
+ Union[str, "InstrumentedField"],
2312
+ Sequence[Union[str, "InstrumentedField"]],
2313
+ "DefaultType",
2314
+ ] = DEFAULT,
2315
+ store: Union[bool, "DefaultType"] = DEFAULT,
2316
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2317
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2318
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2319
+ dynamic: Union[
2320
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2321
+ ] = DEFAULT,
2322
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2323
+ synthetic_source_keep: Union[
2324
+ Literal["none", "arrays", "all"], "DefaultType"
2325
+ ] = DEFAULT,
2326
+ **kwargs: Any,
2327
+ ):
2328
+ if norms is not DEFAULT:
2329
+ kwargs["norms"] = norms
2330
+ if index_options is not DEFAULT:
2331
+ kwargs["index_options"] = index_options
2332
+ if index is not DEFAULT:
2333
+ kwargs["index"] = index
2334
+ if null_value is not DEFAULT:
2335
+ kwargs["null_value"] = null_value
2336
+ if rules is not DEFAULT:
2337
+ kwargs["rules"] = rules
2338
+ if language is not DEFAULT:
2339
+ kwargs["language"] = language
2340
+ if country is not DEFAULT:
2341
+ kwargs["country"] = country
2342
+ if variant is not DEFAULT:
2343
+ kwargs["variant"] = variant
2344
+ if strength is not DEFAULT:
2345
+ kwargs["strength"] = strength
2346
+ if decomposition is not DEFAULT:
2347
+ kwargs["decomposition"] = decomposition
2348
+ if alternate is not DEFAULT:
2349
+ kwargs["alternate"] = alternate
2350
+ if case_level is not DEFAULT:
2351
+ kwargs["case_level"] = case_level
2352
+ if case_first is not DEFAULT:
2353
+ kwargs["case_first"] = case_first
2354
+ if numeric is not DEFAULT:
2355
+ kwargs["numeric"] = numeric
2356
+ if variable_top is not DEFAULT:
2357
+ kwargs["variable_top"] = variable_top
2358
+ if hiragana_quaternary_mode is not DEFAULT:
2359
+ kwargs["hiragana_quaternary_mode"] = hiragana_quaternary_mode
2360
+ if doc_values is not DEFAULT:
2361
+ kwargs["doc_values"] = doc_values
2362
+ if copy_to is not DEFAULT:
2363
+ kwargs["copy_to"] = str(copy_to)
2364
+ if store is not DEFAULT:
2365
+ kwargs["store"] = store
2366
+ if meta is not DEFAULT:
2367
+ kwargs["meta"] = meta
2368
+ if properties is not DEFAULT:
2369
+ kwargs["properties"] = properties
2370
+ if ignore_above is not DEFAULT:
2371
+ kwargs["ignore_above"] = ignore_above
2372
+ if dynamic is not DEFAULT:
2373
+ kwargs["dynamic"] = dynamic
2374
+ if fields is not DEFAULT:
2375
+ kwargs["fields"] = fields
2376
+ if synthetic_source_keep is not DEFAULT:
2377
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2378
+ super().__init__(*args, **kwargs)
2379
+
2380
+
2381
+ class IntegerRange(RangeField):
2382
+ """
2383
+ :arg boost:
2384
+ :arg coerce:
2385
+ :arg index:
2386
+ :arg doc_values:
2387
+ :arg copy_to:
2388
+ :arg store:
2389
+ :arg meta: Metadata about the field.
2390
+ :arg properties:
2391
+ :arg ignore_above:
2392
+ :arg dynamic:
2393
+ :arg fields:
2394
+ :arg synthetic_source_keep:
2395
+ """
2396
+
2397
+ name = "integer_range"
2398
+ _core_field = Integer()
2399
+ _param_defs = {
2400
+ "properties": {"type": "field", "hash": True},
2401
+ "fields": {"type": "field", "hash": True},
2402
+ }
2403
+
2404
+ def __init__(
2405
+ self,
2406
+ *args: Any,
2407
+ boost: Union[float, "DefaultType"] = DEFAULT,
2408
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2409
+ index: Union[bool, "DefaultType"] = DEFAULT,
2410
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2411
+ copy_to: Union[
2412
+ Union[str, "InstrumentedField"],
2413
+ Sequence[Union[str, "InstrumentedField"]],
2414
+ "DefaultType",
2415
+ ] = DEFAULT,
2416
+ store: Union[bool, "DefaultType"] = DEFAULT,
2417
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2418
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2419
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2420
+ dynamic: Union[
2421
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2422
+ ] = DEFAULT,
2423
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2424
+ synthetic_source_keep: Union[
2425
+ Literal["none", "arrays", "all"], "DefaultType"
2426
+ ] = DEFAULT,
2427
+ **kwargs: Any,
2428
+ ):
2429
+ if boost is not DEFAULT:
2430
+ kwargs["boost"] = boost
2431
+ if coerce is not DEFAULT:
2432
+ kwargs["coerce"] = coerce
2433
+ if index is not DEFAULT:
2434
+ kwargs["index"] = index
2435
+ if doc_values is not DEFAULT:
2436
+ kwargs["doc_values"] = doc_values
2437
+ if copy_to is not DEFAULT:
2438
+ kwargs["copy_to"] = str(copy_to)
2439
+ if store is not DEFAULT:
2440
+ kwargs["store"] = store
2441
+ if meta is not DEFAULT:
2442
+ kwargs["meta"] = meta
2443
+ if properties is not DEFAULT:
2444
+ kwargs["properties"] = properties
2445
+ if ignore_above is not DEFAULT:
2446
+ kwargs["ignore_above"] = ignore_above
2447
+ if dynamic is not DEFAULT:
2448
+ kwargs["dynamic"] = dynamic
2449
+ if fields is not DEFAULT:
2450
+ kwargs["fields"] = fields
2451
+ if synthetic_source_keep is not DEFAULT:
2452
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2453
+ super().__init__(*args, **kwargs)
2454
+
2455
+
2456
+ class Ip(Field):
2457
+ """
2458
+ :arg boost:
2459
+ :arg index:
2460
+ :arg ignore_malformed:
2461
+ :arg null_value:
2462
+ :arg on_script_error:
2463
+ :arg script:
2464
+ :arg time_series_dimension: For internal use by Elastic only. Marks
2465
+ the field as a time series dimension. Defaults to false.
2466
+ :arg doc_values:
2467
+ :arg copy_to:
2468
+ :arg store:
2469
+ :arg meta: Metadata about the field.
2470
+ :arg properties:
2471
+ :arg ignore_above:
2472
+ :arg dynamic:
2473
+ :arg fields:
2474
+ :arg synthetic_source_keep:
2475
+ """
2476
+
2477
+ name = "ip"
2478
+ _coerce = True
2479
+ _param_defs = {
2480
+ "properties": {"type": "field", "hash": True},
2481
+ "fields": {"type": "field", "hash": True},
2482
+ }
2483
+
2484
+ def __init__(
2485
+ self,
2486
+ *args: Any,
2487
+ boost: Union[float, "DefaultType"] = DEFAULT,
2488
+ index: Union[bool, "DefaultType"] = DEFAULT,
2489
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2490
+ null_value: Union[str, "DefaultType"] = DEFAULT,
2491
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
2492
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
2493
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
2494
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2495
+ copy_to: Union[
2496
+ Union[str, "InstrumentedField"],
2497
+ Sequence[Union[str, "InstrumentedField"]],
2498
+ "DefaultType",
2499
+ ] = DEFAULT,
2500
+ store: Union[bool, "DefaultType"] = DEFAULT,
2501
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2502
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2503
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2504
+ dynamic: Union[
2505
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2506
+ ] = DEFAULT,
2507
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2508
+ synthetic_source_keep: Union[
2509
+ Literal["none", "arrays", "all"], "DefaultType"
2510
+ ] = DEFAULT,
2511
+ **kwargs: Any,
2512
+ ):
2513
+ if boost is not DEFAULT:
2514
+ kwargs["boost"] = boost
2515
+ if index is not DEFAULT:
2516
+ kwargs["index"] = index
2517
+ if ignore_malformed is not DEFAULT:
2518
+ kwargs["ignore_malformed"] = ignore_malformed
2519
+ if null_value is not DEFAULT:
2520
+ kwargs["null_value"] = null_value
2521
+ if on_script_error is not DEFAULT:
2522
+ kwargs["on_script_error"] = on_script_error
2523
+ if script is not DEFAULT:
2524
+ kwargs["script"] = script
2525
+ if time_series_dimension is not DEFAULT:
2526
+ kwargs["time_series_dimension"] = time_series_dimension
2527
+ if doc_values is not DEFAULT:
2528
+ kwargs["doc_values"] = doc_values
2529
+ if copy_to is not DEFAULT:
2530
+ kwargs["copy_to"] = str(copy_to)
2531
+ if store is not DEFAULT:
2532
+ kwargs["store"] = store
2533
+ if meta is not DEFAULT:
2534
+ kwargs["meta"] = meta
2535
+ if properties is not DEFAULT:
2536
+ kwargs["properties"] = properties
2537
+ if ignore_above is not DEFAULT:
2538
+ kwargs["ignore_above"] = ignore_above
2539
+ if dynamic is not DEFAULT:
2540
+ kwargs["dynamic"] = dynamic
2541
+ if fields is not DEFAULT:
2542
+ kwargs["fields"] = fields
2543
+ if synthetic_source_keep is not DEFAULT:
2544
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2545
+ super().__init__(*args, **kwargs)
2546
+
2547
+ def _deserialize(self, data: Any) -> Union["IPv4Address", "IPv6Address"]:
2548
+ # the ipaddress library for pypy only accepts unicode.
2549
+ return ipaddress.ip_address(unicode(data))
2550
+
2551
+ def _serialize(self, data: Any) -> Optional[str]:
2552
+ if data is None:
2553
+ return None
2554
+ return str(data)
2555
+
2556
+
2557
+ class IpRange(Field):
2558
+ """
2559
+ :arg boost:
2560
+ :arg coerce:
2561
+ :arg index:
2562
+ :arg doc_values:
2563
+ :arg copy_to:
2564
+ :arg store:
2565
+ :arg meta: Metadata about the field.
2566
+ :arg properties:
2567
+ :arg ignore_above:
2568
+ :arg dynamic:
2569
+ :arg fields:
2570
+ :arg synthetic_source_keep:
2571
+ """
2572
+
2573
+ name = "ip_range"
2574
+ _core_field = Ip()
2575
+ _param_defs = {
2576
+ "properties": {"type": "field", "hash": True},
2577
+ "fields": {"type": "field", "hash": True},
2578
+ }
2579
+
2580
+ def __init__(
2581
+ self,
2582
+ *args: Any,
2583
+ boost: Union[float, "DefaultType"] = DEFAULT,
2584
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2585
+ index: Union[bool, "DefaultType"] = DEFAULT,
2586
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2587
+ copy_to: Union[
2588
+ Union[str, "InstrumentedField"],
2589
+ Sequence[Union[str, "InstrumentedField"]],
2590
+ "DefaultType",
2591
+ ] = DEFAULT,
2592
+ store: Union[bool, "DefaultType"] = DEFAULT,
2593
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2594
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2595
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2596
+ dynamic: Union[
2597
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2598
+ ] = DEFAULT,
2599
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2600
+ synthetic_source_keep: Union[
2601
+ Literal["none", "arrays", "all"], "DefaultType"
2602
+ ] = DEFAULT,
2603
+ **kwargs: Any,
2604
+ ):
2605
+ if boost is not DEFAULT:
2606
+ kwargs["boost"] = boost
2607
+ if coerce is not DEFAULT:
2608
+ kwargs["coerce"] = coerce
2609
+ if index is not DEFAULT:
2610
+ kwargs["index"] = index
2611
+ if doc_values is not DEFAULT:
2612
+ kwargs["doc_values"] = doc_values
2613
+ if copy_to is not DEFAULT:
2614
+ kwargs["copy_to"] = str(copy_to)
2615
+ if store is not DEFAULT:
2616
+ kwargs["store"] = store
2617
+ if meta is not DEFAULT:
2618
+ kwargs["meta"] = meta
2619
+ if properties is not DEFAULT:
2620
+ kwargs["properties"] = properties
2621
+ if ignore_above is not DEFAULT:
2622
+ kwargs["ignore_above"] = ignore_above
2623
+ if dynamic is not DEFAULT:
2624
+ kwargs["dynamic"] = dynamic
2625
+ if fields is not DEFAULT:
2626
+ kwargs["fields"] = fields
2627
+ if synthetic_source_keep is not DEFAULT:
2628
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2629
+ super().__init__(*args, **kwargs)
2630
+
2631
+
2632
+ class Join(Field):
2633
+ """
2634
+ :arg relations:
2635
+ :arg eager_global_ordinals:
2636
+ :arg meta: Metadata about the field.
2637
+ :arg properties:
2638
+ :arg ignore_above:
2639
+ :arg dynamic:
2640
+ :arg fields:
2641
+ :arg synthetic_source_keep:
2642
+ """
2643
+
2644
+ name = "join"
2645
+ _param_defs = {
2646
+ "properties": {"type": "field", "hash": True},
2647
+ "fields": {"type": "field", "hash": True},
2648
+ }
2649
+
2650
+ def __init__(
2651
+ self,
2652
+ *args: Any,
2653
+ relations: Union[
2654
+ Mapping[str, Union[str, Sequence[str]]], "DefaultType"
2655
+ ] = DEFAULT,
2656
+ eager_global_ordinals: Union[bool, "DefaultType"] = DEFAULT,
2657
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2658
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2659
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2660
+ dynamic: Union[
2661
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2662
+ ] = DEFAULT,
2663
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2664
+ synthetic_source_keep: Union[
2665
+ Literal["none", "arrays", "all"], "DefaultType"
2666
+ ] = DEFAULT,
2667
+ **kwargs: Any,
2668
+ ):
2669
+ if relations is not DEFAULT:
2670
+ kwargs["relations"] = relations
2671
+ if eager_global_ordinals is not DEFAULT:
2672
+ kwargs["eager_global_ordinals"] = eager_global_ordinals
2673
+ if meta is not DEFAULT:
2674
+ kwargs["meta"] = meta
2675
+ if properties is not DEFAULT:
2676
+ kwargs["properties"] = properties
2677
+ if ignore_above is not DEFAULT:
2678
+ kwargs["ignore_above"] = ignore_above
2679
+ if dynamic is not DEFAULT:
2680
+ kwargs["dynamic"] = dynamic
2681
+ if fields is not DEFAULT:
2682
+ kwargs["fields"] = fields
2683
+ if synthetic_source_keep is not DEFAULT:
2684
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2685
+ super().__init__(*args, **kwargs)
2686
+
2687
+
2688
+ class Keyword(Field):
2689
+ """
2690
+ :arg boost:
2691
+ :arg eager_global_ordinals:
2692
+ :arg index:
2693
+ :arg index_options:
2694
+ :arg script:
2695
+ :arg on_script_error:
2696
+ :arg normalizer:
2697
+ :arg norms:
2698
+ :arg null_value:
2699
+ :arg similarity:
2700
+ :arg split_queries_on_whitespace:
2701
+ :arg time_series_dimension: For internal use by Elastic only. Marks
2702
+ the field as a time series dimension. Defaults to false.
2703
+ :arg doc_values:
2704
+ :arg copy_to:
2705
+ :arg store:
2706
+ :arg meta: Metadata about the field.
2707
+ :arg properties:
2708
+ :arg ignore_above:
2709
+ :arg dynamic:
2710
+ :arg fields:
2711
+ :arg synthetic_source_keep:
2712
+ """
2713
+
2714
+ name = "keyword"
2715
+ _param_defs = {
2716
+ "normalizer": {"type": "normalizer"},
2717
+ "properties": {"type": "field", "hash": True},
2718
+ "fields": {"type": "field", "hash": True},
2719
+ }
2720
+
2721
+ def __init__(
2722
+ self,
2723
+ *args: Any,
2724
+ boost: Union[float, "DefaultType"] = DEFAULT,
2725
+ eager_global_ordinals: Union[bool, "DefaultType"] = DEFAULT,
2726
+ index: Union[bool, "DefaultType"] = DEFAULT,
2727
+ index_options: Union[
2728
+ Literal["docs", "freqs", "positions", "offsets"], "DefaultType"
2729
+ ] = DEFAULT,
2730
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
2731
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
2732
+ normalizer: Union[str, DslBase, "DefaultType"] = DEFAULT,
2733
+ norms: Union[bool, "DefaultType"] = DEFAULT,
2734
+ null_value: Union[str, "DefaultType"] = DEFAULT,
2735
+ similarity: Union[str, None, "DefaultType"] = DEFAULT,
2736
+ split_queries_on_whitespace: Union[bool, "DefaultType"] = DEFAULT,
2737
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
2738
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2739
+ copy_to: Union[
2740
+ Union[str, "InstrumentedField"],
2741
+ Sequence[Union[str, "InstrumentedField"]],
2742
+ "DefaultType",
2743
+ ] = DEFAULT,
2744
+ store: Union[bool, "DefaultType"] = DEFAULT,
2745
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2746
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2747
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2748
+ dynamic: Union[
2749
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2750
+ ] = DEFAULT,
2751
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2752
+ synthetic_source_keep: Union[
2753
+ Literal["none", "arrays", "all"], "DefaultType"
2754
+ ] = DEFAULT,
2755
+ **kwargs: Any,
2756
+ ):
2757
+ if boost is not DEFAULT:
2758
+ kwargs["boost"] = boost
2759
+ if eager_global_ordinals is not DEFAULT:
2760
+ kwargs["eager_global_ordinals"] = eager_global_ordinals
2761
+ if index is not DEFAULT:
2762
+ kwargs["index"] = index
2763
+ if index_options is not DEFAULT:
2764
+ kwargs["index_options"] = index_options
2765
+ if script is not DEFAULT:
2766
+ kwargs["script"] = script
2767
+ if on_script_error is not DEFAULT:
2768
+ kwargs["on_script_error"] = on_script_error
2769
+ if normalizer is not DEFAULT:
2770
+ kwargs["normalizer"] = normalizer
2771
+ if norms is not DEFAULT:
2772
+ kwargs["norms"] = norms
2773
+ if null_value is not DEFAULT:
2774
+ kwargs["null_value"] = null_value
2775
+ if similarity is not DEFAULT:
2776
+ kwargs["similarity"] = similarity
2777
+ if split_queries_on_whitespace is not DEFAULT:
2778
+ kwargs["split_queries_on_whitespace"] = split_queries_on_whitespace
2779
+ if time_series_dimension is not DEFAULT:
2780
+ kwargs["time_series_dimension"] = time_series_dimension
2781
+ if doc_values is not DEFAULT:
2782
+ kwargs["doc_values"] = doc_values
2783
+ if copy_to is not DEFAULT:
2784
+ kwargs["copy_to"] = str(copy_to)
2785
+ if store is not DEFAULT:
2786
+ kwargs["store"] = store
2787
+ if meta is not DEFAULT:
2788
+ kwargs["meta"] = meta
2789
+ if properties is not DEFAULT:
2790
+ kwargs["properties"] = properties
2791
+ if ignore_above is not DEFAULT:
2792
+ kwargs["ignore_above"] = ignore_above
2793
+ if dynamic is not DEFAULT:
2794
+ kwargs["dynamic"] = dynamic
2795
+ if fields is not DEFAULT:
2796
+ kwargs["fields"] = fields
2797
+ if synthetic_source_keep is not DEFAULT:
2798
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2799
+ super().__init__(*args, **kwargs)
2800
+
2801
+
2802
+ class Long(Integer):
2803
+ """
2804
+ :arg null_value:
2805
+ :arg boost:
2806
+ :arg coerce:
2807
+ :arg ignore_malformed:
2808
+ :arg index:
2809
+ :arg on_script_error:
2810
+ :arg script:
2811
+ :arg time_series_metric: For internal use by Elastic only. Marks the
2812
+ field as a time series dimension. Defaults to false.
2813
+ :arg time_series_dimension: For internal use by Elastic only. Marks
2814
+ the field as a time series dimension. Defaults to false.
2815
+ :arg doc_values:
2816
+ :arg copy_to:
2817
+ :arg store:
2818
+ :arg meta: Metadata about the field.
2819
+ :arg properties:
2820
+ :arg ignore_above:
2821
+ :arg dynamic:
2822
+ :arg fields:
2823
+ :arg synthetic_source_keep:
2824
+ """
2825
+
2826
+ name = "long"
2827
+ _param_defs = {
2828
+ "properties": {"type": "field", "hash": True},
2829
+ "fields": {"type": "field", "hash": True},
2830
+ }
2831
+
2832
+ def __init__(
2833
+ self,
2834
+ *args: Any,
2835
+ null_value: Union[int, "DefaultType"] = DEFAULT,
2836
+ boost: Union[float, "DefaultType"] = DEFAULT,
2837
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2838
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
2839
+ index: Union[bool, "DefaultType"] = DEFAULT,
2840
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
2841
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
2842
+ time_series_metric: Union[
2843
+ Literal["gauge", "counter", "summary", "histogram", "position"],
2844
+ "DefaultType",
2845
+ ] = DEFAULT,
2846
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
2847
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2848
+ copy_to: Union[
2849
+ Union[str, "InstrumentedField"],
2850
+ Sequence[Union[str, "InstrumentedField"]],
2851
+ "DefaultType",
2852
+ ] = DEFAULT,
2853
+ store: Union[bool, "DefaultType"] = DEFAULT,
2854
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2855
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2856
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2857
+ dynamic: Union[
2858
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2859
+ ] = DEFAULT,
2860
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2861
+ synthetic_source_keep: Union[
2862
+ Literal["none", "arrays", "all"], "DefaultType"
2863
+ ] = DEFAULT,
2864
+ **kwargs: Any,
2865
+ ):
2866
+ if null_value is not DEFAULT:
2867
+ kwargs["null_value"] = null_value
2868
+ if boost is not DEFAULT:
2869
+ kwargs["boost"] = boost
2870
+ if coerce is not DEFAULT:
2871
+ kwargs["coerce"] = coerce
2872
+ if ignore_malformed is not DEFAULT:
2873
+ kwargs["ignore_malformed"] = ignore_malformed
2874
+ if index is not DEFAULT:
2875
+ kwargs["index"] = index
2876
+ if on_script_error is not DEFAULT:
2877
+ kwargs["on_script_error"] = on_script_error
2878
+ if script is not DEFAULT:
2879
+ kwargs["script"] = script
2880
+ if time_series_metric is not DEFAULT:
2881
+ kwargs["time_series_metric"] = time_series_metric
2882
+ if time_series_dimension is not DEFAULT:
2883
+ kwargs["time_series_dimension"] = time_series_dimension
2884
+ if doc_values is not DEFAULT:
2885
+ kwargs["doc_values"] = doc_values
2886
+ if copy_to is not DEFAULT:
2887
+ kwargs["copy_to"] = str(copy_to)
2888
+ if store is not DEFAULT:
2889
+ kwargs["store"] = store
2890
+ if meta is not DEFAULT:
2891
+ kwargs["meta"] = meta
2892
+ if properties is not DEFAULT:
2893
+ kwargs["properties"] = properties
2894
+ if ignore_above is not DEFAULT:
2895
+ kwargs["ignore_above"] = ignore_above
2896
+ if dynamic is not DEFAULT:
2897
+ kwargs["dynamic"] = dynamic
2898
+ if fields is not DEFAULT:
2899
+ kwargs["fields"] = fields
2900
+ if synthetic_source_keep is not DEFAULT:
2901
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2902
+ super().__init__(*args, **kwargs)
2903
+
2904
+
2905
+ class LongRange(RangeField):
2906
+ """
2907
+ :arg boost:
2908
+ :arg coerce:
2909
+ :arg index:
2910
+ :arg doc_values:
2911
+ :arg copy_to:
2912
+ :arg store:
2913
+ :arg meta: Metadata about the field.
2914
+ :arg properties:
2915
+ :arg ignore_above:
2916
+ :arg dynamic:
2917
+ :arg fields:
2918
+ :arg synthetic_source_keep:
2919
+ """
2920
+
2921
+ name = "long_range"
2922
+ _core_field = Long()
2923
+ _param_defs = {
2924
+ "properties": {"type": "field", "hash": True},
2925
+ "fields": {"type": "field", "hash": True},
2926
+ }
2927
+
2928
+ def __init__(
2929
+ self,
2930
+ *args: Any,
2931
+ boost: Union[float, "DefaultType"] = DEFAULT,
2932
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
2933
+ index: Union[bool, "DefaultType"] = DEFAULT,
2934
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
2935
+ copy_to: Union[
2936
+ Union[str, "InstrumentedField"],
2937
+ Sequence[Union[str, "InstrumentedField"]],
2938
+ "DefaultType",
2939
+ ] = DEFAULT,
2940
+ store: Union[bool, "DefaultType"] = DEFAULT,
2941
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
2942
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2943
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
2944
+ dynamic: Union[
2945
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
2946
+ ] = DEFAULT,
2947
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
2948
+ synthetic_source_keep: Union[
2949
+ Literal["none", "arrays", "all"], "DefaultType"
2950
+ ] = DEFAULT,
2951
+ **kwargs: Any,
2952
+ ):
2953
+ if boost is not DEFAULT:
2954
+ kwargs["boost"] = boost
2955
+ if coerce is not DEFAULT:
2956
+ kwargs["coerce"] = coerce
2957
+ if index is not DEFAULT:
2958
+ kwargs["index"] = index
2959
+ if doc_values is not DEFAULT:
2960
+ kwargs["doc_values"] = doc_values
2961
+ if copy_to is not DEFAULT:
2962
+ kwargs["copy_to"] = str(copy_to)
2963
+ if store is not DEFAULT:
2964
+ kwargs["store"] = store
2965
+ if meta is not DEFAULT:
2966
+ kwargs["meta"] = meta
2967
+ if properties is not DEFAULT:
2968
+ kwargs["properties"] = properties
2969
+ if ignore_above is not DEFAULT:
2970
+ kwargs["ignore_above"] = ignore_above
2971
+ if dynamic is not DEFAULT:
2972
+ kwargs["dynamic"] = dynamic
2973
+ if fields is not DEFAULT:
2974
+ kwargs["fields"] = fields
2975
+ if synthetic_source_keep is not DEFAULT:
2976
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
2977
+ super().__init__(*args, **kwargs)
2978
+
2979
+
2980
+ class MatchOnlyText(Field):
2981
+ """
2982
+ A variant of text that trades scoring and efficiency of positional
2983
+ queries for space efficiency. This field effectively stores data the
2984
+ same way as a text field that only indexes documents (index_options:
2985
+ docs) and disables norms (norms: false). Term queries perform as fast
2986
+ if not faster as on text fields, however queries that need positions
2987
+ such as the match_phrase query perform slower as they need to look at
2988
+ the _source document to verify whether a phrase matches. All queries
2989
+ return constant scores that are equal to 1.0.
2990
+
2991
+ :arg fields:
2992
+ :arg meta: Metadata about the field.
2993
+ :arg copy_to: Allows you to copy the values of multiple fields into a
2994
+ group field, which can then be queried as a single field.
2995
+ """
2996
+
2997
+ name = "match_only_text"
2998
+ _param_defs = {
2999
+ "fields": {"type": "field", "hash": True},
3000
+ }
3001
+
3002
+ def __init__(
3003
+ self,
3004
+ *args: Any,
3005
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3006
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3007
+ copy_to: Union[
3008
+ Union[str, "InstrumentedField"],
3009
+ Sequence[Union[str, "InstrumentedField"]],
3010
+ "DefaultType",
3011
+ ] = DEFAULT,
3012
+ **kwargs: Any,
3013
+ ):
3014
+ if fields is not DEFAULT:
3015
+ kwargs["fields"] = fields
3016
+ if meta is not DEFAULT:
3017
+ kwargs["meta"] = meta
3018
+ if copy_to is not DEFAULT:
3019
+ kwargs["copy_to"] = str(copy_to)
3020
+ super().__init__(*args, **kwargs)
3021
+
3022
+
3023
+ class Murmur3(Field):
3024
+ """
3025
+ :arg doc_values:
3026
+ :arg copy_to:
3027
+ :arg store:
3028
+ :arg meta: Metadata about the field.
3029
+ :arg properties:
3030
+ :arg ignore_above:
3031
+ :arg dynamic:
3032
+ :arg fields:
3033
+ :arg synthetic_source_keep:
3034
+ """
3035
+
3036
+ name = "murmur3"
3037
+ _param_defs = {
3038
+ "properties": {"type": "field", "hash": True},
3039
+ "fields": {"type": "field", "hash": True},
3040
+ }
3041
+
3042
+ def __init__(
3043
+ self,
3044
+ *args: Any,
3045
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
3046
+ copy_to: Union[
3047
+ Union[str, "InstrumentedField"],
3048
+ Sequence[Union[str, "InstrumentedField"]],
3049
+ "DefaultType",
3050
+ ] = DEFAULT,
3051
+ store: Union[bool, "DefaultType"] = DEFAULT,
3052
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3053
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3054
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3055
+ dynamic: Union[
3056
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3057
+ ] = DEFAULT,
3058
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3059
+ synthetic_source_keep: Union[
3060
+ Literal["none", "arrays", "all"], "DefaultType"
3061
+ ] = DEFAULT,
3062
+ **kwargs: Any,
3063
+ ):
3064
+ if doc_values is not DEFAULT:
3065
+ kwargs["doc_values"] = doc_values
3066
+ if copy_to is not DEFAULT:
3067
+ kwargs["copy_to"] = str(copy_to)
3068
+ if store is not DEFAULT:
3069
+ kwargs["store"] = store
3070
+ if meta is not DEFAULT:
3071
+ kwargs["meta"] = meta
3072
+ if properties is not DEFAULT:
3073
+ kwargs["properties"] = properties
3074
+ if ignore_above is not DEFAULT:
3075
+ kwargs["ignore_above"] = ignore_above
3076
+ if dynamic is not DEFAULT:
3077
+ kwargs["dynamic"] = dynamic
3078
+ if fields is not DEFAULT:
3079
+ kwargs["fields"] = fields
3080
+ if synthetic_source_keep is not DEFAULT:
3081
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3082
+ super().__init__(*args, **kwargs)
3083
+
3084
+
3085
+ class Nested(Object):
3086
+ """
3087
+ :arg enabled:
3088
+ :arg include_in_parent:
3089
+ :arg include_in_root:
3090
+ :arg copy_to:
3091
+ :arg store:
3092
+ :arg meta: Metadata about the field.
3093
+ :arg properties:
3094
+ :arg ignore_above:
3095
+ :arg dynamic:
3096
+ :arg fields:
3097
+ :arg synthetic_source_keep:
3098
+ """
3099
+
3100
+ name = "nested"
3101
+ _param_defs = {
3102
+ "properties": {"type": "field", "hash": True},
3103
+ "fields": {"type": "field", "hash": True},
3104
+ }
3105
+
3106
+ def __init__(
3107
+ self,
3108
+ *args: Any,
3109
+ enabled: Union[bool, "DefaultType"] = DEFAULT,
3110
+ include_in_parent: Union[bool, "DefaultType"] = DEFAULT,
3111
+ include_in_root: Union[bool, "DefaultType"] = DEFAULT,
3112
+ copy_to: Union[
3113
+ Union[str, "InstrumentedField"],
3114
+ Sequence[Union[str, "InstrumentedField"]],
3115
+ "DefaultType",
3116
+ ] = DEFAULT,
3117
+ store: Union[bool, "DefaultType"] = DEFAULT,
3118
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3119
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3120
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3121
+ dynamic: Union[
3122
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3123
+ ] = DEFAULT,
3124
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3125
+ synthetic_source_keep: Union[
3126
+ Literal["none", "arrays", "all"], "DefaultType"
3127
+ ] = DEFAULT,
3128
+ **kwargs: Any,
3129
+ ):
3130
+ if enabled is not DEFAULT:
3131
+ kwargs["enabled"] = enabled
3132
+ if include_in_parent is not DEFAULT:
3133
+ kwargs["include_in_parent"] = include_in_parent
3134
+ if include_in_root is not DEFAULT:
3135
+ kwargs["include_in_root"] = include_in_root
3136
+ if copy_to is not DEFAULT:
3137
+ kwargs["copy_to"] = str(copy_to)
3138
+ if store is not DEFAULT:
3139
+ kwargs["store"] = store
3140
+ if meta is not DEFAULT:
3141
+ kwargs["meta"] = meta
3142
+ if properties is not DEFAULT:
3143
+ kwargs["properties"] = properties
3144
+ if ignore_above is not DEFAULT:
3145
+ kwargs["ignore_above"] = ignore_above
3146
+ if dynamic is not DEFAULT:
3147
+ kwargs["dynamic"] = dynamic
3148
+ if fields is not DEFAULT:
3149
+ kwargs["fields"] = fields
3150
+ if synthetic_source_keep is not DEFAULT:
3151
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3152
+ kwargs.setdefault("multi", True)
3153
+ super().__init__(*args, **kwargs)
3154
+
3155
+
3156
+ class Passthrough(Field):
3157
+ """
3158
+ :arg enabled:
3159
+ :arg priority:
3160
+ :arg time_series_dimension:
3161
+ :arg copy_to:
3162
+ :arg store:
3163
+ :arg meta: Metadata about the field.
3164
+ :arg properties:
3165
+ :arg ignore_above:
3166
+ :arg dynamic:
3167
+ :arg fields:
3168
+ :arg synthetic_source_keep:
3169
+ """
3170
+
3171
+ name = "passthrough"
3172
+ _param_defs = {
3173
+ "properties": {"type": "field", "hash": True},
3174
+ "fields": {"type": "field", "hash": True},
3175
+ }
3176
+
3177
+ def __init__(
3178
+ self,
3179
+ *args: Any,
3180
+ enabled: Union[bool, "DefaultType"] = DEFAULT,
3181
+ priority: Union[int, "DefaultType"] = DEFAULT,
3182
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
3183
+ copy_to: Union[
3184
+ Union[str, "InstrumentedField"],
3185
+ Sequence[Union[str, "InstrumentedField"]],
3186
+ "DefaultType",
3187
+ ] = DEFAULT,
3188
+ store: Union[bool, "DefaultType"] = DEFAULT,
3189
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3190
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3191
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3192
+ dynamic: Union[
3193
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3194
+ ] = DEFAULT,
3195
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3196
+ synthetic_source_keep: Union[
3197
+ Literal["none", "arrays", "all"], "DefaultType"
3198
+ ] = DEFAULT,
3199
+ **kwargs: Any,
3200
+ ):
3201
+ if enabled is not DEFAULT:
3202
+ kwargs["enabled"] = enabled
3203
+ if priority is not DEFAULT:
3204
+ kwargs["priority"] = priority
3205
+ if time_series_dimension is not DEFAULT:
3206
+ kwargs["time_series_dimension"] = time_series_dimension
3207
+ if copy_to is not DEFAULT:
3208
+ kwargs["copy_to"] = str(copy_to)
3209
+ if store is not DEFAULT:
3210
+ kwargs["store"] = store
3211
+ if meta is not DEFAULT:
3212
+ kwargs["meta"] = meta
3213
+ if properties is not DEFAULT:
3214
+ kwargs["properties"] = properties
3215
+ if ignore_above is not DEFAULT:
3216
+ kwargs["ignore_above"] = ignore_above
3217
+ if dynamic is not DEFAULT:
3218
+ kwargs["dynamic"] = dynamic
3219
+ if fields is not DEFAULT:
3220
+ kwargs["fields"] = fields
3221
+ if synthetic_source_keep is not DEFAULT:
3222
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3223
+ super().__init__(*args, **kwargs)
3224
+
3225
+
3226
+ class Percolator(Field):
3227
+ """
3228
+ :arg meta: Metadata about the field.
3229
+ :arg properties:
3230
+ :arg ignore_above:
3231
+ :arg dynamic:
3232
+ :arg fields:
3233
+ :arg synthetic_source_keep:
3234
+ """
3235
+
3236
+ name = "percolator"
3237
+ _coerce = True
3238
+ _param_defs = {
3239
+ "properties": {"type": "field", "hash": True},
3240
+ "fields": {"type": "field", "hash": True},
3241
+ }
3242
+
3243
+ def __init__(
3244
+ self,
3245
+ *args: Any,
3246
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3247
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3248
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3249
+ dynamic: Union[
3250
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3251
+ ] = DEFAULT,
3252
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3253
+ synthetic_source_keep: Union[
3254
+ Literal["none", "arrays", "all"], "DefaultType"
3255
+ ] = DEFAULT,
3256
+ **kwargs: Any,
3257
+ ):
3258
+ if meta is not DEFAULT:
3259
+ kwargs["meta"] = meta
3260
+ if properties is not DEFAULT:
3261
+ kwargs["properties"] = properties
3262
+ if ignore_above is not DEFAULT:
3263
+ kwargs["ignore_above"] = ignore_above
3264
+ if dynamic is not DEFAULT:
3265
+ kwargs["dynamic"] = dynamic
3266
+ if fields is not DEFAULT:
3267
+ kwargs["fields"] = fields
3268
+ if synthetic_source_keep is not DEFAULT:
3269
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3270
+ super().__init__(*args, **kwargs)
3271
+
3272
+ def _deserialize(self, data: Any) -> "Query":
3273
+ return Q(data) # type: ignore[no-any-return]
3274
+
3275
+ def _serialize(self, data: Any) -> Optional[Dict[str, Any]]:
3276
+ if data is None:
3277
+ return None
3278
+ return data.to_dict() # type: ignore[no-any-return]
3279
+
3280
+
3281
+ class Point(Field):
3282
+ """
3283
+ :arg ignore_malformed:
3284
+ :arg ignore_z_value:
3285
+ :arg null_value:
3286
+ :arg doc_values:
3287
+ :arg copy_to:
3288
+ :arg store:
3289
+ :arg meta: Metadata about the field.
3290
+ :arg properties:
3291
+ :arg ignore_above:
3292
+ :arg dynamic:
3293
+ :arg fields:
3294
+ :arg synthetic_source_keep:
3295
+ """
3296
+
3297
+ name = "point"
3298
+ _param_defs = {
3299
+ "properties": {"type": "field", "hash": True},
3300
+ "fields": {"type": "field", "hash": True},
3301
+ }
3302
+
3303
+ def __init__(
3304
+ self,
3305
+ *args: Any,
3306
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
3307
+ ignore_z_value: Union[bool, "DefaultType"] = DEFAULT,
3308
+ null_value: Union[str, "DefaultType"] = DEFAULT,
3309
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
3310
+ copy_to: Union[
3311
+ Union[str, "InstrumentedField"],
3312
+ Sequence[Union[str, "InstrumentedField"]],
3313
+ "DefaultType",
3314
+ ] = DEFAULT,
3315
+ store: Union[bool, "DefaultType"] = DEFAULT,
3316
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3317
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3318
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3319
+ dynamic: Union[
3320
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3321
+ ] = DEFAULT,
3322
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3323
+ synthetic_source_keep: Union[
3324
+ Literal["none", "arrays", "all"], "DefaultType"
3325
+ ] = DEFAULT,
3326
+ **kwargs: Any,
3327
+ ):
3328
+ if ignore_malformed is not DEFAULT:
3329
+ kwargs["ignore_malformed"] = ignore_malformed
3330
+ if ignore_z_value is not DEFAULT:
3331
+ kwargs["ignore_z_value"] = ignore_z_value
3332
+ if null_value is not DEFAULT:
3333
+ kwargs["null_value"] = null_value
3334
+ if doc_values is not DEFAULT:
3335
+ kwargs["doc_values"] = doc_values
3336
+ if copy_to is not DEFAULT:
3337
+ kwargs["copy_to"] = str(copy_to)
3338
+ if store is not DEFAULT:
3339
+ kwargs["store"] = store
3340
+ if meta is not DEFAULT:
3341
+ kwargs["meta"] = meta
3342
+ if properties is not DEFAULT:
3343
+ kwargs["properties"] = properties
3344
+ if ignore_above is not DEFAULT:
3345
+ kwargs["ignore_above"] = ignore_above
3346
+ if dynamic is not DEFAULT:
3347
+ kwargs["dynamic"] = dynamic
3348
+ if fields is not DEFAULT:
3349
+ kwargs["fields"] = fields
3350
+ if synthetic_source_keep is not DEFAULT:
3351
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3352
+ super().__init__(*args, **kwargs)
3353
+
3354
+
3355
+ class RankFeature(Float):
3356
+ """
3357
+ :arg positive_score_impact:
3358
+ :arg meta: Metadata about the field.
3359
+ :arg properties:
3360
+ :arg ignore_above:
3361
+ :arg dynamic:
3362
+ :arg fields:
3363
+ :arg synthetic_source_keep:
3364
+ """
3365
+
3366
+ name = "rank_feature"
3367
+ _param_defs = {
3368
+ "properties": {"type": "field", "hash": True},
3369
+ "fields": {"type": "field", "hash": True},
3370
+ }
3371
+
3372
+ def __init__(
3373
+ self,
3374
+ *args: Any,
3375
+ positive_score_impact: Union[bool, "DefaultType"] = DEFAULT,
3376
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3377
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3378
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3379
+ dynamic: Union[
3380
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3381
+ ] = DEFAULT,
3382
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3383
+ synthetic_source_keep: Union[
3384
+ Literal["none", "arrays", "all"], "DefaultType"
3385
+ ] = DEFAULT,
3386
+ **kwargs: Any,
3387
+ ):
3388
+ if positive_score_impact is not DEFAULT:
3389
+ kwargs["positive_score_impact"] = positive_score_impact
3390
+ if meta is not DEFAULT:
3391
+ kwargs["meta"] = meta
3392
+ if properties is not DEFAULT:
3393
+ kwargs["properties"] = properties
3394
+ if ignore_above is not DEFAULT:
3395
+ kwargs["ignore_above"] = ignore_above
3396
+ if dynamic is not DEFAULT:
3397
+ kwargs["dynamic"] = dynamic
3398
+ if fields is not DEFAULT:
3399
+ kwargs["fields"] = fields
3400
+ if synthetic_source_keep is not DEFAULT:
3401
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3402
+ super().__init__(*args, **kwargs)
3403
+
3404
+
3405
+ class RankFeatures(Field):
3406
+ """
3407
+ :arg positive_score_impact:
3408
+ :arg meta: Metadata about the field.
3409
+ :arg properties:
3410
+ :arg ignore_above:
3411
+ :arg dynamic:
3412
+ :arg fields:
3413
+ :arg synthetic_source_keep:
3414
+ """
3415
+
3416
+ name = "rank_features"
3417
+ _param_defs = {
3418
+ "properties": {"type": "field", "hash": True},
3419
+ "fields": {"type": "field", "hash": True},
3420
+ }
3421
+
3422
+ def __init__(
3423
+ self,
3424
+ *args: Any,
3425
+ positive_score_impact: Union[bool, "DefaultType"] = DEFAULT,
3426
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3427
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3428
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3429
+ dynamic: Union[
3430
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3431
+ ] = DEFAULT,
3432
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3433
+ synthetic_source_keep: Union[
3434
+ Literal["none", "arrays", "all"], "DefaultType"
3435
+ ] = DEFAULT,
3436
+ **kwargs: Any,
3437
+ ):
3438
+ if positive_score_impact is not DEFAULT:
3439
+ kwargs["positive_score_impact"] = positive_score_impact
3440
+ if meta is not DEFAULT:
3441
+ kwargs["meta"] = meta
3442
+ if properties is not DEFAULT:
3443
+ kwargs["properties"] = properties
3444
+ if ignore_above is not DEFAULT:
3445
+ kwargs["ignore_above"] = ignore_above
3446
+ if dynamic is not DEFAULT:
3447
+ kwargs["dynamic"] = dynamic
3448
+ if fields is not DEFAULT:
3449
+ kwargs["fields"] = fields
3450
+ if synthetic_source_keep is not DEFAULT:
3451
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3452
+ super().__init__(*args, **kwargs)
3453
+
3454
+
3455
+ class ScaledFloat(Float):
3456
+ """
3457
+ :arg null_value:
3458
+ :arg scaling_factor:
3459
+ :arg boost:
3460
+ :arg coerce:
3461
+ :arg ignore_malformed:
3462
+ :arg index:
3463
+ :arg on_script_error:
3464
+ :arg script:
3465
+ :arg time_series_metric: For internal use by Elastic only. Marks the
3466
+ field as a time series dimension. Defaults to false.
3467
+ :arg time_series_dimension: For internal use by Elastic only. Marks
3468
+ the field as a time series dimension. Defaults to false.
3469
+ :arg doc_values:
3470
+ :arg copy_to:
3471
+ :arg store:
3472
+ :arg meta: Metadata about the field.
3473
+ :arg properties:
3474
+ :arg ignore_above:
3475
+ :arg dynamic:
3476
+ :arg fields:
3477
+ :arg synthetic_source_keep:
3478
+ """
3479
+
3480
+ name = "scaled_float"
3481
+ _param_defs = {
3482
+ "properties": {"type": "field", "hash": True},
3483
+ "fields": {"type": "field", "hash": True},
3484
+ }
3485
+
3486
+ def __init__(
3487
+ self,
3488
+ *args: Any,
3489
+ null_value: Union[float, "DefaultType"] = DEFAULT,
3490
+ scaling_factor: Union[float, "DefaultType"] = DEFAULT,
3491
+ boost: Union[float, "DefaultType"] = DEFAULT,
3492
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
3493
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
3494
+ index: Union[bool, "DefaultType"] = DEFAULT,
3495
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
3496
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
3497
+ time_series_metric: Union[
3498
+ Literal["gauge", "counter", "summary", "histogram", "position"],
3499
+ "DefaultType",
3500
+ ] = DEFAULT,
3501
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
3502
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
3503
+ copy_to: Union[
3504
+ Union[str, "InstrumentedField"],
3505
+ Sequence[Union[str, "InstrumentedField"]],
3506
+ "DefaultType",
3507
+ ] = DEFAULT,
3508
+ store: Union[bool, "DefaultType"] = DEFAULT,
3509
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3510
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3511
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3512
+ dynamic: Union[
3513
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3514
+ ] = DEFAULT,
3515
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3516
+ synthetic_source_keep: Union[
3517
+ Literal["none", "arrays", "all"], "DefaultType"
3518
+ ] = DEFAULT,
3519
+ **kwargs: Any,
3520
+ ):
3521
+ if null_value is not DEFAULT:
3522
+ kwargs["null_value"] = null_value
3523
+ if scaling_factor is not DEFAULT:
3524
+ kwargs["scaling_factor"] = scaling_factor
3525
+ if boost is not DEFAULT:
3526
+ kwargs["boost"] = boost
3527
+ if coerce is not DEFAULT:
3528
+ kwargs["coerce"] = coerce
3529
+ if ignore_malformed is not DEFAULT:
3530
+ kwargs["ignore_malformed"] = ignore_malformed
3531
+ if index is not DEFAULT:
3532
+ kwargs["index"] = index
3533
+ if on_script_error is not DEFAULT:
3534
+ kwargs["on_script_error"] = on_script_error
3535
+ if script is not DEFAULT:
3536
+ kwargs["script"] = script
3537
+ if time_series_metric is not DEFAULT:
3538
+ kwargs["time_series_metric"] = time_series_metric
3539
+ if time_series_dimension is not DEFAULT:
3540
+ kwargs["time_series_dimension"] = time_series_dimension
3541
+ if doc_values is not DEFAULT:
3542
+ kwargs["doc_values"] = doc_values
3543
+ if copy_to is not DEFAULT:
3544
+ kwargs["copy_to"] = str(copy_to)
3545
+ if store is not DEFAULT:
3546
+ kwargs["store"] = store
3547
+ if meta is not DEFAULT:
3548
+ kwargs["meta"] = meta
3549
+ if properties is not DEFAULT:
3550
+ kwargs["properties"] = properties
3551
+ if ignore_above is not DEFAULT:
3552
+ kwargs["ignore_above"] = ignore_above
3553
+ if dynamic is not DEFAULT:
3554
+ kwargs["dynamic"] = dynamic
3555
+ if fields is not DEFAULT:
3556
+ kwargs["fields"] = fields
3557
+ if synthetic_source_keep is not DEFAULT:
3558
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3559
+ if "scaling_factor" not in kwargs:
3560
+ if len(args) > 0:
3561
+ kwargs["scaling_factor"] = args[0]
3562
+ args = args[1:]
3563
+ else:
3564
+ raise TypeError("missing required argument: 'scaling_factor'")
3565
+ super().__init__(*args, **kwargs)
3566
+
3567
+
3568
+ class SearchAsYouType(Field):
3569
+ """
3570
+ :arg analyzer:
3571
+ :arg index:
3572
+ :arg index_options:
3573
+ :arg max_shingle_size:
3574
+ :arg norms:
3575
+ :arg search_analyzer:
3576
+ :arg search_quote_analyzer:
3577
+ :arg similarity:
3578
+ :arg term_vector:
3579
+ :arg copy_to:
3580
+ :arg store:
3581
+ :arg meta: Metadata about the field.
3582
+ :arg properties:
3583
+ :arg ignore_above:
3584
+ :arg dynamic:
3585
+ :arg fields:
3586
+ :arg synthetic_source_keep:
3587
+ """
3588
+
3589
+ name = "search_as_you_type"
3590
+ _param_defs = {
3591
+ "analyzer": {"type": "analyzer"},
3592
+ "search_analyzer": {"type": "analyzer"},
3593
+ "search_quote_analyzer": {"type": "analyzer"},
3594
+ "properties": {"type": "field", "hash": True},
3595
+ "fields": {"type": "field", "hash": True},
3596
+ }
3597
+
3598
+ def __init__(
3599
+ self,
3600
+ *args: Any,
3601
+ analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
3602
+ index: Union[bool, "DefaultType"] = DEFAULT,
3603
+ index_options: Union[
3604
+ Literal["docs", "freqs", "positions", "offsets"], "DefaultType"
3605
+ ] = DEFAULT,
3606
+ max_shingle_size: Union[int, "DefaultType"] = DEFAULT,
3607
+ norms: Union[bool, "DefaultType"] = DEFAULT,
3608
+ search_analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
3609
+ search_quote_analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
3610
+ similarity: Union[str, None, "DefaultType"] = DEFAULT,
3611
+ term_vector: Union[
3612
+ Literal[
3613
+ "no",
3614
+ "yes",
3615
+ "with_offsets",
3616
+ "with_positions",
3617
+ "with_positions_offsets",
3618
+ "with_positions_offsets_payloads",
3619
+ "with_positions_payloads",
3620
+ ],
3621
+ "DefaultType",
3622
+ ] = DEFAULT,
3623
+ copy_to: Union[
3624
+ Union[str, "InstrumentedField"],
3625
+ Sequence[Union[str, "InstrumentedField"]],
3626
+ "DefaultType",
3627
+ ] = DEFAULT,
3628
+ store: Union[bool, "DefaultType"] = DEFAULT,
3629
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3630
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3631
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3632
+ dynamic: Union[
3633
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3634
+ ] = DEFAULT,
3635
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3636
+ synthetic_source_keep: Union[
3637
+ Literal["none", "arrays", "all"], "DefaultType"
3638
+ ] = DEFAULT,
3639
+ **kwargs: Any,
3640
+ ):
3641
+ if analyzer is not DEFAULT:
3642
+ kwargs["analyzer"] = analyzer
3643
+ if index is not DEFAULT:
3644
+ kwargs["index"] = index
3645
+ if index_options is not DEFAULT:
3646
+ kwargs["index_options"] = index_options
3647
+ if max_shingle_size is not DEFAULT:
3648
+ kwargs["max_shingle_size"] = max_shingle_size
3649
+ if norms is not DEFAULT:
3650
+ kwargs["norms"] = norms
3651
+ if search_analyzer is not DEFAULT:
3652
+ kwargs["search_analyzer"] = search_analyzer
3653
+ if search_quote_analyzer is not DEFAULT:
3654
+ kwargs["search_quote_analyzer"] = search_quote_analyzer
3655
+ if similarity is not DEFAULT:
3656
+ kwargs["similarity"] = similarity
3657
+ if term_vector is not DEFAULT:
3658
+ kwargs["term_vector"] = term_vector
3659
+ if copy_to is not DEFAULT:
3660
+ kwargs["copy_to"] = str(copy_to)
3661
+ if store is not DEFAULT:
3662
+ kwargs["store"] = store
3663
+ if meta is not DEFAULT:
3664
+ kwargs["meta"] = meta
3665
+ if properties is not DEFAULT:
3666
+ kwargs["properties"] = properties
3667
+ if ignore_above is not DEFAULT:
3668
+ kwargs["ignore_above"] = ignore_above
3669
+ if dynamic is not DEFAULT:
3670
+ kwargs["dynamic"] = dynamic
3671
+ if fields is not DEFAULT:
3672
+ kwargs["fields"] = fields
3673
+ if synthetic_source_keep is not DEFAULT:
3674
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3675
+ super().__init__(*args, **kwargs)
3676
+
3677
+
3678
+ class SemanticText(Field):
3679
+ """
3680
+ :arg meta:
3681
+ :arg inference_id: Inference endpoint that will be used to generate
3682
+ embeddings for the field. This parameter cannot be updated. Use
3683
+ the Create inference API to create the endpoint. If
3684
+ `search_inference_id` is specified, the inference endpoint will
3685
+ only be used at index time. Defaults to `.elser-2-elasticsearch`
3686
+ if omitted.
3687
+ :arg search_inference_id: Inference endpoint that will be used to
3688
+ generate embeddings at query time. You can update this parameter
3689
+ by using the Update mapping API. Use the Create inference API to
3690
+ create the endpoint. If not specified, the inference endpoint
3691
+ defined by inference_id will be used at both index and query time.
3692
+ """
3693
+
3694
+ name = "semantic_text"
3695
+
3696
+ def __init__(
3697
+ self,
3698
+ *args: Any,
3699
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3700
+ inference_id: Union[str, "DefaultType"] = DEFAULT,
3701
+ search_inference_id: Union[str, "DefaultType"] = DEFAULT,
3702
+ **kwargs: Any,
3703
+ ):
3704
+ if meta is not DEFAULT:
3705
+ kwargs["meta"] = meta
3706
+ if inference_id is not DEFAULT:
3707
+ kwargs["inference_id"] = inference_id
3708
+ if search_inference_id is not DEFAULT:
3709
+ kwargs["search_inference_id"] = search_inference_id
3710
+ super().__init__(*args, **kwargs)
3711
+
3712
+
3713
+ class Shape(Field):
3714
+ """
3715
+ The `shape` data type facilitates the indexing of and searching with
3716
+ arbitrary `x, y` cartesian shapes such as rectangles and polygons.
3717
+
3718
+ :arg coerce:
3719
+ :arg ignore_malformed:
3720
+ :arg ignore_z_value:
3721
+ :arg orientation:
3722
+ :arg doc_values:
3723
+ :arg copy_to:
3724
+ :arg store:
3725
+ :arg meta: Metadata about the field.
3726
+ :arg properties:
3727
+ :arg ignore_above:
3728
+ :arg dynamic:
3729
+ :arg fields:
3730
+ :arg synthetic_source_keep:
3731
+ """
3732
+
3733
+ name = "shape"
3734
+ _param_defs = {
3735
+ "properties": {"type": "field", "hash": True},
3736
+ "fields": {"type": "field", "hash": True},
3737
+ }
3738
+
3739
+ def __init__(
3740
+ self,
3741
+ *args: Any,
3742
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
3743
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
3744
+ ignore_z_value: Union[bool, "DefaultType"] = DEFAULT,
3745
+ orientation: Union[Literal["right", "left"], "DefaultType"] = DEFAULT,
3746
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
3747
+ copy_to: Union[
3748
+ Union[str, "InstrumentedField"],
3749
+ Sequence[Union[str, "InstrumentedField"]],
3750
+ "DefaultType",
3751
+ ] = DEFAULT,
3752
+ store: Union[bool, "DefaultType"] = DEFAULT,
3753
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3754
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3755
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3756
+ dynamic: Union[
3757
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3758
+ ] = DEFAULT,
3759
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3760
+ synthetic_source_keep: Union[
3761
+ Literal["none", "arrays", "all"], "DefaultType"
3762
+ ] = DEFAULT,
3763
+ **kwargs: Any,
3764
+ ):
3765
+ if coerce is not DEFAULT:
3766
+ kwargs["coerce"] = coerce
3767
+ if ignore_malformed is not DEFAULT:
3768
+ kwargs["ignore_malformed"] = ignore_malformed
3769
+ if ignore_z_value is not DEFAULT:
3770
+ kwargs["ignore_z_value"] = ignore_z_value
3771
+ if orientation is not DEFAULT:
3772
+ kwargs["orientation"] = orientation
3773
+ if doc_values is not DEFAULT:
3774
+ kwargs["doc_values"] = doc_values
3775
+ if copy_to is not DEFAULT:
3776
+ kwargs["copy_to"] = str(copy_to)
3777
+ if store is not DEFAULT:
3778
+ kwargs["store"] = store
3779
+ if meta is not DEFAULT:
3780
+ kwargs["meta"] = meta
3781
+ if properties is not DEFAULT:
3782
+ kwargs["properties"] = properties
3783
+ if ignore_above is not DEFAULT:
3784
+ kwargs["ignore_above"] = ignore_above
3785
+ if dynamic is not DEFAULT:
3786
+ kwargs["dynamic"] = dynamic
3787
+ if fields is not DEFAULT:
3788
+ kwargs["fields"] = fields
3789
+ if synthetic_source_keep is not DEFAULT:
3790
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3791
+ super().__init__(*args, **kwargs)
3792
+
3793
+
3794
+ class Short(Integer):
3795
+ """
3796
+ :arg null_value:
3797
+ :arg boost:
3798
+ :arg coerce:
3799
+ :arg ignore_malformed:
3800
+ :arg index:
3801
+ :arg on_script_error:
3802
+ :arg script:
3803
+ :arg time_series_metric: For internal use by Elastic only. Marks the
3804
+ field as a time series dimension. Defaults to false.
3805
+ :arg time_series_dimension: For internal use by Elastic only. Marks
3806
+ the field as a time series dimension. Defaults to false.
3807
+ :arg doc_values:
3808
+ :arg copy_to:
3809
+ :arg store:
3810
+ :arg meta: Metadata about the field.
3811
+ :arg properties:
3812
+ :arg ignore_above:
3813
+ :arg dynamic:
3814
+ :arg fields:
3815
+ :arg synthetic_source_keep:
3816
+ """
3817
+
3818
+ name = "short"
3819
+ _param_defs = {
3820
+ "properties": {"type": "field", "hash": True},
3821
+ "fields": {"type": "field", "hash": True},
3822
+ }
3823
+
3824
+ def __init__(
3825
+ self,
3826
+ *args: Any,
3827
+ null_value: Union[float, "DefaultType"] = DEFAULT,
3828
+ boost: Union[float, "DefaultType"] = DEFAULT,
3829
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
3830
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
3831
+ index: Union[bool, "DefaultType"] = DEFAULT,
3832
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
3833
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
3834
+ time_series_metric: Union[
3835
+ Literal["gauge", "counter", "summary", "histogram", "position"],
3836
+ "DefaultType",
3837
+ ] = DEFAULT,
3838
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
3839
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
3840
+ copy_to: Union[
3841
+ Union[str, "InstrumentedField"],
3842
+ Sequence[Union[str, "InstrumentedField"]],
3843
+ "DefaultType",
3844
+ ] = DEFAULT,
3845
+ store: Union[bool, "DefaultType"] = DEFAULT,
3846
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3847
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3848
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3849
+ dynamic: Union[
3850
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3851
+ ] = DEFAULT,
3852
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3853
+ synthetic_source_keep: Union[
3854
+ Literal["none", "arrays", "all"], "DefaultType"
3855
+ ] = DEFAULT,
3856
+ **kwargs: Any,
3857
+ ):
3858
+ if null_value is not DEFAULT:
3859
+ kwargs["null_value"] = null_value
3860
+ if boost is not DEFAULT:
3861
+ kwargs["boost"] = boost
3862
+ if coerce is not DEFAULT:
3863
+ kwargs["coerce"] = coerce
3864
+ if ignore_malformed is not DEFAULT:
3865
+ kwargs["ignore_malformed"] = ignore_malformed
3866
+ if index is not DEFAULT:
3867
+ kwargs["index"] = index
3868
+ if on_script_error is not DEFAULT:
3869
+ kwargs["on_script_error"] = on_script_error
3870
+ if script is not DEFAULT:
3871
+ kwargs["script"] = script
3872
+ if time_series_metric is not DEFAULT:
3873
+ kwargs["time_series_metric"] = time_series_metric
3874
+ if time_series_dimension is not DEFAULT:
3875
+ kwargs["time_series_dimension"] = time_series_dimension
3876
+ if doc_values is not DEFAULT:
3877
+ kwargs["doc_values"] = doc_values
3878
+ if copy_to is not DEFAULT:
3879
+ kwargs["copy_to"] = str(copy_to)
3880
+ if store is not DEFAULT:
3881
+ kwargs["store"] = store
3882
+ if meta is not DEFAULT:
3883
+ kwargs["meta"] = meta
3884
+ if properties is not DEFAULT:
3885
+ kwargs["properties"] = properties
3886
+ if ignore_above is not DEFAULT:
3887
+ kwargs["ignore_above"] = ignore_above
3888
+ if dynamic is not DEFAULT:
3889
+ kwargs["dynamic"] = dynamic
3890
+ if fields is not DEFAULT:
3891
+ kwargs["fields"] = fields
3892
+ if synthetic_source_keep is not DEFAULT:
3893
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3894
+ super().__init__(*args, **kwargs)
3895
+
3896
+
3897
+ class SparseVector(Field):
3898
+ """
3899
+ :arg meta: Metadata about the field.
3900
+ :arg properties:
3901
+ :arg ignore_above:
3902
+ :arg dynamic:
3903
+ :arg fields:
3904
+ :arg synthetic_source_keep:
3905
+ """
3906
+
3907
+ name = "sparse_vector"
3908
+ _param_defs = {
3909
+ "properties": {"type": "field", "hash": True},
3910
+ "fields": {"type": "field", "hash": True},
3911
+ }
3912
+
3913
+ def __init__(
3914
+ self,
3915
+ *args: Any,
3916
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
3917
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3918
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
3919
+ dynamic: Union[
3920
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
3921
+ ] = DEFAULT,
3922
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
3923
+ synthetic_source_keep: Union[
3924
+ Literal["none", "arrays", "all"], "DefaultType"
3925
+ ] = DEFAULT,
3926
+ **kwargs: Any,
3927
+ ):
3928
+ if meta is not DEFAULT:
3929
+ kwargs["meta"] = meta
3930
+ if properties is not DEFAULT:
3931
+ kwargs["properties"] = properties
3932
+ if ignore_above is not DEFAULT:
3933
+ kwargs["ignore_above"] = ignore_above
3934
+ if dynamic is not DEFAULT:
3935
+ kwargs["dynamic"] = dynamic
3936
+ if fields is not DEFAULT:
3937
+ kwargs["fields"] = fields
3938
+ if synthetic_source_keep is not DEFAULT:
3939
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
3940
+ super().__init__(*args, **kwargs)
3941
+
3942
+
3943
+ class Text(Field):
3944
+ """
3945
+ :arg analyzer:
3946
+ :arg boost:
3947
+ :arg eager_global_ordinals:
3948
+ :arg fielddata:
3949
+ :arg fielddata_frequency_filter:
3950
+ :arg index:
3951
+ :arg index_options:
3952
+ :arg index_phrases:
3953
+ :arg index_prefixes:
3954
+ :arg norms:
3955
+ :arg position_increment_gap:
3956
+ :arg search_analyzer:
3957
+ :arg search_quote_analyzer:
3958
+ :arg similarity:
3959
+ :arg term_vector:
3960
+ :arg copy_to:
3961
+ :arg store:
3962
+ :arg meta: Metadata about the field.
3963
+ :arg properties:
3964
+ :arg ignore_above:
3965
+ :arg dynamic:
3966
+ :arg fields:
3967
+ :arg synthetic_source_keep:
3968
+ """
3969
+
3970
+ name = "text"
3971
+ _param_defs = {
3972
+ "analyzer": {"type": "analyzer"},
3973
+ "search_analyzer": {"type": "analyzer"},
3974
+ "search_quote_analyzer": {"type": "analyzer"},
3975
+ "properties": {"type": "field", "hash": True},
3976
+ "fields": {"type": "field", "hash": True},
3977
+ }
3978
+
3979
+ def __init__(
3980
+ self,
3981
+ *args: Any,
3982
+ analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
3983
+ boost: Union[float, "DefaultType"] = DEFAULT,
3984
+ eager_global_ordinals: Union[bool, "DefaultType"] = DEFAULT,
3985
+ fielddata: Union[bool, "DefaultType"] = DEFAULT,
3986
+ fielddata_frequency_filter: Union[
3987
+ "types.FielddataFrequencyFilter", Dict[str, Any], "DefaultType"
3988
+ ] = DEFAULT,
3989
+ index: Union[bool, "DefaultType"] = DEFAULT,
3990
+ index_options: Union[
3991
+ Literal["docs", "freqs", "positions", "offsets"], "DefaultType"
3992
+ ] = DEFAULT,
3993
+ index_phrases: Union[bool, "DefaultType"] = DEFAULT,
3994
+ index_prefixes: Union[
3995
+ "types.TextIndexPrefixes", None, Dict[str, Any], "DefaultType"
3996
+ ] = DEFAULT,
3997
+ norms: Union[bool, "DefaultType"] = DEFAULT,
3998
+ position_increment_gap: Union[int, "DefaultType"] = DEFAULT,
3999
+ search_analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
4000
+ search_quote_analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
4001
+ similarity: Union[str, None, "DefaultType"] = DEFAULT,
4002
+ term_vector: Union[
4003
+ Literal[
4004
+ "no",
4005
+ "yes",
4006
+ "with_offsets",
4007
+ "with_positions",
4008
+ "with_positions_offsets",
4009
+ "with_positions_offsets_payloads",
4010
+ "with_positions_payloads",
4011
+ ],
4012
+ "DefaultType",
4013
+ ] = DEFAULT,
4014
+ copy_to: Union[
4015
+ Union[str, "InstrumentedField"],
4016
+ Sequence[Union[str, "InstrumentedField"]],
4017
+ "DefaultType",
4018
+ ] = DEFAULT,
4019
+ store: Union[bool, "DefaultType"] = DEFAULT,
4020
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
4021
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4022
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
4023
+ dynamic: Union[
4024
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
4025
+ ] = DEFAULT,
4026
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4027
+ synthetic_source_keep: Union[
4028
+ Literal["none", "arrays", "all"], "DefaultType"
4029
+ ] = DEFAULT,
4030
+ **kwargs: Any,
4031
+ ):
4032
+ if analyzer is not DEFAULT:
4033
+ kwargs["analyzer"] = analyzer
4034
+ if boost is not DEFAULT:
4035
+ kwargs["boost"] = boost
4036
+ if eager_global_ordinals is not DEFAULT:
4037
+ kwargs["eager_global_ordinals"] = eager_global_ordinals
4038
+ if fielddata is not DEFAULT:
4039
+ kwargs["fielddata"] = fielddata
4040
+ if fielddata_frequency_filter is not DEFAULT:
4041
+ kwargs["fielddata_frequency_filter"] = fielddata_frequency_filter
4042
+ if index is not DEFAULT:
4043
+ kwargs["index"] = index
4044
+ if index_options is not DEFAULT:
4045
+ kwargs["index_options"] = index_options
4046
+ if index_phrases is not DEFAULT:
4047
+ kwargs["index_phrases"] = index_phrases
4048
+ if index_prefixes is not DEFAULT:
4049
+ kwargs["index_prefixes"] = index_prefixes
4050
+ if norms is not DEFAULT:
4051
+ kwargs["norms"] = norms
4052
+ if position_increment_gap is not DEFAULT:
4053
+ kwargs["position_increment_gap"] = position_increment_gap
4054
+ if search_analyzer is not DEFAULT:
4055
+ kwargs["search_analyzer"] = search_analyzer
4056
+ if search_quote_analyzer is not DEFAULT:
4057
+ kwargs["search_quote_analyzer"] = search_quote_analyzer
4058
+ if similarity is not DEFAULT:
4059
+ kwargs["similarity"] = similarity
4060
+ if term_vector is not DEFAULT:
4061
+ kwargs["term_vector"] = term_vector
4062
+ if copy_to is not DEFAULT:
4063
+ kwargs["copy_to"] = str(copy_to)
4064
+ if store is not DEFAULT:
4065
+ kwargs["store"] = store
4066
+ if meta is not DEFAULT:
4067
+ kwargs["meta"] = meta
4068
+ if properties is not DEFAULT:
4069
+ kwargs["properties"] = properties
4070
+ if ignore_above is not DEFAULT:
4071
+ kwargs["ignore_above"] = ignore_above
4072
+ if dynamic is not DEFAULT:
4073
+ kwargs["dynamic"] = dynamic
4074
+ if fields is not DEFAULT:
4075
+ kwargs["fields"] = fields
4076
+ if synthetic_source_keep is not DEFAULT:
4077
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
4078
+ super().__init__(*args, **kwargs)
4079
+
4080
+
4081
+ class TokenCount(Field):
4082
+ """
4083
+ :arg analyzer:
4084
+ :arg boost:
4085
+ :arg index:
4086
+ :arg null_value:
4087
+ :arg enable_position_increments:
4088
+ :arg doc_values:
4089
+ :arg copy_to:
4090
+ :arg store:
4091
+ :arg meta: Metadata about the field.
4092
+ :arg properties:
4093
+ :arg ignore_above:
4094
+ :arg dynamic:
4095
+ :arg fields:
4096
+ :arg synthetic_source_keep:
4097
+ """
4098
+
4099
+ name = "token_count"
4100
+ _param_defs = {
4101
+ "analyzer": {"type": "analyzer"},
4102
+ "properties": {"type": "field", "hash": True},
4103
+ "fields": {"type": "field", "hash": True},
4104
+ }
4105
+
4106
+ def __init__(
4107
+ self,
4108
+ *args: Any,
4109
+ analyzer: Union[str, DslBase, "DefaultType"] = DEFAULT,
4110
+ boost: Union[float, "DefaultType"] = DEFAULT,
4111
+ index: Union[bool, "DefaultType"] = DEFAULT,
4112
+ null_value: Union[float, "DefaultType"] = DEFAULT,
4113
+ enable_position_increments: Union[bool, "DefaultType"] = DEFAULT,
4114
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
4115
+ copy_to: Union[
4116
+ Union[str, "InstrumentedField"],
4117
+ Sequence[Union[str, "InstrumentedField"]],
4118
+ "DefaultType",
4119
+ ] = DEFAULT,
4120
+ store: Union[bool, "DefaultType"] = DEFAULT,
4121
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
4122
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4123
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
4124
+ dynamic: Union[
4125
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
4126
+ ] = DEFAULT,
4127
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4128
+ synthetic_source_keep: Union[
4129
+ Literal["none", "arrays", "all"], "DefaultType"
4130
+ ] = DEFAULT,
4131
+ **kwargs: Any,
4132
+ ):
4133
+ if analyzer is not DEFAULT:
4134
+ kwargs["analyzer"] = analyzer
4135
+ if boost is not DEFAULT:
4136
+ kwargs["boost"] = boost
4137
+ if index is not DEFAULT:
4138
+ kwargs["index"] = index
4139
+ if null_value is not DEFAULT:
4140
+ kwargs["null_value"] = null_value
4141
+ if enable_position_increments is not DEFAULT:
4142
+ kwargs["enable_position_increments"] = enable_position_increments
4143
+ if doc_values is not DEFAULT:
4144
+ kwargs["doc_values"] = doc_values
4145
+ if copy_to is not DEFAULT:
4146
+ kwargs["copy_to"] = str(copy_to)
4147
+ if store is not DEFAULT:
4148
+ kwargs["store"] = store
4149
+ if meta is not DEFAULT:
4150
+ kwargs["meta"] = meta
4151
+ if properties is not DEFAULT:
4152
+ kwargs["properties"] = properties
4153
+ if ignore_above is not DEFAULT:
4154
+ kwargs["ignore_above"] = ignore_above
4155
+ if dynamic is not DEFAULT:
4156
+ kwargs["dynamic"] = dynamic
4157
+ if fields is not DEFAULT:
4158
+ kwargs["fields"] = fields
4159
+ if synthetic_source_keep is not DEFAULT:
4160
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
4161
+ super().__init__(*args, **kwargs)
4162
+
4163
+
4164
+ class UnsignedLong(Field):
4165
+ """
4166
+ :arg null_value:
4167
+ :arg boost:
4168
+ :arg coerce:
4169
+ :arg ignore_malformed:
4170
+ :arg index:
4171
+ :arg on_script_error:
4172
+ :arg script:
4173
+ :arg time_series_metric: For internal use by Elastic only. Marks the
4174
+ field as a time series dimension. Defaults to false.
4175
+ :arg time_series_dimension: For internal use by Elastic only. Marks
4176
+ the field as a time series dimension. Defaults to false.
4177
+ :arg doc_values:
4178
+ :arg copy_to:
4179
+ :arg store:
4180
+ :arg meta: Metadata about the field.
4181
+ :arg properties:
4182
+ :arg ignore_above:
4183
+ :arg dynamic:
4184
+ :arg fields:
4185
+ :arg synthetic_source_keep:
4186
+ """
4187
+
4188
+ name = "unsigned_long"
4189
+ _param_defs = {
4190
+ "properties": {"type": "field", "hash": True},
4191
+ "fields": {"type": "field", "hash": True},
4192
+ }
4193
+
4194
+ def __init__(
4195
+ self,
4196
+ *args: Any,
4197
+ null_value: Union[int, "DefaultType"] = DEFAULT,
4198
+ boost: Union[float, "DefaultType"] = DEFAULT,
4199
+ coerce: Union[bool, "DefaultType"] = DEFAULT,
4200
+ ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
4201
+ index: Union[bool, "DefaultType"] = DEFAULT,
4202
+ on_script_error: Union[Literal["fail", "continue"], "DefaultType"] = DEFAULT,
4203
+ script: Union["types.Script", Dict[str, Any], "DefaultType"] = DEFAULT,
4204
+ time_series_metric: Union[
4205
+ Literal["gauge", "counter", "summary", "histogram", "position"],
4206
+ "DefaultType",
4207
+ ] = DEFAULT,
4208
+ time_series_dimension: Union[bool, "DefaultType"] = DEFAULT,
4209
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
4210
+ copy_to: Union[
4211
+ Union[str, "InstrumentedField"],
4212
+ Sequence[Union[str, "InstrumentedField"]],
4213
+ "DefaultType",
4214
+ ] = DEFAULT,
4215
+ store: Union[bool, "DefaultType"] = DEFAULT,
4216
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
4217
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4218
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
4219
+ dynamic: Union[
4220
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
4221
+ ] = DEFAULT,
4222
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4223
+ synthetic_source_keep: Union[
4224
+ Literal["none", "arrays", "all"], "DefaultType"
4225
+ ] = DEFAULT,
4226
+ **kwargs: Any,
4227
+ ):
4228
+ if null_value is not DEFAULT:
4229
+ kwargs["null_value"] = null_value
4230
+ if boost is not DEFAULT:
4231
+ kwargs["boost"] = boost
4232
+ if coerce is not DEFAULT:
4233
+ kwargs["coerce"] = coerce
4234
+ if ignore_malformed is not DEFAULT:
4235
+ kwargs["ignore_malformed"] = ignore_malformed
4236
+ if index is not DEFAULT:
4237
+ kwargs["index"] = index
4238
+ if on_script_error is not DEFAULT:
4239
+ kwargs["on_script_error"] = on_script_error
4240
+ if script is not DEFAULT:
4241
+ kwargs["script"] = script
4242
+ if time_series_metric is not DEFAULT:
4243
+ kwargs["time_series_metric"] = time_series_metric
4244
+ if time_series_dimension is not DEFAULT:
4245
+ kwargs["time_series_dimension"] = time_series_dimension
4246
+ if doc_values is not DEFAULT:
4247
+ kwargs["doc_values"] = doc_values
4248
+ if copy_to is not DEFAULT:
4249
+ kwargs["copy_to"] = str(copy_to)
4250
+ if store is not DEFAULT:
4251
+ kwargs["store"] = store
4252
+ if meta is not DEFAULT:
4253
+ kwargs["meta"] = meta
4254
+ if properties is not DEFAULT:
4255
+ kwargs["properties"] = properties
4256
+ if ignore_above is not DEFAULT:
4257
+ kwargs["ignore_above"] = ignore_above
4258
+ if dynamic is not DEFAULT:
4259
+ kwargs["dynamic"] = dynamic
4260
+ if fields is not DEFAULT:
4261
+ kwargs["fields"] = fields
4262
+ if synthetic_source_keep is not DEFAULT:
4263
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
4264
+ super().__init__(*args, **kwargs)
4265
+
4266
+
4267
+ class Version(Field):
4268
+ """
4269
+ :arg doc_values:
4270
+ :arg copy_to:
4271
+ :arg store:
4272
+ :arg meta: Metadata about the field.
4273
+ :arg properties:
4274
+ :arg ignore_above:
4275
+ :arg dynamic:
4276
+ :arg fields:
4277
+ :arg synthetic_source_keep:
4278
+ """
4279
+
4280
+ name = "version"
4281
+ _param_defs = {
4282
+ "properties": {"type": "field", "hash": True},
4283
+ "fields": {"type": "field", "hash": True},
4284
+ }
4285
+
4286
+ def __init__(
4287
+ self,
4288
+ *args: Any,
4289
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
4290
+ copy_to: Union[
4291
+ Union[str, "InstrumentedField"],
4292
+ Sequence[Union[str, "InstrumentedField"]],
4293
+ "DefaultType",
4294
+ ] = DEFAULT,
4295
+ store: Union[bool, "DefaultType"] = DEFAULT,
4296
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
4297
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4298
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
4299
+ dynamic: Union[
4300
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
4301
+ ] = DEFAULT,
4302
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4303
+ synthetic_source_keep: Union[
4304
+ Literal["none", "arrays", "all"], "DefaultType"
4305
+ ] = DEFAULT,
4306
+ **kwargs: Any,
4307
+ ):
4308
+ if doc_values is not DEFAULT:
4309
+ kwargs["doc_values"] = doc_values
4310
+ if copy_to is not DEFAULT:
4311
+ kwargs["copy_to"] = str(copy_to)
4312
+ if store is not DEFAULT:
4313
+ kwargs["store"] = store
4314
+ if meta is not DEFAULT:
4315
+ kwargs["meta"] = meta
4316
+ if properties is not DEFAULT:
4317
+ kwargs["properties"] = properties
4318
+ if ignore_above is not DEFAULT:
4319
+ kwargs["ignore_above"] = ignore_above
4320
+ if dynamic is not DEFAULT:
4321
+ kwargs["dynamic"] = dynamic
4322
+ if fields is not DEFAULT:
4323
+ kwargs["fields"] = fields
4324
+ if synthetic_source_keep is not DEFAULT:
4325
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
4326
+ super().__init__(*args, **kwargs)
4327
+
4328
+
4329
+ class Wildcard(Field):
4330
+ """
4331
+ :arg null_value:
4332
+ :arg doc_values:
4333
+ :arg copy_to:
4334
+ :arg store:
4335
+ :arg meta: Metadata about the field.
4336
+ :arg properties:
4337
+ :arg ignore_above:
4338
+ :arg dynamic:
4339
+ :arg fields:
4340
+ :arg synthetic_source_keep:
4341
+ """
4342
+
4343
+ name = "wildcard"
4344
+ _param_defs = {
4345
+ "properties": {"type": "field", "hash": True},
4346
+ "fields": {"type": "field", "hash": True},
4347
+ }
4348
+
4349
+ def __init__(
4350
+ self,
4351
+ *args: Any,
4352
+ null_value: Union[str, "DefaultType"] = DEFAULT,
4353
+ doc_values: Union[bool, "DefaultType"] = DEFAULT,
4354
+ copy_to: Union[
4355
+ Union[str, "InstrumentedField"],
4356
+ Sequence[Union[str, "InstrumentedField"]],
4357
+ "DefaultType",
4358
+ ] = DEFAULT,
4359
+ store: Union[bool, "DefaultType"] = DEFAULT,
4360
+ meta: Union[Mapping[str, str], "DefaultType"] = DEFAULT,
4361
+ properties: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4362
+ ignore_above: Union[int, "DefaultType"] = DEFAULT,
4363
+ dynamic: Union[
4364
+ Literal["strict", "runtime", "true", "false"], bool, "DefaultType"
4365
+ ] = DEFAULT,
4366
+ fields: Union[Mapping[str, Field], "DefaultType"] = DEFAULT,
4367
+ synthetic_source_keep: Union[
4368
+ Literal["none", "arrays", "all"], "DefaultType"
4369
+ ] = DEFAULT,
4370
+ **kwargs: Any,
4371
+ ):
4372
+ if null_value is not DEFAULT:
4373
+ kwargs["null_value"] = null_value
4374
+ if doc_values is not DEFAULT:
4375
+ kwargs["doc_values"] = doc_values
4376
+ if copy_to is not DEFAULT:
4377
+ kwargs["copy_to"] = str(copy_to)
4378
+ if store is not DEFAULT:
4379
+ kwargs["store"] = store
4380
+ if meta is not DEFAULT:
4381
+ kwargs["meta"] = meta
4382
+ if properties is not DEFAULT:
4383
+ kwargs["properties"] = properties
4384
+ if ignore_above is not DEFAULT:
4385
+ kwargs["ignore_above"] = ignore_above
4386
+ if dynamic is not DEFAULT:
4387
+ kwargs["dynamic"] = dynamic
4388
+ if fields is not DEFAULT:
4389
+ kwargs["fields"] = fields
4390
+ if synthetic_source_keep is not DEFAULT:
4391
+ kwargs["synthetic_source_keep"] = synthetic_source_keep
4392
+ super().__init__(*args, **kwargs)