elasticsearch 8.17.2__py3-none-any.whl → 8.18.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 (137) hide show
  1. elasticsearch/_async/client/__init__.py +174 -79
  2. elasticsearch/_async/client/_base.py +0 -1
  3. elasticsearch/_async/client/async_search.py +12 -8
  4. elasticsearch/_async/client/autoscaling.py +4 -4
  5. elasticsearch/_async/client/cat.py +26 -26
  6. elasticsearch/_async/client/ccr.py +186 -72
  7. elasticsearch/_async/client/cluster.py +38 -19
  8. elasticsearch/_async/client/connector.py +30 -30
  9. elasticsearch/_async/client/dangling_indices.py +3 -3
  10. elasticsearch/_async/client/enrich.py +26 -5
  11. elasticsearch/_async/client/eql.py +32 -4
  12. elasticsearch/_async/client/esql.py +62 -6
  13. elasticsearch/_async/client/features.py +12 -2
  14. elasticsearch/_async/client/fleet.py +8 -2
  15. elasticsearch/_async/client/graph.py +1 -1
  16. elasticsearch/_async/client/ilm.py +23 -22
  17. elasticsearch/_async/client/indices.py +424 -132
  18. elasticsearch/_async/client/inference.py +1906 -61
  19. elasticsearch/_async/client/ingest.py +32 -38
  20. elasticsearch/_async/client/license.py +51 -16
  21. elasticsearch/_async/client/logstash.py +3 -3
  22. elasticsearch/_async/client/migration.py +3 -3
  23. elasticsearch/_async/client/ml.py +144 -115
  24. elasticsearch/_async/client/monitoring.py +1 -1
  25. elasticsearch/_async/client/nodes.py +9 -27
  26. elasticsearch/_async/client/query_rules.py +8 -8
  27. elasticsearch/_async/client/rollup.py +8 -8
  28. elasticsearch/_async/client/search_application.py +13 -13
  29. elasticsearch/_async/client/searchable_snapshots.py +4 -4
  30. elasticsearch/_async/client/security.py +71 -71
  31. elasticsearch/_async/client/shutdown.py +3 -10
  32. elasticsearch/_async/client/simulate.py +6 -6
  33. elasticsearch/_async/client/slm.py +9 -9
  34. elasticsearch/_async/client/snapshot.py +13 -17
  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 -9
  39. elasticsearch/_async/client/text_structure.py +4 -4
  40. elasticsearch/_async/client/transform.py +30 -28
  41. elasticsearch/_async/client/watcher.py +22 -14
  42. elasticsearch/_async/client/xpack.py +2 -2
  43. elasticsearch/_async/helpers.py +0 -1
  44. elasticsearch/_sync/client/__init__.py +174 -79
  45. elasticsearch/_sync/client/_base.py +0 -1
  46. elasticsearch/_sync/client/async_search.py +12 -8
  47. elasticsearch/_sync/client/autoscaling.py +4 -4
  48. elasticsearch/_sync/client/cat.py +26 -26
  49. elasticsearch/_sync/client/ccr.py +186 -72
  50. elasticsearch/_sync/client/cluster.py +38 -19
  51. elasticsearch/_sync/client/connector.py +30 -30
  52. elasticsearch/_sync/client/dangling_indices.py +3 -3
  53. elasticsearch/_sync/client/enrich.py +26 -5
  54. elasticsearch/_sync/client/eql.py +32 -4
  55. elasticsearch/_sync/client/esql.py +62 -6
  56. elasticsearch/_sync/client/features.py +12 -2
  57. elasticsearch/_sync/client/fleet.py +8 -2
  58. elasticsearch/_sync/client/graph.py +1 -1
  59. elasticsearch/_sync/client/ilm.py +23 -22
  60. elasticsearch/_sync/client/indices.py +424 -132
  61. elasticsearch/_sync/client/inference.py +1906 -61
  62. elasticsearch/_sync/client/ingest.py +32 -38
  63. elasticsearch/_sync/client/license.py +51 -16
  64. elasticsearch/_sync/client/logstash.py +3 -3
  65. elasticsearch/_sync/client/migration.py +3 -3
  66. elasticsearch/_sync/client/ml.py +144 -115
  67. elasticsearch/_sync/client/monitoring.py +1 -1
  68. elasticsearch/_sync/client/nodes.py +9 -27
  69. elasticsearch/_sync/client/query_rules.py +8 -8
  70. elasticsearch/_sync/client/rollup.py +8 -8
  71. elasticsearch/_sync/client/search_application.py +13 -13
  72. elasticsearch/_sync/client/searchable_snapshots.py +4 -4
  73. elasticsearch/_sync/client/security.py +71 -71
  74. elasticsearch/_sync/client/shutdown.py +3 -10
  75. elasticsearch/_sync/client/simulate.py +6 -6
  76. elasticsearch/_sync/client/slm.py +9 -9
  77. elasticsearch/_sync/client/snapshot.py +13 -17
  78. elasticsearch/_sync/client/sql.py +6 -6
  79. elasticsearch/_sync/client/ssl.py +1 -1
  80. elasticsearch/_sync/client/synonyms.py +7 -7
  81. elasticsearch/_sync/client/tasks.py +3 -9
  82. elasticsearch/_sync/client/text_structure.py +4 -4
  83. elasticsearch/_sync/client/transform.py +30 -28
  84. elasticsearch/_sync/client/utils.py +0 -3
  85. elasticsearch/_sync/client/watcher.py +22 -14
  86. elasticsearch/_sync/client/xpack.py +2 -2
  87. elasticsearch/_version.py +1 -1
  88. elasticsearch/dsl/__init__.py +203 -0
  89. elasticsearch/dsl/_async/__init__.py +16 -0
  90. elasticsearch/dsl/_async/document.py +522 -0
  91. elasticsearch/dsl/_async/faceted_search.py +50 -0
  92. elasticsearch/dsl/_async/index.py +639 -0
  93. elasticsearch/dsl/_async/mapping.py +49 -0
  94. elasticsearch/dsl/_async/search.py +233 -0
  95. elasticsearch/dsl/_async/update_by_query.py +47 -0
  96. elasticsearch/dsl/_sync/__init__.py +16 -0
  97. elasticsearch/dsl/_sync/document.py +514 -0
  98. elasticsearch/dsl/_sync/faceted_search.py +50 -0
  99. elasticsearch/dsl/_sync/index.py +597 -0
  100. elasticsearch/dsl/_sync/mapping.py +49 -0
  101. elasticsearch/dsl/_sync/search.py +226 -0
  102. elasticsearch/dsl/_sync/update_by_query.py +45 -0
  103. elasticsearch/dsl/aggs.py +3730 -0
  104. elasticsearch/dsl/analysis.py +341 -0
  105. elasticsearch/dsl/async_connections.py +37 -0
  106. elasticsearch/dsl/connections.py +142 -0
  107. elasticsearch/dsl/document.py +20 -0
  108. elasticsearch/dsl/document_base.py +444 -0
  109. elasticsearch/dsl/exceptions.py +32 -0
  110. elasticsearch/dsl/faceted_search.py +28 -0
  111. elasticsearch/dsl/faceted_search_base.py +489 -0
  112. elasticsearch/dsl/field.py +4392 -0
  113. elasticsearch/dsl/function.py +180 -0
  114. elasticsearch/dsl/index.py +23 -0
  115. elasticsearch/dsl/index_base.py +178 -0
  116. elasticsearch/dsl/mapping.py +19 -0
  117. elasticsearch/dsl/mapping_base.py +219 -0
  118. elasticsearch/dsl/query.py +2822 -0
  119. elasticsearch/dsl/response/__init__.py +388 -0
  120. elasticsearch/dsl/response/aggs.py +100 -0
  121. elasticsearch/dsl/response/hit.py +53 -0
  122. elasticsearch/dsl/search.py +20 -0
  123. elasticsearch/dsl/search_base.py +1040 -0
  124. elasticsearch/dsl/serializer.py +34 -0
  125. elasticsearch/dsl/types.py +6509 -0
  126. elasticsearch/dsl/update_by_query.py +19 -0
  127. elasticsearch/dsl/update_by_query_base.py +149 -0
  128. elasticsearch/dsl/utils.py +687 -0
  129. elasticsearch/dsl/wrappers.py +119 -0
  130. {elasticsearch-8.17.2.dist-info → elasticsearch-8.18.1.dist-info}/METADATA +14 -2
  131. elasticsearch-8.18.1.dist-info/RECORD +163 -0
  132. elasticsearch-8.18.1.dist-info/licenses/LICENSE.txt +175 -0
  133. elasticsearch-8.18.1.dist-info/licenses/NOTICE.txt +559 -0
  134. elasticsearch-8.17.2.dist-info/RECORD +0 -119
  135. {elasticsearch-8.17.2.dist-info → elasticsearch-8.18.1.dist-info}/WHEEL +0 -0
  136. {elasticsearch-8.17.2.dist-info → elasticsearch-8.18.1.dist-info}/licenses/LICENSE +0 -0
  137. {elasticsearch-8.17.2.dist-info → elasticsearch-8.18.1.dist-info}/licenses/NOTICE +0 -0
@@ -0,0 +1,19 @@
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
+ from ._async.update_by_query import AsyncUpdateByQuery # noqa: F401
19
+ from ._sync.update_by_query import UpdateByQuery # noqa: F401
@@ -0,0 +1,149 @@
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
+ from typing import Any, Dict, Type
19
+
20
+ from typing_extensions import Self
21
+
22
+ from .query import Bool, Q
23
+ from .response import UpdateByQueryResponse
24
+ from .search_base import ProxyDescriptor, QueryProxy, Request
25
+ from .utils import _R, recursive_to_dict
26
+
27
+
28
+ class UpdateByQueryBase(Request[_R]):
29
+ query = ProxyDescriptor[Self]("query")
30
+
31
+ def __init__(self, **kwargs: Any):
32
+ """
33
+ Update by query request to elasticsearch.
34
+
35
+ :arg using: `Elasticsearch` instance to use
36
+ :arg index: limit the search to index
37
+ :arg doc_type: only query this type.
38
+
39
+ All the parameters supplied (or omitted) at creation type can be later
40
+ overridden by methods (`using`, `index` and `doc_type` respectively).
41
+
42
+ """
43
+ super().__init__(**kwargs)
44
+ self._response_class = UpdateByQueryResponse[_R]
45
+ self._script: Dict[str, Any] = {}
46
+ self._query_proxy = QueryProxy(self, "query")
47
+
48
+ def filter(self, *args: Any, **kwargs: Any) -> Self:
49
+ return self.query(Bool(filter=[Q(*args, **kwargs)]))
50
+
51
+ def exclude(self, *args: Any, **kwargs: Any) -> Self:
52
+ return self.query(Bool(filter=[~Q(*args, **kwargs)]))
53
+
54
+ @classmethod
55
+ def from_dict(cls, d: Dict[str, Any]) -> Self:
56
+ """
57
+ Construct a new `UpdateByQuery` instance from a raw dict containing the search
58
+ body. Useful when migrating from raw dictionaries.
59
+
60
+ Example::
61
+
62
+ ubq = UpdateByQuery.from_dict({
63
+ "query": {
64
+ "bool": {
65
+ "must": [...]
66
+ }
67
+ },
68
+ "script": {...}
69
+ })
70
+ ubq = ubq.filter('term', published=True)
71
+ """
72
+ u = cls()
73
+ u.update_from_dict(d)
74
+ return u
75
+
76
+ def _clone(self) -> Self:
77
+ """
78
+ Return a clone of the current search request. Performs a shallow copy
79
+ of all the underlying objects. Used internally by most state modifying
80
+ APIs.
81
+ """
82
+ ubq = super()._clone()
83
+
84
+ ubq._response_class = self._response_class
85
+ ubq._script = self._script.copy()
86
+ ubq.query._proxied = self.query._proxied
87
+ return ubq
88
+
89
+ def response_class(self, cls: Type[UpdateByQueryResponse[_R]]) -> Self:
90
+ """
91
+ Override the default wrapper used for the response.
92
+ """
93
+ ubq = self._clone()
94
+ ubq._response_class = cls
95
+ return ubq
96
+
97
+ def update_from_dict(self, d: Dict[str, Any]) -> Self:
98
+ """
99
+ Apply options from a serialized body to the current instance. Modifies
100
+ the object in-place. Used mostly by ``from_dict``.
101
+ """
102
+ d = d.copy()
103
+ if "query" in d:
104
+ self.query._proxied = Q(d.pop("query"))
105
+ if "script" in d:
106
+ self._script = d.pop("script")
107
+ self._extra.update(d)
108
+ return self
109
+
110
+ def script(self, **kwargs: Any) -> Self:
111
+ """
112
+ Define update action to take:
113
+ https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting-using.html
114
+ for more details.
115
+
116
+ Note: the API only accepts a single script, so
117
+ calling the script multiple times will overwrite.
118
+
119
+ Example::
120
+
121
+ ubq = Search()
122
+ ubq = ubq.script(source="ctx._source.likes++"")
123
+ ubq = ubq.script(source="ctx._source.likes += params.f"",
124
+ lang="expression",
125
+ params={'f': 3})
126
+ """
127
+ ubq = self._clone()
128
+ if ubq._script:
129
+ ubq._script = {}
130
+ ubq._script.update(kwargs)
131
+ return ubq
132
+
133
+ def to_dict(self, **kwargs: Any) -> Dict[str, Any]:
134
+ """
135
+ Serialize the search into the dictionary that will be sent over as the
136
+ request'ubq body.
137
+
138
+ All additional keyword arguments will be included into the dictionary.
139
+ """
140
+ d = {}
141
+ if self.query:
142
+ d["query"] = self.query.to_dict()
143
+
144
+ if self._script:
145
+ d["script"] = self._script
146
+
147
+ d.update(recursive_to_dict(self._extra))
148
+ d.update(recursive_to_dict(kwargs))
149
+ return d