elasticsearch 9.1.1__py3-none-any.whl → 9.2.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 (76) hide show
  1. elasticsearch/_async/client/__init__.py +96 -44
  2. elasticsearch/_async/client/async_search.py +7 -0
  3. elasticsearch/_async/client/cat.py +489 -26
  4. elasticsearch/_async/client/cluster.py +9 -8
  5. elasticsearch/_async/client/connector.py +3 -3
  6. elasticsearch/_async/client/eql.py +7 -0
  7. elasticsearch/_async/client/esql.py +26 -3
  8. elasticsearch/_async/client/fleet.py +1 -5
  9. elasticsearch/_async/client/graph.py +1 -5
  10. elasticsearch/_async/client/ilm.py +2 -10
  11. elasticsearch/_async/client/indices.py +181 -37
  12. elasticsearch/_async/client/inference.py +291 -124
  13. elasticsearch/_async/client/ingest.py +8 -0
  14. elasticsearch/_async/client/license.py +4 -2
  15. elasticsearch/_async/client/logstash.py +3 -1
  16. elasticsearch/_async/client/ml.py +2 -2
  17. elasticsearch/_async/client/nodes.py +3 -5
  18. elasticsearch/_async/client/project.py +67 -0
  19. elasticsearch/_async/client/security.py +39 -0
  20. elasticsearch/_async/client/shutdown.py +5 -15
  21. elasticsearch/_async/client/simulate.py +8 -0
  22. elasticsearch/_async/client/slm.py +1 -5
  23. elasticsearch/_async/client/snapshot.py +20 -10
  24. elasticsearch/_async/client/sql.py +7 -0
  25. elasticsearch/_async/client/streams.py +185 -0
  26. elasticsearch/_async/client/watcher.py +1 -5
  27. elasticsearch/_async/helpers.py +74 -12
  28. elasticsearch/_sync/client/__init__.py +96 -44
  29. elasticsearch/_sync/client/async_search.py +7 -0
  30. elasticsearch/_sync/client/cat.py +489 -26
  31. elasticsearch/_sync/client/cluster.py +9 -8
  32. elasticsearch/_sync/client/connector.py +3 -3
  33. elasticsearch/_sync/client/eql.py +7 -0
  34. elasticsearch/_sync/client/esql.py +26 -3
  35. elasticsearch/_sync/client/fleet.py +1 -5
  36. elasticsearch/_sync/client/graph.py +1 -5
  37. elasticsearch/_sync/client/ilm.py +2 -10
  38. elasticsearch/_sync/client/indices.py +181 -37
  39. elasticsearch/_sync/client/inference.py +291 -124
  40. elasticsearch/_sync/client/ingest.py +8 -0
  41. elasticsearch/_sync/client/license.py +4 -2
  42. elasticsearch/_sync/client/logstash.py +3 -1
  43. elasticsearch/_sync/client/ml.py +2 -2
  44. elasticsearch/_sync/client/nodes.py +3 -5
  45. elasticsearch/_sync/client/project.py +67 -0
  46. elasticsearch/_sync/client/security.py +39 -0
  47. elasticsearch/_sync/client/shutdown.py +5 -15
  48. elasticsearch/_sync/client/simulate.py +8 -0
  49. elasticsearch/_sync/client/slm.py +1 -5
  50. elasticsearch/_sync/client/snapshot.py +20 -10
  51. elasticsearch/_sync/client/sql.py +7 -0
  52. elasticsearch/_sync/client/streams.py +185 -0
  53. elasticsearch/_sync/client/watcher.py +1 -5
  54. elasticsearch/_version.py +2 -1
  55. elasticsearch/client.py +4 -0
  56. elasticsearch/compat.py +30 -1
  57. elasticsearch/dsl/__init__.py +28 -0
  58. elasticsearch/dsl/_async/document.py +2 -1
  59. elasticsearch/dsl/_sync/document.py +2 -1
  60. elasticsearch/dsl/aggs.py +97 -0
  61. elasticsearch/dsl/document_base.py +53 -13
  62. elasticsearch/dsl/field.py +21 -2
  63. elasticsearch/dsl/pydantic.py +152 -0
  64. elasticsearch/dsl/query.py +5 -1
  65. elasticsearch/dsl/response/__init__.py +3 -0
  66. elasticsearch/dsl/search_base.py +5 -1
  67. elasticsearch/dsl/types.py +226 -14
  68. elasticsearch/esql/esql.py +331 -41
  69. elasticsearch/esql/functions.py +88 -0
  70. elasticsearch/helpers/__init__.py +10 -1
  71. elasticsearch/helpers/actions.py +106 -33
  72. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/METADATA +27 -5
  73. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/RECORD +76 -71
  74. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/WHEEL +0 -0
  75. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/LICENSE +0 -0
  76. {elasticsearch-9.1.1.dist-info → elasticsearch-9.2.0.dist-info}/licenses/NOTICE +0 -0
@@ -1079,6 +1079,8 @@ class Knn(Query):
1079
1079
  a query_vector_builder or query_vector, but not both.
1080
1080
  :arg num_candidates: The number of nearest neighbor candidates to
1081
1081
  consider per shard
1082
+ :arg visit_percentage: The percentage of vectors to explore per shard
1083
+ while doing knn search with bbq_disk
1082
1084
  :arg k: The final number of nearest neighbors to return as top hits
1083
1085
  :arg filter: Filters for the kNN search query
1084
1086
  :arg similarity: The minimum similarity for a vector to be considered
@@ -1107,6 +1109,7 @@ class Knn(Query):
1107
1109
  "types.QueryVectorBuilder", Dict[str, Any], "DefaultType"
1108
1110
  ] = DEFAULT,
1109
1111
  num_candidates: Union[int, "DefaultType"] = DEFAULT,
1112
+ visit_percentage: Union[float, "DefaultType"] = DEFAULT,
1110
1113
  k: Union[int, "DefaultType"] = DEFAULT,
1111
1114
  filter: Union[Query, Sequence[Query], "DefaultType"] = DEFAULT,
1112
1115
  similarity: Union[float, "DefaultType"] = DEFAULT,
@@ -1122,6 +1125,7 @@ class Knn(Query):
1122
1125
  query_vector=query_vector,
1123
1126
  query_vector_builder=query_vector_builder,
1124
1127
  num_candidates=num_candidates,
1128
+ visit_percentage=visit_percentage,
1125
1129
  k=k,
1126
1130
  filter=filter,
1127
1131
  similarity=similarity,
@@ -1433,7 +1437,7 @@ class MoreLikeThis(Query):
1433
1437
  ] = DEFAULT,
1434
1438
  version: Union[int, "DefaultType"] = DEFAULT,
1435
1439
  version_type: Union[
1436
- Literal["internal", "external", "external_gte", "force"], "DefaultType"
1440
+ Literal["internal", "external", "external_gte"], "DefaultType"
1437
1441
  ] = DEFAULT,
1438
1442
  boost: Union[float, "DefaultType"] = DEFAULT,
1439
1443
  _name: Union[str, "DefaultType"] = DEFAULT,
@@ -233,10 +233,13 @@ AggregateResponseType = Union[
233
233
  "types.SimpleValueAggregate",
234
234
  "types.DerivativeAggregate",
235
235
  "types.BucketMetricValueAggregate",
236
+ "types.ChangePointAggregate",
236
237
  "types.StatsAggregate",
237
238
  "types.StatsBucketAggregate",
238
239
  "types.ExtendedStatsAggregate",
239
240
  "types.ExtendedStatsBucketAggregate",
241
+ "types.CartesianBoundsAggregate",
242
+ "types.CartesianCentroidAggregate",
240
243
  "types.GeoBoundsAggregate",
241
244
  "types.GeoCentroidAggregate",
242
245
  "types.HistogramAggregate",
@@ -721,14 +721,18 @@ class SearchBase(Request[_R]):
721
721
 
722
722
  def ensure_strings(
723
723
  fields: Union[
724
+ bool,
724
725
  str,
725
726
  "InstrumentedField",
726
727
  List[Union[str, "InstrumentedField"]],
727
728
  Dict[str, List[Union[str, "InstrumentedField"]]],
728
729
  ],
729
- ) -> Union[str, List[str], Dict[str, List[str]]]:
730
+ ) -> Union[bool, str, List[str], Dict[str, List[str]]]:
730
731
  if isinstance(fields, dict):
731
732
  return {k: ensure_strings(v) for k, v in fields.items()}
733
+ elif isinstance(fields, bool):
734
+ # boolean settings should stay the way they are
735
+ return fields
732
736
  elif not isinstance(fields, (str, InstrumentedField)):
733
737
  # we assume that if `fields` is not a any of [dict, str,
734
738
  # InstrumentedField] then it is an iterable of strings or
@@ -151,9 +151,10 @@ class ChunkingSettings(AttrDict[Any]):
151
151
  strategies in the linked documentation. Defaults to `sentence` if
152
152
  omitted.
153
153
  :arg max_chunk_size: (required) The maximum size of a chunk in words.
154
- This value cannot be higher than `300` or lower than `20` (for
155
- `sentence` strategy) or `10` (for `word` strategy). Defaults to
156
- `250` if omitted.
154
+ This value cannot be lower than `20` (for `sentence` strategy) or
155
+ `10` (for `word` strategy). This value should not exceed the
156
+ window size for the associated model. Defaults to `250` if
157
+ omitted.
157
158
  :arg separator_group: Only applicable to the `recursive` strategy and
158
159
  required when using it. Sets a predefined list of separators in
159
160
  the saved chunking settings based on the selected text type.
@@ -397,14 +398,17 @@ class DenseVectorIndexOptions(AttrDict[Any]):
397
398
  HNSW graph. Only applicable to `hnsw`, `int8_hnsw`, `bbq_hnsw`,
398
399
  and `int4_hnsw` index types. Defaults to `16` if omitted.
399
400
  :arg rescore_vector: The rescore vector options. This is only
400
- applicable to `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`, `bbq_flat`,
401
- `int4_flat`, and `int8_flat` index types.
401
+ applicable to `bbq_disk`, `bbq_hnsw`, `int4_hnsw`, `int8_hnsw`,
402
+ `bbq_flat`, `int4_flat`, and `int8_flat` index types.
403
+ :arg on_disk_rescore: `true` if vector rescoring should be done on-
404
+ disk Only applicable to `bbq_hnsw`
402
405
  """
403
406
 
404
407
  type: Union[
405
408
  Literal[
406
409
  "bbq_flat",
407
410
  "bbq_hnsw",
411
+ "bbq_disk",
408
412
  "flat",
409
413
  "hnsw",
410
414
  "int4_flat",
@@ -420,6 +424,7 @@ class DenseVectorIndexOptions(AttrDict[Any]):
420
424
  rescore_vector: Union[
421
425
  "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType
422
426
  ]
427
+ on_disk_rescore: Union[bool, DefaultType]
423
428
 
424
429
  def __init__(
425
430
  self,
@@ -428,6 +433,7 @@ class DenseVectorIndexOptions(AttrDict[Any]):
428
433
  Literal[
429
434
  "bbq_flat",
430
435
  "bbq_hnsw",
436
+ "bbq_disk",
431
437
  "flat",
432
438
  "hnsw",
433
439
  "int4_flat",
@@ -443,6 +449,7 @@ class DenseVectorIndexOptions(AttrDict[Any]):
443
449
  rescore_vector: Union[
444
450
  "DenseVectorIndexOptionsRescoreVector", Dict[str, Any], DefaultType
445
451
  ] = DEFAULT,
452
+ on_disk_rescore: Union[bool, DefaultType] = DEFAULT,
446
453
  **kwargs: Any,
447
454
  ):
448
455
  if type is not DEFAULT:
@@ -455,6 +462,8 @@ class DenseVectorIndexOptions(AttrDict[Any]):
455
462
  kwargs["m"] = m
456
463
  if rescore_vector is not DEFAULT:
457
464
  kwargs["rescore_vector"] = rescore_vector
465
+ if on_disk_rescore is not DEFAULT:
466
+ kwargs["on_disk_rescore"] = on_disk_rescore
458
467
  super().__init__(kwargs)
459
468
 
460
469
 
@@ -2326,9 +2335,7 @@ class LikeDocument(AttrDict[Any]):
2326
2335
  per_field_analyzer: Union[Mapping[Union[str, InstrumentedField], str], DefaultType]
2327
2336
  routing: Union[str, DefaultType]
2328
2337
  version: Union[int, DefaultType]
2329
- version_type: Union[
2330
- Literal["internal", "external", "external_gte", "force"], DefaultType
2331
- ]
2338
+ version_type: Union[Literal["internal", "external", "external_gte"], DefaultType]
2332
2339
 
2333
2340
  def __init__(
2334
2341
  self,
@@ -2343,7 +2350,7 @@ class LikeDocument(AttrDict[Any]):
2343
2350
  routing: Union[str, DefaultType] = DEFAULT,
2344
2351
  version: Union[int, DefaultType] = DEFAULT,
2345
2352
  version_type: Union[
2346
- Literal["internal", "external", "external_gte", "force"], DefaultType
2353
+ Literal["internal", "external", "external_gte"], DefaultType
2347
2354
  ] = DEFAULT,
2348
2355
  **kwargs: Any,
2349
2356
  ):
@@ -2774,6 +2781,31 @@ class NumericFielddata(AttrDict[Any]):
2774
2781
  super().__init__(kwargs)
2775
2782
 
2776
2783
 
2784
+ class PValueHeuristic(AttrDict[Any]):
2785
+ """
2786
+ :arg background_is_superset:
2787
+ :arg normalize_above: Should the results be normalized when above the
2788
+ given value. Allows for consistent significance results at various
2789
+ scales. Note: `0` is a special value which means no normalization
2790
+ """
2791
+
2792
+ background_is_superset: Union[bool, DefaultType]
2793
+ normalize_above: Union[int, DefaultType]
2794
+
2795
+ def __init__(
2796
+ self,
2797
+ *,
2798
+ background_is_superset: Union[bool, DefaultType] = DEFAULT,
2799
+ normalize_above: Union[int, DefaultType] = DEFAULT,
2800
+ **kwargs: Any,
2801
+ ):
2802
+ if background_is_superset is not DEFAULT:
2803
+ kwargs["background_is_superset"] = background_is_superset
2804
+ if normalize_above is not DEFAULT:
2805
+ kwargs["normalize_above"] = normalize_above
2806
+ super().__init__(kwargs)
2807
+
2808
+
2777
2809
  class PercentageScoreHeuristic(AttrDict[Any]):
2778
2810
  pass
2779
2811
 
@@ -3164,6 +3196,33 @@ class ScriptedHeuristic(AttrDict[Any]):
3164
3196
  super().__init__(kwargs)
3165
3197
 
3166
3198
 
3199
+ class SemanticTextIndexOptions(AttrDict[Any]):
3200
+ """
3201
+ :arg dense_vector:
3202
+ :arg sparse_vector:
3203
+ """
3204
+
3205
+ dense_vector: Union["DenseVectorIndexOptions", Dict[str, Any], DefaultType]
3206
+ sparse_vector: Union["SparseVectorIndexOptions", Dict[str, Any], DefaultType]
3207
+
3208
+ def __init__(
3209
+ self,
3210
+ *,
3211
+ dense_vector: Union[
3212
+ "DenseVectorIndexOptions", Dict[str, Any], DefaultType
3213
+ ] = DEFAULT,
3214
+ sparse_vector: Union[
3215
+ "SparseVectorIndexOptions", Dict[str, Any], DefaultType
3216
+ ] = DEFAULT,
3217
+ **kwargs: Any,
3218
+ ):
3219
+ if dense_vector is not DEFAULT:
3220
+ kwargs["dense_vector"] = dense_vector
3221
+ if sparse_vector is not DEFAULT:
3222
+ kwargs["sparse_vector"] = sparse_vector
3223
+ super().__init__(kwargs)
3224
+
3225
+
3167
3226
  class ShapeFieldQuery(AttrDict[Any]):
3168
3227
  """
3169
3228
  :arg indexed_shape: Queries using a pre-indexed shape.
@@ -4009,24 +4068,25 @@ class TestPopulation(AttrDict[Any]):
4009
4068
 
4010
4069
  class TextEmbedding(AttrDict[Any]):
4011
4070
  """
4012
- :arg model_id: (required)
4013
4071
  :arg model_text: (required)
4072
+ :arg model_id: Model ID is required for all dense_vector fields but
4073
+ may be inferred for semantic_text fields
4014
4074
  """
4015
4075
 
4016
- model_id: Union[str, DefaultType]
4017
4076
  model_text: Union[str, DefaultType]
4077
+ model_id: Union[str, DefaultType]
4018
4078
 
4019
4079
  def __init__(
4020
4080
  self,
4021
4081
  *,
4022
- model_id: Union[str, DefaultType] = DEFAULT,
4023
4082
  model_text: Union[str, DefaultType] = DEFAULT,
4083
+ model_id: Union[str, DefaultType] = DEFAULT,
4024
4084
  **kwargs: Any,
4025
4085
  ):
4026
- if model_id is not DEFAULT:
4027
- kwargs["model_id"] = model_id
4028
4086
  if model_text is not DEFAULT:
4029
4087
  kwargs["model_text"] = model_text
4088
+ if model_id is not DEFAULT:
4089
+ kwargs["model_id"] = model_id
4030
4090
  super().__init__(kwargs)
4031
4091
 
4032
4092
 
@@ -4659,6 +4719,82 @@ class CardinalityAggregate(AttrDict[Any]):
4659
4719
  meta: Mapping[str, Any]
4660
4720
 
4661
4721
 
4722
+ class CartesianBoundsAggregate(AttrDict[Any]):
4723
+ """
4724
+ :arg bounds:
4725
+ :arg meta:
4726
+ """
4727
+
4728
+ bounds: "TopLeftBottomRightGeoBounds"
4729
+ meta: Mapping[str, Any]
4730
+
4731
+
4732
+ class CartesianCentroidAggregate(AttrDict[Any]):
4733
+ """
4734
+ :arg count: (required)
4735
+ :arg location:
4736
+ :arg meta:
4737
+ """
4738
+
4739
+ count: int
4740
+ location: "CartesianPoint"
4741
+ meta: Mapping[str, Any]
4742
+
4743
+
4744
+ class CartesianPoint(AttrDict[Any]):
4745
+ """
4746
+ :arg x: (required)
4747
+ :arg y: (required)
4748
+ """
4749
+
4750
+ x: float
4751
+ y: float
4752
+
4753
+
4754
+ class ChangePointAggregate(AttrDict[Any]):
4755
+ """
4756
+ :arg type: (required)
4757
+ :arg bucket:
4758
+ :arg meta:
4759
+ """
4760
+
4761
+ type: "ChangeType"
4762
+ bucket: "ChangePointBucket"
4763
+ meta: Mapping[str, Any]
4764
+
4765
+
4766
+ class ChangePointBucket(AttrDict[Any]):
4767
+ """
4768
+ :arg key: (required)
4769
+ :arg doc_count: (required)
4770
+ """
4771
+
4772
+ key: Union[int, float, str, bool, None]
4773
+ doc_count: int
4774
+
4775
+
4776
+ class ChangeType(AttrDict[Any]):
4777
+ """
4778
+ :arg dip:
4779
+ :arg distribution_change:
4780
+ :arg indeterminable:
4781
+ :arg non_stationary:
4782
+ :arg spike:
4783
+ :arg stationary:
4784
+ :arg step_change:
4785
+ :arg trend_change:
4786
+ """
4787
+
4788
+ dip: "Dip"
4789
+ distribution_change: "DistributionChange"
4790
+ indeterminable: "Indeterminable"
4791
+ non_stationary: "NonStationary"
4792
+ spike: "Spike"
4793
+ stationary: "Stationary"
4794
+ step_change: "StepChange"
4795
+ trend_change: "TrendChange"
4796
+
4797
+
4662
4798
  class ChildrenAggregate(AttrDict[Any]):
4663
4799
  """
4664
4800
  :arg doc_count: (required)
@@ -4936,6 +5072,26 @@ class DfsStatisticsProfile(AttrDict[Any]):
4936
5072
  children: Sequence["DfsStatisticsProfile"]
4937
5073
 
4938
5074
 
5075
+ class Dip(AttrDict[Any]):
5076
+ """
5077
+ :arg p_value: (required)
5078
+ :arg change_point: (required)
5079
+ """
5080
+
5081
+ p_value: float
5082
+ change_point: int
5083
+
5084
+
5085
+ class DistributionChange(AttrDict[Any]):
5086
+ """
5087
+ :arg p_value: (required)
5088
+ :arg change_point: (required)
5089
+ """
5090
+
5091
+ p_value: float
5092
+ change_point: int
5093
+
5094
+
4939
5095
  class DoubleTermsAggregate(AttrDict[Any]):
4940
5096
  """
4941
5097
  Result of a `terms` aggregation when the field is some kind of decimal
@@ -5497,6 +5653,14 @@ class HitsMetadata(AttrDict[Any]):
5497
5653
  max_score: Union[float, None]
5498
5654
 
5499
5655
 
5656
+ class Indeterminable(AttrDict[Any]):
5657
+ """
5658
+ :arg reason: (required)
5659
+ """
5660
+
5661
+ reason: str
5662
+
5663
+
5500
5664
  class InferenceAggregate(AttrDict[Any]):
5501
5665
  """
5502
5666
  :arg value:
@@ -5899,6 +6063,18 @@ class NestedIdentity(AttrDict[Any]):
5899
6063
  _nested: "NestedIdentity"
5900
6064
 
5901
6065
 
6066
+ class NonStationary(AttrDict[Any]):
6067
+ """
6068
+ :arg p_value: (required)
6069
+ :arg r_value: (required)
6070
+ :arg trend: (required)
6071
+ """
6072
+
6073
+ p_value: float
6074
+ r_value: float
6075
+ trend: str
6076
+
6077
+
5902
6078
  class ParentAggregate(AttrDict[Any]):
5903
6079
  """
5904
6080
  :arg doc_count: (required)
@@ -6256,6 +6432,16 @@ class SimpleValueAggregate(AttrDict[Any]):
6256
6432
  meta: Mapping[str, Any]
6257
6433
 
6258
6434
 
6435
+ class Spike(AttrDict[Any]):
6436
+ """
6437
+ :arg p_value: (required)
6438
+ :arg change_point: (required)
6439
+ """
6440
+
6441
+ p_value: float
6442
+ change_point: int
6443
+
6444
+
6259
6445
  class StandardDeviationBounds(AttrDict[Any]):
6260
6446
  """
6261
6447
  :arg upper: (required)
@@ -6292,6 +6478,10 @@ class StandardDeviationBoundsAsString(AttrDict[Any]):
6292
6478
  lower_sampling: str
6293
6479
 
6294
6480
 
6481
+ class Stationary(AttrDict[Any]):
6482
+ pass
6483
+
6484
+
6295
6485
  class StatsAggregate(AttrDict[Any]):
6296
6486
  """
6297
6487
  Statistics aggregation result. `min`, `max` and `avg` are missing if
@@ -6347,6 +6537,16 @@ class StatsBucketAggregate(AttrDict[Any]):
6347
6537
  meta: Mapping[str, Any]
6348
6538
 
6349
6539
 
6540
+ class StepChange(AttrDict[Any]):
6541
+ """
6542
+ :arg p_value: (required)
6543
+ :arg change_point: (required)
6544
+ """
6545
+
6546
+ p_value: float
6547
+ change_point: int
6548
+
6549
+
6350
6550
  class StringRareTermsAggregate(AttrDict[Any]):
6351
6551
  """
6352
6552
  Result of the `rare_terms` aggregation when the field is a string.
@@ -6578,6 +6778,18 @@ class TotalHits(AttrDict[Any]):
6578
6778
  value: int
6579
6779
 
6580
6780
 
6781
+ class TrendChange(AttrDict[Any]):
6782
+ """
6783
+ :arg p_value: (required)
6784
+ :arg r_value: (required)
6785
+ :arg change_point: (required)
6786
+ """
6787
+
6788
+ p_value: float
6789
+ r_value: float
6790
+ change_point: int
6791
+
6792
+
6581
6793
  class UnmappedRareTermsAggregate(AttrDict[Any]):
6582
6794
  """
6583
6795
  Result of a `rare_terms` aggregation when the field is unmapped.