elasticsearch 8.18.0__py3-none-any.whl → 9.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. elasticsearch/_async/client/__init__.py +62 -277
  2. elasticsearch/_async/client/_base.py +1 -1
  3. elasticsearch/_async/client/async_search.py +6 -10
  4. elasticsearch/_async/client/autoscaling.py +4 -4
  5. elasticsearch/_async/client/cat.py +26 -33
  6. elasticsearch/_async/client/ccr.py +13 -13
  7. elasticsearch/_async/client/cluster.py +20 -20
  8. elasticsearch/_async/client/connector.py +44 -30
  9. elasticsearch/_async/client/dangling_indices.py +3 -3
  10. elasticsearch/_async/client/enrich.py +5 -5
  11. elasticsearch/_async/client/eql.py +4 -4
  12. elasticsearch/_async/client/esql.py +7 -11
  13. elasticsearch/_async/client/features.py +2 -2
  14. elasticsearch/_async/client/fleet.py +18 -20
  15. elasticsearch/_async/client/graph.py +1 -1
  16. elasticsearch/_async/client/ilm.py +18 -11
  17. elasticsearch/_async/client/indices.py +75 -163
  18. elasticsearch/_async/client/inference.py +132 -25
  19. elasticsearch/_async/client/ingest.py +12 -12
  20. elasticsearch/_async/client/license.py +7 -7
  21. elasticsearch/_async/client/logstash.py +3 -3
  22. elasticsearch/_async/client/migration.py +3 -3
  23. elasticsearch/_async/client/ml.py +80 -85
  24. elasticsearch/_async/client/monitoring.py +1 -1
  25. elasticsearch/_async/client/nodes.py +8 -8
  26. elasticsearch/_async/client/query_rules.py +8 -8
  27. elasticsearch/_async/client/rollup.py +8 -8
  28. elasticsearch/_async/client/search_application.py +10 -10
  29. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  30. elasticsearch/_async/client/security.py +71 -68
  31. elasticsearch/_async/client/shutdown.py +3 -3
  32. elasticsearch/_async/client/simulate.py +1 -1
  33. elasticsearch/_async/client/slm.py +9 -9
  34. elasticsearch/_async/client/snapshot.py +280 -130
  35. elasticsearch/_async/client/sql.py +6 -6
  36. elasticsearch/_async/client/ssl.py +1 -1
  37. elasticsearch/_async/client/synonyms.py +7 -7
  38. elasticsearch/_async/client/tasks.py +3 -3
  39. elasticsearch/_async/client/text_structure.py +4 -4
  40. elasticsearch/_async/client/transform.py +11 -11
  41. elasticsearch/_async/client/watcher.py +14 -14
  42. elasticsearch/_async/client/xpack.py +2 -2
  43. elasticsearch/_sync/client/__init__.py +62 -277
  44. elasticsearch/_sync/client/_base.py +1 -1
  45. elasticsearch/_sync/client/async_search.py +6 -10
  46. elasticsearch/_sync/client/autoscaling.py +4 -4
  47. elasticsearch/_sync/client/cat.py +26 -33
  48. elasticsearch/_sync/client/ccr.py +13 -13
  49. elasticsearch/_sync/client/cluster.py +20 -20
  50. elasticsearch/_sync/client/connector.py +44 -30
  51. elasticsearch/_sync/client/dangling_indices.py +3 -3
  52. elasticsearch/_sync/client/enrich.py +5 -5
  53. elasticsearch/_sync/client/eql.py +4 -4
  54. elasticsearch/_sync/client/esql.py +7 -11
  55. elasticsearch/_sync/client/features.py +2 -2
  56. elasticsearch/_sync/client/fleet.py +18 -20
  57. elasticsearch/_sync/client/graph.py +1 -1
  58. elasticsearch/_sync/client/ilm.py +18 -11
  59. elasticsearch/_sync/client/indices.py +75 -163
  60. elasticsearch/_sync/client/inference.py +132 -25
  61. elasticsearch/_sync/client/ingest.py +12 -12
  62. elasticsearch/_sync/client/license.py +7 -7
  63. elasticsearch/_sync/client/logstash.py +3 -3
  64. elasticsearch/_sync/client/migration.py +3 -3
  65. elasticsearch/_sync/client/ml.py +80 -85
  66. elasticsearch/_sync/client/monitoring.py +1 -1
  67. elasticsearch/_sync/client/nodes.py +8 -8
  68. elasticsearch/_sync/client/query_rules.py +8 -8
  69. elasticsearch/_sync/client/rollup.py +8 -8
  70. elasticsearch/_sync/client/search_application.py +10 -10
  71. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  72. elasticsearch/_sync/client/security.py +71 -68
  73. elasticsearch/_sync/client/shutdown.py +3 -3
  74. elasticsearch/_sync/client/simulate.py +1 -1
  75. elasticsearch/_sync/client/slm.py +9 -9
  76. elasticsearch/_sync/client/snapshot.py +280 -130
  77. elasticsearch/_sync/client/sql.py +6 -6
  78. elasticsearch/_sync/client/ssl.py +1 -1
  79. elasticsearch/_sync/client/synonyms.py +7 -7
  80. elasticsearch/_sync/client/tasks.py +3 -3
  81. elasticsearch/_sync/client/text_structure.py +4 -4
  82. elasticsearch/_sync/client/transform.py +11 -11
  83. elasticsearch/_sync/client/utils.py +0 -37
  84. elasticsearch/_sync/client/watcher.py +14 -14
  85. elasticsearch/_sync/client/xpack.py +2 -2
  86. elasticsearch/_version.py +1 -1
  87. elasticsearch/dsl/_async/search.py +7 -3
  88. elasticsearch/dsl/_sync/search.py +7 -3
  89. elasticsearch/dsl/aggs.py +11 -7
  90. elasticsearch/dsl/faceted_search_base.py +4 -4
  91. elasticsearch/dsl/field.py +139 -1
  92. elasticsearch/dsl/query.py +7 -1
  93. elasticsearch/dsl/search_base.py +16 -3
  94. elasticsearch/dsl/types.py +66 -84
  95. elasticsearch/dsl/wrappers.py +25 -0
  96. elasticsearch/exceptions.py +2 -0
  97. elasticsearch/helpers/vectorstore/_async/strategies.py +12 -12
  98. elasticsearch/helpers/vectorstore/_sync/strategies.py +12 -12
  99. {elasticsearch-8.18.0.dist-info → elasticsearch-9.0.1.dist-info}/METADATA +17 -29
  100. elasticsearch-9.0.1.dist-info/RECORD +162 -0
  101. elasticsearch-9.0.1.dist-info/licenses/LICENSE.txt +175 -0
  102. elasticsearch-9.0.1.dist-info/licenses/NOTICE.txt +559 -0
  103. elasticsearch/transport.py +0 -57
  104. elasticsearch-8.18.0.dist-info/RECORD +0 -161
  105. {elasticsearch-8.18.0.dist-info → elasticsearch-9.0.1.dist-info}/WHEEL +0 -0
  106. {elasticsearch-8.18.0.dist-info → elasticsearch-9.0.1.dist-info}/licenses/LICENSE +0 -0
  107. {elasticsearch-8.18.0.dist-info → elasticsearch-9.0.1.dist-info}/licenses/NOTICE +0 -0
@@ -437,7 +437,9 @@ class Object(Field):
437
437
  doc_class: Union[Type["InnerDoc"], "DefaultType"] = DEFAULT,
438
438
  *args: Any,
439
439
  enabled: Union[bool, "DefaultType"] = DEFAULT,
440
- subobjects: Union[bool, "DefaultType"] = DEFAULT,
440
+ subobjects: Union[
441
+ Literal["true", "false", "auto"], bool, "DefaultType"
442
+ ] = DEFAULT,
441
443
  copy_to: Union[
442
444
  Union[str, "InstrumentedField"],
443
445
  Sequence[Union[str, "InstrumentedField"]],
@@ -1109,6 +1111,56 @@ class ConstantKeyword(Field):
1109
1111
  super().__init__(*args, **kwargs)
1110
1112
 
1111
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
+
1112
1164
  class Date(Field):
1113
1165
  """
1114
1166
  :arg default_timezone: timezone that will be automatically used for tz-naive values
@@ -1118,6 +1170,8 @@ class Date(Field):
1118
1170
  :arg format:
1119
1171
  :arg ignore_malformed:
1120
1172
  :arg index:
1173
+ :arg script:
1174
+ :arg on_script_error:
1121
1175
  :arg null_value:
1122
1176
  :arg precision_step:
1123
1177
  :arg locale:
@@ -1150,6 +1204,8 @@ class Date(Field):
1150
1204
  format: Union[str, "DefaultType"] = DEFAULT,
1151
1205
  ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1152
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,
1153
1209
  null_value: Any = DEFAULT,
1154
1210
  precision_step: Union[int, "DefaultType"] = DEFAULT,
1155
1211
  locale: Union[str, "DefaultType"] = DEFAULT,
@@ -1182,6 +1238,10 @@ class Date(Field):
1182
1238
  kwargs["ignore_malformed"] = ignore_malformed
1183
1239
  if index is not DEFAULT:
1184
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
1185
1245
  if null_value is not DEFAULT:
1186
1246
  kwargs["null_value"] = null_value
1187
1247
  if precision_step is not DEFAULT:
@@ -1246,6 +1306,8 @@ class DateNanos(Field):
1246
1306
  :arg format:
1247
1307
  :arg ignore_malformed:
1248
1308
  :arg index:
1309
+ :arg script:
1310
+ :arg on_script_error:
1249
1311
  :arg null_value:
1250
1312
  :arg precision_step:
1251
1313
  :arg doc_values:
@@ -1272,6 +1334,8 @@ class DateNanos(Field):
1272
1334
  format: Union[str, "DefaultType"] = DEFAULT,
1273
1335
  ignore_malformed: Union[bool, "DefaultType"] = DEFAULT,
1274
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,
1275
1339
  null_value: Any = DEFAULT,
1276
1340
  precision_step: Union[int, "DefaultType"] = DEFAULT,
1277
1341
  doc_values: Union[bool, "DefaultType"] = DEFAULT,
@@ -1301,6 +1365,10 @@ class DateNanos(Field):
1301
1365
  kwargs["ignore_malformed"] = ignore_malformed
1302
1366
  if index is not DEFAULT:
1303
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
1304
1372
  if null_value is not DEFAULT:
1305
1373
  kwargs["null_value"] = null_value
1306
1374
  if precision_step is not DEFAULT:
@@ -3085,6 +3153,76 @@ class Nested(Object):
3085
3153
  super().__init__(*args, **kwargs)
3086
3154
 
3087
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
+
3088
3226
  class Percolator(Field):
3089
3227
  """
3090
3228
  :arg meta: Metadata about the field.
@@ -1083,6 +1083,8 @@ class Knn(Query):
1083
1083
  :arg filter: Filters for the kNN search query
1084
1084
  :arg similarity: The minimum similarity for a vector to be considered
1085
1085
  a match
1086
+ :arg rescore_vector: Apply oversampling and rescoring to quantized
1087
+ vectors *
1086
1088
  :arg boost: Floating point number used to decrease or increase the
1087
1089
  relevance scores of the query. Boost values are relative to the
1088
1090
  default value of 1.0. A boost value between 0 and 1.0 decreases
@@ -1108,6 +1110,9 @@ class Knn(Query):
1108
1110
  k: Union[int, "DefaultType"] = DEFAULT,
1109
1111
  filter: Union[Query, Sequence[Query], "DefaultType"] = DEFAULT,
1110
1112
  similarity: Union[float, "DefaultType"] = DEFAULT,
1113
+ rescore_vector: Union[
1114
+ "types.RescoreVector", Dict[str, Any], "DefaultType"
1115
+ ] = DEFAULT,
1111
1116
  boost: Union[float, "DefaultType"] = DEFAULT,
1112
1117
  _name: Union[str, "DefaultType"] = DEFAULT,
1113
1118
  **kwargs: Any,
@@ -1120,6 +1125,7 @@ class Knn(Query):
1120
1125
  k=k,
1121
1126
  filter=filter,
1122
1127
  similarity=similarity,
1128
+ rescore_vector=rescore_vector,
1123
1129
  boost=boost,
1124
1130
  _name=_name,
1125
1131
  **kwargs,
@@ -2650,7 +2656,7 @@ class Terms(Query):
2650
2656
  self,
2651
2657
  _field: Union[str, "InstrumentedField", "DefaultType"] = DEFAULT,
2652
2658
  _value: Union[
2653
- Sequence[Union[int, float, str, bool, None, Any]],
2659
+ Sequence[Union[int, float, str, bool, None]],
2654
2660
  "types.TermsLookup",
2655
2661
  Dict[str, Any],
2656
2662
  "DefaultType",
@@ -72,6 +72,9 @@ class QueryProxy(Generic[_S]):
72
72
  __bool__ = __nonzero__
73
73
 
74
74
  def __call__(self, *args: Any, **kwargs: Any) -> _S:
75
+ """
76
+ Add a query.
77
+ """
75
78
  s = self._search._clone()
76
79
 
77
80
  # we cannot use self._proxied since we just cloned self._search and
@@ -354,18 +357,22 @@ class SearchBase(Request[_R]):
354
357
  post_filter = ProxyDescriptor[Self]("post_filter")
355
358
  _response: Response[_R]
356
359
 
357
- def __init__(self, **kwargs: Any):
360
+ def __init__(
361
+ self,
362
+ using: AnyUsingType = "default",
363
+ index: Optional[Union[str, List[str]]] = None,
364
+ **kwargs: Any,
365
+ ):
358
366
  """
359
367
  Search request to elasticsearch.
360
368
 
361
369
  :arg using: `Elasticsearch` instance to use
362
370
  :arg index: limit the search to index
363
- :arg doc_type: only query this type.
364
371
 
365
372
  All the parameters supplied (or omitted) at creation type can be later
366
373
  overridden by methods (`using`, `index` and `doc_type` respectively).
367
374
  """
368
- super().__init__(**kwargs)
375
+ super().__init__(using=using, index=index, **kwargs)
369
376
 
370
377
  self.aggs = AggsProxy[_R](self)
371
378
  self._sort: List[Union[str, Dict[str, Dict[str, str]]]] = []
@@ -383,9 +390,15 @@ class SearchBase(Request[_R]):
383
390
  self._post_filter_proxy = QueryProxy(self, "post_filter")
384
391
 
385
392
  def filter(self, *args: Any, **kwargs: Any) -> Self:
393
+ """
394
+ Add a query in filter context.
395
+ """
386
396
  return self.query(Bool(filter=[Q(*args, **kwargs)]))
387
397
 
388
398
  def exclude(self, *args: Any, **kwargs: Any) -> Self:
399
+ """
400
+ Add a negative query in filter context.
401
+ """
389
402
  return self.query(Bool(filter=[~Q(*args, **kwargs)]))
390
403
 
391
404
  def __getitem__(self, n: Union[int, slice]) -> Self:
@@ -26,34 +26,6 @@ from .utils import AttrDict
26
26
  PipeSeparatedFlags = str
27
27
 
28
28
 
29
- class AggregationRange(AttrDict[Any]):
30
- """
31
- :arg from: Start of the range (inclusive).
32
- :arg key: Custom key to return the range with.
33
- :arg to: End of the range (exclusive).
34
- """
35
-
36
- from_: Union[float, None, DefaultType]
37
- key: Union[str, DefaultType]
38
- to: Union[float, None, DefaultType]
39
-
40
- def __init__(
41
- self,
42
- *,
43
- from_: Union[float, None, DefaultType] = DEFAULT,
44
- key: Union[str, DefaultType] = DEFAULT,
45
- to: Union[float, None, DefaultType] = DEFAULT,
46
- **kwargs: Any,
47
- ):
48
- if from_ is not DEFAULT:
49
- kwargs["from_"] = from_
50
- if key is not DEFAULT:
51
- kwargs["key"] = key
52
- if to is not DEFAULT:
53
- kwargs["to"] = to
54
- super().__init__(kwargs)
55
-
56
-
57
29
  class BucketCorrelationFunction(AttrDict[Any]):
58
30
  """
59
31
  :arg count_correlation: (required) The configuration to calculate a
@@ -334,34 +306,6 @@ class CustomCategorizeTextAnalyzer(AttrDict[Any]):
334
306
  super().__init__(kwargs)
335
307
 
336
308
 
337
- class DateRangeExpression(AttrDict[Any]):
338
- """
339
- :arg from: Start of the range (inclusive).
340
- :arg key: Custom key to return the range with.
341
- :arg to: End of the range (exclusive).
342
- """
343
-
344
- from_: Union[str, float, DefaultType]
345
- key: Union[str, DefaultType]
346
- to: Union[str, float, DefaultType]
347
-
348
- def __init__(
349
- self,
350
- *,
351
- from_: Union[str, float, DefaultType] = DEFAULT,
352
- key: Union[str, DefaultType] = DEFAULT,
353
- to: Union[str, float, DefaultType] = DEFAULT,
354
- **kwargs: Any,
355
- ):
356
- if from_ is not DEFAULT:
357
- kwargs["from_"] = from_
358
- if key is not DEFAULT:
359
- kwargs["key"] = key
360
- if to is not DEFAULT:
361
- kwargs["to"] = to
362
- super().__init__(kwargs)
363
-
364
-
365
309
  class DenseVectorIndexOptions(AttrDict[Any]):
366
310
  """
367
311
  :arg type: (required) The type of kNN algorithm to use.
@@ -380,15 +324,24 @@ class DenseVectorIndexOptions(AttrDict[Any]):
380
324
  `int4_flat` index types.
381
325
  :arg ef_construction: The number of candidates to track while
382
326
  assembling the list of nearest neighbors for each new node. Only
383
- applicable to `hnsw`, `int8_hnsw`, and `int4_hnsw` index types.
384
- Defaults to `100` if omitted.
327
+ applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`, and `int4_hnsw`
328
+ index types. Defaults to `100` if omitted.
385
329
  :arg m: The number of neighbors each node will be connected to in the
386
- HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, and
387
- `int4_hnsw` index types. Defaults to `16` if omitted.
330
+ HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`,
331
+ and `int4_hnsw` index types. Defaults to `16` if omitted.
388
332
  """
389
333
 
390
334
  type: Union[
391
- Literal["flat", "hnsw", "int4_flat", "int4_hnsw", "int8_flat", "int8_hnsw"],
335
+ Literal[
336
+ "bbq_flat",
337
+ "bbq_hnsw",
338
+ "flat",
339
+ "hnsw",
340
+ "int4_flat",
341
+ "int4_hnsw",
342
+ "int8_flat",
343
+ "int8_hnsw",
344
+ ],
392
345
  DefaultType,
393
346
  ]
394
347
  confidence_interval: Union[float, DefaultType]
@@ -399,7 +352,16 @@ class DenseVectorIndexOptions(AttrDict[Any]):
399
352
  self,
400
353
  *,
401
354
  type: Union[
402
- Literal["flat", "hnsw", "int4_flat", "int4_hnsw", "int8_flat", "int8_hnsw"],
355
+ Literal[
356
+ "bbq_flat",
357
+ "bbq_hnsw",
358
+ "flat",
359
+ "hnsw",
360
+ "int4_flat",
361
+ "int4_hnsw",
362
+ "int8_flat",
363
+ "int8_hnsw",
364
+ ],
403
365
  DefaultType,
404
366
  ] = DEFAULT,
405
367
  confidence_interval: Union[float, DefaultType] = DEFAULT,
@@ -591,6 +553,7 @@ class FieldSort(AttrDict[Any]):
591
553
  "completion",
592
554
  "nested",
593
555
  "object",
556
+ "passthrough",
594
557
  "version",
595
558
  "murmur3",
596
559
  "token_count",
@@ -617,6 +580,7 @@ class FieldSort(AttrDict[Any]):
617
580
  "shape",
618
581
  "histogram",
619
582
  "constant_keyword",
583
+ "counted_keyword",
620
584
  "aggregate_metric_double",
621
585
  "dense_vector",
622
586
  "semantic_text",
@@ -654,6 +618,7 @@ class FieldSort(AttrDict[Any]):
654
618
  "completion",
655
619
  "nested",
656
620
  "object",
621
+ "passthrough",
657
622
  "version",
658
623
  "murmur3",
659
624
  "token_count",
@@ -680,6 +645,7 @@ class FieldSort(AttrDict[Any]):
680
645
  "shape",
681
646
  "histogram",
682
647
  "constant_keyword",
648
+ "counted_keyword",
683
649
  "aggregate_metric_double",
684
650
  "dense_vector",
685
651
  "semantic_text",
@@ -2625,7 +2591,7 @@ class PercentageScoreHeuristic(AttrDict[Any]):
2625
2591
  class PinnedDoc(AttrDict[Any]):
2626
2592
  """
2627
2593
  :arg _id: (required) The unique document ID.
2628
- :arg _index: (required) The index that contains the document.
2594
+ :arg _index: The index that contains the document.
2629
2595
  """
2630
2596
 
2631
2597
  _id: Union[str, DefaultType]
@@ -2850,6 +2816,22 @@ class RegressionInferenceOptions(AttrDict[Any]):
2850
2816
  super().__init__(kwargs)
2851
2817
 
2852
2818
 
2819
+ class RescoreVector(AttrDict[Any]):
2820
+ """
2821
+ :arg oversample: (required) Applies the specified oversample factor to
2822
+ k on the approximate kNN search
2823
+ """
2824
+
2825
+ oversample: Union[float, DefaultType]
2826
+
2827
+ def __init__(
2828
+ self, *, oversample: Union[float, DefaultType] = DEFAULT, **kwargs: Any
2829
+ ):
2830
+ if oversample is not DEFAULT:
2831
+ kwargs["oversample"] = oversample
2832
+ super().__init__(kwargs)
2833
+
2834
+
2853
2835
  class ScoreSort(AttrDict[Any]):
2854
2836
  """
2855
2837
  :arg order:
@@ -2880,7 +2862,7 @@ class Script(AttrDict[Any]):
2880
2862
  :arg options:
2881
2863
  """
2882
2864
 
2883
- source: Union[str, DefaultType]
2865
+ source: Union[str, Dict[str, Any], DefaultType]
2884
2866
  id: Union[str, DefaultType]
2885
2867
  params: Union[Mapping[str, Any], DefaultType]
2886
2868
  lang: Union[Literal["painless", "expression", "mustache", "java"], DefaultType]
@@ -2889,7 +2871,7 @@ class Script(AttrDict[Any]):
2889
2871
  def __init__(
2890
2872
  self,
2891
2873
  *,
2892
- source: Union[str, DefaultType] = DEFAULT,
2874
+ source: Union[str, Dict[str, Any], DefaultType] = DEFAULT,
2893
2875
  id: Union[str, DefaultType] = DEFAULT,
2894
2876
  params: Union[Mapping[str, Any], DefaultType] = DEFAULT,
2895
2877
  lang: Union[
@@ -3488,14 +3470,14 @@ class SpanTermQuery(AttrDict[Any]):
3488
3470
  :arg _name:
3489
3471
  """
3490
3472
 
3491
- value: Union[str, DefaultType]
3473
+ value: Union[int, float, str, bool, None, DefaultType]
3492
3474
  boost: Union[float, DefaultType]
3493
3475
  _name: Union[str, DefaultType]
3494
3476
 
3495
3477
  def __init__(
3496
3478
  self,
3497
3479
  *,
3498
- value: Union[str, DefaultType] = DEFAULT,
3480
+ value: Union[int, float, str, bool, None, DefaultType] = DEFAULT,
3499
3481
  boost: Union[float, DefaultType] = DEFAULT,
3500
3482
  _name: Union[str, DefaultType] = DEFAULT,
3501
3483
  **kwargs: Any,
@@ -3613,7 +3595,7 @@ class TermQuery(AttrDict[Any]):
3613
3595
  :arg _name:
3614
3596
  """
3615
3597
 
3616
- value: Union[int, float, str, bool, None, Any, DefaultType]
3598
+ value: Union[int, float, str, bool, None, DefaultType]
3617
3599
  case_insensitive: Union[bool, DefaultType]
3618
3600
  boost: Union[float, DefaultType]
3619
3601
  _name: Union[str, DefaultType]
@@ -3621,7 +3603,7 @@ class TermQuery(AttrDict[Any]):
3621
3603
  def __init__(
3622
3604
  self,
3623
3605
  *,
3624
- value: Union[int, float, str, bool, None, Any, DefaultType] = DEFAULT,
3606
+ value: Union[int, float, str, bool, None, DefaultType] = DEFAULT,
3625
3607
  case_insensitive: Union[bool, DefaultType] = DEFAULT,
3626
3608
  boost: Union[float, DefaultType] = DEFAULT,
3627
3609
  _name: Union[str, DefaultType] = DEFAULT,
@@ -3712,7 +3694,7 @@ class TermsSetQuery(AttrDict[Any]):
3712
3694
  :arg _name:
3713
3695
  """
3714
3696
 
3715
- terms: Union[Sequence[str], DefaultType]
3697
+ terms: Union[Sequence[Union[int, float, str, bool, None]], DefaultType]
3716
3698
  minimum_should_match: Union[int, str, DefaultType]
3717
3699
  minimum_should_match_field: Union[str, InstrumentedField, DefaultType]
3718
3700
  minimum_should_match_script: Union["Script", Dict[str, Any], DefaultType]
@@ -3722,7 +3704,9 @@ class TermsSetQuery(AttrDict[Any]):
3722
3704
  def __init__(
3723
3705
  self,
3724
3706
  *,
3725
- terms: Union[Sequence[str], DefaultType] = DEFAULT,
3707
+ terms: Union[
3708
+ Sequence[Union[int, float, str, bool, None]], DefaultType
3709
+ ] = DEFAULT,
3726
3710
  minimum_should_match: Union[int, str, DefaultType] = DEFAULT,
3727
3711
  minimum_should_match_field: Union[
3728
3712
  str, InstrumentedField, DefaultType
@@ -4544,7 +4528,7 @@ class CompositeAggregate(AttrDict[Any]):
4544
4528
  :arg meta:
4545
4529
  """
4546
4530
 
4547
- after_key: Mapping[str, Union[int, float, str, bool, None, Any]]
4531
+ after_key: Mapping[str, Union[int, float, str, bool, None]]
4548
4532
  buckets: Sequence["CompositeBucket"]
4549
4533
  meta: Mapping[str, Any]
4550
4534
 
@@ -4559,7 +4543,7 @@ class CompositeBucket(AttrDict[Any]):
4559
4543
  :arg doc_count: (required)
4560
4544
  """
4561
4545
 
4562
- key: Mapping[str, Union[int, float, str, bool, None, Any]]
4546
+ key: Mapping[str, Union[int, float, str, bool, None]]
4563
4547
  doc_count: int
4564
4548
 
4565
4549
 
@@ -5235,9 +5219,7 @@ class Hit(AttrDict[Any]):
5235
5219
  matched_queries: Union[Sequence[str], Mapping[str, float]]
5236
5220
  nested: "NestedIdentity"
5237
5221
  ignored: Sequence[str]
5238
- ignored_field_values: Mapping[
5239
- str, Sequence[Union[int, float, str, bool, None, Any]]
5240
- ]
5222
+ ignored_field_values: Mapping[str, Sequence[Any]]
5241
5223
  shard: str
5242
5224
  node: str
5243
5225
  routing: str
@@ -5246,7 +5228,7 @@ class Hit(AttrDict[Any]):
5246
5228
  seq_no: int
5247
5229
  primary_term: int
5248
5230
  version: int
5249
- sort: Sequence[Union[int, float, str, bool, None, Any]]
5231
+ sort: Sequence[Union[int, float, str, bool, None]]
5250
5232
 
5251
5233
 
5252
5234
  class HitsMetadata(AttrDict[Any]):
@@ -5271,7 +5253,7 @@ class InferenceAggregate(AttrDict[Any]):
5271
5253
  :arg meta:
5272
5254
  """
5273
5255
 
5274
- value: Union[int, float, str, bool, None, Any]
5256
+ value: Union[int, float, str, bool, None]
5275
5257
  feature_importance: Sequence["InferenceFeatureImportance"]
5276
5258
  top_classes: Sequence["InferenceTopClassEntry"]
5277
5259
  warning: str
@@ -5307,7 +5289,7 @@ class InferenceTopClassEntry(AttrDict[Any]):
5307
5289
  :arg class_score: (required)
5308
5290
  """
5309
5291
 
5310
- class_name: Union[int, float, str, bool, None, Any]
5292
+ class_name: Union[int, float, str, bool, None]
5311
5293
  class_probability: float
5312
5294
  class_score: float
5313
5295
 
@@ -5636,7 +5618,7 @@ class MultiTermsBucket(AttrDict[Any]):
5636
5618
  :arg doc_count_error_upper_bound:
5637
5619
  """
5638
5620
 
5639
- key: Sequence[Union[int, float, str, bool, None, Any]]
5621
+ key: Sequence[Union[int, float, str, bool, None]]
5640
5622
  doc_count: int
5641
5623
  key_as_string: str
5642
5624
  doc_count_error_upper_bound: int
@@ -6187,7 +6169,7 @@ class StringTermsBucket(AttrDict[Any]):
6187
6169
  :arg doc_count_error_upper_bound:
6188
6170
  """
6189
6171
 
6190
- key: Union[int, float, str, bool, None, Any]
6172
+ key: Union[int, float, str, bool, None]
6191
6173
  doc_count: int
6192
6174
  doc_count_error_upper_bound: int
6193
6175
 
@@ -6291,7 +6273,7 @@ class TimeSeriesBucket(AttrDict[Any]):
6291
6273
  :arg doc_count: (required)
6292
6274
  """
6293
6275
 
6294
- key: Mapping[str, Union[int, float, str, bool, None, Any]]
6276
+ key: Mapping[str, Union[int, float, str, bool, None]]
6295
6277
  doc_count: int
6296
6278
 
6297
6279
 
@@ -6311,8 +6293,8 @@ class TopMetrics(AttrDict[Any]):
6311
6293
  :arg metrics: (required)
6312
6294
  """
6313
6295
 
6314
- sort: Sequence[Union[Union[int, float, str, bool, None, Any], None]]
6315
- metrics: Mapping[str, Union[Union[int, float, str, bool, None, Any], None]]
6296
+ sort: Sequence[Union[Union[int, float, str, bool, None], None]]
6297
+ metrics: Mapping[str, Union[Union[int, float, str, bool, None], None]]
6316
6298
 
6317
6299
 
6318
6300
  class TopMetricsAggregate(AttrDict[Any]):
@@ -18,6 +18,7 @@
18
18
  import operator
19
19
  from typing import (
20
20
  TYPE_CHECKING,
21
+ Any,
21
22
  Callable,
22
23
  ClassVar,
23
24
  Dict,
@@ -117,3 +118,27 @@ class Range(AttrDict[RangeValT]):
117
118
  if "gte" in self._d_:
118
119
  return self._d_["gte"], True
119
120
  return None, False
121
+
122
+
123
+ class AggregationRange(AttrDict[Any]):
124
+ """
125
+ :arg from: Start of the range (inclusive).
126
+ :arg key: Custom key to return the range with.
127
+ :arg to: End of the range (exclusive).
128
+ """
129
+
130
+ def __init__(
131
+ self,
132
+ *,
133
+ from_: Any = None,
134
+ key: Optional[str] = None,
135
+ to: Any = None,
136
+ **kwargs: Any,
137
+ ):
138
+ if from_ is not None:
139
+ kwargs["from_"] = from_
140
+ if key is not None:
141
+ kwargs["key"] = key
142
+ if to is not None:
143
+ kwargs["to"] = to
144
+ super().__init__(kwargs)
@@ -61,6 +61,7 @@ class ApiError(_ApiError):
61
61
  if self.body and isinstance(self.body, dict) and "error" in self.body:
62
62
  if isinstance(self.body["error"], dict):
63
63
  root_cause = self.body["error"]["root_cause"][0]
64
+ caused_by = self.body["error"].get("caused_by", {})
64
65
  cause = ", ".join(
65
66
  filter(
66
67
  None,
@@ -68,6 +69,7 @@ class ApiError(_ApiError):
68
69
  repr(root_cause["reason"]),
69
70
  root_cause.get("resource.id"),
70
71
  root_cause.get("resource.type"),
72
+ caused_by.get("reason"),
71
73
  ],
72
74
  )
73
75
  )