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,192 @@
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 typing as t
19
+
20
+ from elastic_transport import ObjectApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
24
+
25
+
26
+ class DanglingIndicesClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ async def delete_dangling_index(
30
+ self,
31
+ *,
32
+ index_uuid: str,
33
+ accept_data_loss: bool,
34
+ error_trace: t.Optional[bool] = None,
35
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
36
+ human: t.Optional[bool] = None,
37
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
38
+ pretty: t.Optional[bool] = None,
39
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
40
+ ) -> ObjectApiResponse[t.Any]:
41
+ """
42
+ .. raw:: html
43
+
44
+ <p>Delete a dangling index.
45
+ If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.
46
+ For example, this can happen if you delete more than <code>cluster.indices.tombstones.size</code> indices while an Elasticsearch node is offline.</p>
47
+
48
+
49
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-dangling-indices-delete-dangling-index>`_
50
+
51
+ :param index_uuid: The UUID of the index to delete. Use the get dangling indices
52
+ API to find the UUID.
53
+ :param accept_data_loss: This parameter must be set to true to acknowledge that
54
+ it will no longer be possible to recove data from the dangling index.
55
+ :param master_timeout: Specify timeout for connection to master
56
+ :param timeout: Explicit operation timeout
57
+ """
58
+ if index_uuid in SKIP_IN_PATH:
59
+ raise ValueError("Empty value passed for parameter 'index_uuid'")
60
+ if accept_data_loss is None:
61
+ raise ValueError("Empty value passed for parameter 'accept_data_loss'")
62
+ __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)}
63
+ __path = f'/_dangling/{__path_parts["index_uuid"]}'
64
+ __query: t.Dict[str, t.Any] = {}
65
+ if accept_data_loss is not None:
66
+ __query["accept_data_loss"] = accept_data_loss
67
+ if error_trace is not None:
68
+ __query["error_trace"] = error_trace
69
+ if filter_path is not None:
70
+ __query["filter_path"] = filter_path
71
+ if human is not None:
72
+ __query["human"] = human
73
+ if master_timeout is not None:
74
+ __query["master_timeout"] = master_timeout
75
+ if pretty is not None:
76
+ __query["pretty"] = pretty
77
+ if timeout is not None:
78
+ __query["timeout"] = timeout
79
+ __headers = {"accept": "application/json"}
80
+ return await self.perform_request( # type: ignore[return-value]
81
+ "DELETE",
82
+ __path,
83
+ params=__query,
84
+ headers=__headers,
85
+ endpoint_id="dangling_indices.delete_dangling_index",
86
+ path_parts=__path_parts,
87
+ )
88
+
89
+ @_rewrite_parameters()
90
+ async def import_dangling_index(
91
+ self,
92
+ *,
93
+ index_uuid: str,
94
+ accept_data_loss: bool,
95
+ error_trace: t.Optional[bool] = None,
96
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
97
+ human: t.Optional[bool] = None,
98
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
99
+ pretty: t.Optional[bool] = None,
100
+ timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
101
+ ) -> ObjectApiResponse[t.Any]:
102
+ """
103
+ .. raw:: html
104
+
105
+ <p>Import a dangling index.</p>
106
+ <p>If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.
107
+ For example, this can happen if you delete more than <code>cluster.indices.tombstones.size</code> indices while an Elasticsearch node is offline.</p>
108
+
109
+
110
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-dangling-indices-import-dangling-index>`_
111
+
112
+ :param index_uuid: The UUID of the index to import. Use the get dangling indices
113
+ API to locate the UUID.
114
+ :param accept_data_loss: This parameter must be set to true to import a dangling
115
+ index. Because Elasticsearch cannot know where the dangling index data came
116
+ from or determine which shard copies are fresh and which are stale, it cannot
117
+ guarantee that the imported data represents the latest state of the index
118
+ when it was last in the cluster.
119
+ :param master_timeout: Specify timeout for connection to master
120
+ :param timeout: Explicit operation timeout
121
+ """
122
+ if index_uuid in SKIP_IN_PATH:
123
+ raise ValueError("Empty value passed for parameter 'index_uuid'")
124
+ if accept_data_loss is None:
125
+ raise ValueError("Empty value passed for parameter 'accept_data_loss'")
126
+ __path_parts: t.Dict[str, str] = {"index_uuid": _quote(index_uuid)}
127
+ __path = f'/_dangling/{__path_parts["index_uuid"]}'
128
+ __query: t.Dict[str, t.Any] = {}
129
+ if accept_data_loss is not None:
130
+ __query["accept_data_loss"] = accept_data_loss
131
+ if error_trace is not None:
132
+ __query["error_trace"] = error_trace
133
+ if filter_path is not None:
134
+ __query["filter_path"] = filter_path
135
+ if human is not None:
136
+ __query["human"] = human
137
+ if master_timeout is not None:
138
+ __query["master_timeout"] = master_timeout
139
+ if pretty is not None:
140
+ __query["pretty"] = pretty
141
+ if timeout is not None:
142
+ __query["timeout"] = timeout
143
+ __headers = {"accept": "application/json"}
144
+ return await self.perform_request( # type: ignore[return-value]
145
+ "POST",
146
+ __path,
147
+ params=__query,
148
+ headers=__headers,
149
+ endpoint_id="dangling_indices.import_dangling_index",
150
+ path_parts=__path_parts,
151
+ )
152
+
153
+ @_rewrite_parameters()
154
+ async def list_dangling_indices(
155
+ self,
156
+ *,
157
+ error_trace: t.Optional[bool] = None,
158
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
159
+ human: t.Optional[bool] = None,
160
+ pretty: t.Optional[bool] = None,
161
+ ) -> ObjectApiResponse[t.Any]:
162
+ """
163
+ .. raw:: html
164
+
165
+ <p>Get the dangling indices.</p>
166
+ <p>If Elasticsearch encounters index data that is absent from the current cluster state, those indices are considered to be dangling.
167
+ For example, this can happen if you delete more than <code>cluster.indices.tombstones.size</code> indices while an Elasticsearch node is offline.</p>
168
+ <p>Use this API to list dangling indices, which you can then import or delete.</p>
169
+
170
+
171
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-dangling-indices-list-dangling-indices>`_
172
+ """
173
+ __path_parts: t.Dict[str, str] = {}
174
+ __path = "/_dangling"
175
+ __query: t.Dict[str, t.Any] = {}
176
+ if error_trace is not None:
177
+ __query["error_trace"] = error_trace
178
+ if filter_path is not None:
179
+ __query["filter_path"] = filter_path
180
+ if human is not None:
181
+ __query["human"] = human
182
+ if pretty is not None:
183
+ __query["pretty"] = pretty
184
+ __headers = {"accept": "application/json"}
185
+ return await self.perform_request( # type: ignore[return-value]
186
+ "GET",
187
+ __path,
188
+ params=__query,
189
+ headers=__headers,
190
+ endpoint_id="dangling_indices.list_dangling_indices",
191
+ path_parts=__path_parts,
192
+ )
@@ -0,0 +1,291 @@
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 typing as t
19
+
20
+ from elastic_transport import ObjectApiResponse
21
+
22
+ from ._base import NamespacedClient
23
+ from .utils import SKIP_IN_PATH, _quote, _rewrite_parameters
24
+
25
+
26
+ class EnrichClient(NamespacedClient):
27
+
28
+ @_rewrite_parameters()
29
+ async def delete_policy(
30
+ self,
31
+ *,
32
+ name: str,
33
+ error_trace: t.Optional[bool] = None,
34
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
35
+ human: t.Optional[bool] = None,
36
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
37
+ pretty: t.Optional[bool] = None,
38
+ ) -> ObjectApiResponse[t.Any]:
39
+ """
40
+ .. raw:: html
41
+
42
+ <p>Delete an enrich policy.
43
+ Deletes an existing enrich policy and its enrich index.</p>
44
+
45
+
46
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-enrich-delete-policy>`_
47
+
48
+ :param name: Enrich policy to delete.
49
+ :param master_timeout: Period to wait for a connection to the master node.
50
+ """
51
+ if name in SKIP_IN_PATH:
52
+ raise ValueError("Empty value passed for parameter 'name'")
53
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
54
+ __path = f'/_enrich/policy/{__path_parts["name"]}'
55
+ __query: t.Dict[str, t.Any] = {}
56
+ if error_trace is not None:
57
+ __query["error_trace"] = error_trace
58
+ if filter_path is not None:
59
+ __query["filter_path"] = filter_path
60
+ if human is not None:
61
+ __query["human"] = human
62
+ if master_timeout is not None:
63
+ __query["master_timeout"] = master_timeout
64
+ if pretty is not None:
65
+ __query["pretty"] = pretty
66
+ __headers = {"accept": "application/json"}
67
+ return await self.perform_request( # type: ignore[return-value]
68
+ "DELETE",
69
+ __path,
70
+ params=__query,
71
+ headers=__headers,
72
+ endpoint_id="enrich.delete_policy",
73
+ path_parts=__path_parts,
74
+ )
75
+
76
+ @_rewrite_parameters()
77
+ async def execute_policy(
78
+ self,
79
+ *,
80
+ name: str,
81
+ error_trace: t.Optional[bool] = None,
82
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
83
+ human: t.Optional[bool] = None,
84
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
85
+ pretty: t.Optional[bool] = None,
86
+ wait_for_completion: t.Optional[bool] = None,
87
+ ) -> ObjectApiResponse[t.Any]:
88
+ """
89
+ .. raw:: html
90
+
91
+ <p>Run an enrich policy.
92
+ Create the enrich index for an existing enrich policy.</p>
93
+
94
+
95
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-enrich-execute-policy>`_
96
+
97
+ :param name: Enrich policy to execute.
98
+ :param master_timeout: Period to wait for a connection to the master node.
99
+ :param wait_for_completion: If `true`, the request blocks other enrich policy
100
+ execution requests until complete.
101
+ """
102
+ if name in SKIP_IN_PATH:
103
+ raise ValueError("Empty value passed for parameter 'name'")
104
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
105
+ __path = f'/_enrich/policy/{__path_parts["name"]}/_execute'
106
+ __query: t.Dict[str, t.Any] = {}
107
+ if error_trace is not None:
108
+ __query["error_trace"] = error_trace
109
+ if filter_path is not None:
110
+ __query["filter_path"] = filter_path
111
+ if human is not None:
112
+ __query["human"] = human
113
+ if master_timeout is not None:
114
+ __query["master_timeout"] = master_timeout
115
+ if pretty is not None:
116
+ __query["pretty"] = pretty
117
+ if wait_for_completion is not None:
118
+ __query["wait_for_completion"] = wait_for_completion
119
+ __headers = {"accept": "application/json"}
120
+ return await self.perform_request( # type: ignore[return-value]
121
+ "PUT",
122
+ __path,
123
+ params=__query,
124
+ headers=__headers,
125
+ endpoint_id="enrich.execute_policy",
126
+ path_parts=__path_parts,
127
+ )
128
+
129
+ @_rewrite_parameters()
130
+ async def get_policy(
131
+ self,
132
+ *,
133
+ name: t.Optional[t.Union[str, t.Sequence[str]]] = None,
134
+ error_trace: t.Optional[bool] = None,
135
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
136
+ human: t.Optional[bool] = None,
137
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
138
+ pretty: t.Optional[bool] = None,
139
+ ) -> ObjectApiResponse[t.Any]:
140
+ """
141
+ .. raw:: html
142
+
143
+ <p>Get an enrich policy.
144
+ Returns information about an enrich policy.</p>
145
+
146
+
147
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-enrich-get-policy>`_
148
+
149
+ :param name: Comma-separated list of enrich policy names used to limit the request.
150
+ To return information for all enrich policies, omit this parameter.
151
+ :param master_timeout: Period to wait for a connection to the master node.
152
+ """
153
+ __path_parts: t.Dict[str, str]
154
+ if name not in SKIP_IN_PATH:
155
+ __path_parts = {"name": _quote(name)}
156
+ __path = f'/_enrich/policy/{__path_parts["name"]}'
157
+ else:
158
+ __path_parts = {}
159
+ __path = "/_enrich/policy"
160
+ __query: t.Dict[str, t.Any] = {}
161
+ if error_trace is not None:
162
+ __query["error_trace"] = error_trace
163
+ if filter_path is not None:
164
+ __query["filter_path"] = filter_path
165
+ if human is not None:
166
+ __query["human"] = human
167
+ if master_timeout is not None:
168
+ __query["master_timeout"] = master_timeout
169
+ if pretty is not None:
170
+ __query["pretty"] = pretty
171
+ __headers = {"accept": "application/json"}
172
+ return await self.perform_request( # type: ignore[return-value]
173
+ "GET",
174
+ __path,
175
+ params=__query,
176
+ headers=__headers,
177
+ endpoint_id="enrich.get_policy",
178
+ path_parts=__path_parts,
179
+ )
180
+
181
+ @_rewrite_parameters(
182
+ body_fields=("geo_match", "match", "range"),
183
+ )
184
+ async def put_policy(
185
+ self,
186
+ *,
187
+ name: str,
188
+ error_trace: t.Optional[bool] = None,
189
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
190
+ geo_match: t.Optional[t.Mapping[str, t.Any]] = None,
191
+ human: t.Optional[bool] = None,
192
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
193
+ match: t.Optional[t.Mapping[str, t.Any]] = None,
194
+ pretty: t.Optional[bool] = None,
195
+ range: t.Optional[t.Mapping[str, t.Any]] = None,
196
+ body: t.Optional[t.Dict[str, t.Any]] = None,
197
+ ) -> ObjectApiResponse[t.Any]:
198
+ """
199
+ .. raw:: html
200
+
201
+ <p>Create an enrich policy.
202
+ Creates an enrich policy.</p>
203
+
204
+
205
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-enrich-put-policy>`_
206
+
207
+ :param name: Name of the enrich policy to create or update.
208
+ :param geo_match: Matches enrich data to incoming documents based on a `geo_shape`
209
+ query.
210
+ :param master_timeout: Period to wait for a connection to the master node.
211
+ :param match: Matches enrich data to incoming documents based on a `term` query.
212
+ :param range: Matches a number, date, or IP address in incoming documents to
213
+ a range in the enrich index based on a `term` query.
214
+ """
215
+ if name in SKIP_IN_PATH:
216
+ raise ValueError("Empty value passed for parameter 'name'")
217
+ __path_parts: t.Dict[str, str] = {"name": _quote(name)}
218
+ __path = f'/_enrich/policy/{__path_parts["name"]}'
219
+ __query: t.Dict[str, t.Any] = {}
220
+ __body: t.Dict[str, t.Any] = body if body is not None else {}
221
+ if error_trace is not None:
222
+ __query["error_trace"] = error_trace
223
+ if filter_path is not None:
224
+ __query["filter_path"] = filter_path
225
+ if human is not None:
226
+ __query["human"] = human
227
+ if master_timeout is not None:
228
+ __query["master_timeout"] = master_timeout
229
+ if pretty is not None:
230
+ __query["pretty"] = pretty
231
+ if not __body:
232
+ if geo_match is not None:
233
+ __body["geo_match"] = geo_match
234
+ if match is not None:
235
+ __body["match"] = match
236
+ if range is not None:
237
+ __body["range"] = range
238
+ __headers = {"accept": "application/json", "content-type": "application/json"}
239
+ return await self.perform_request( # type: ignore[return-value]
240
+ "PUT",
241
+ __path,
242
+ params=__query,
243
+ headers=__headers,
244
+ body=__body,
245
+ endpoint_id="enrich.put_policy",
246
+ path_parts=__path_parts,
247
+ )
248
+
249
+ @_rewrite_parameters()
250
+ async def stats(
251
+ self,
252
+ *,
253
+ error_trace: t.Optional[bool] = None,
254
+ filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None,
255
+ human: t.Optional[bool] = None,
256
+ master_timeout: t.Optional[t.Union[str, t.Literal[-1], t.Literal[0]]] = None,
257
+ pretty: t.Optional[bool] = None,
258
+ ) -> ObjectApiResponse[t.Any]:
259
+ """
260
+ .. raw:: html
261
+
262
+ <p>Get enrich stats.
263
+ Returns enrich coordinator statistics and information about enrich policies that are currently executing.</p>
264
+
265
+
266
+ `<https://www.elastic.co/docs/api/doc/elasticsearch/v9/operation/operation-enrich-stats>`_
267
+
268
+ :param master_timeout: Period to wait for a connection to the master node.
269
+ """
270
+ __path_parts: t.Dict[str, str] = {}
271
+ __path = "/_enrich/_stats"
272
+ __query: t.Dict[str, t.Any] = {}
273
+ if error_trace is not None:
274
+ __query["error_trace"] = error_trace
275
+ if filter_path is not None:
276
+ __query["filter_path"] = filter_path
277
+ if human is not None:
278
+ __query["human"] = human
279
+ if master_timeout is not None:
280
+ __query["master_timeout"] = master_timeout
281
+ if pretty is not None:
282
+ __query["pretty"] = pretty
283
+ __headers = {"accept": "application/json"}
284
+ return await self.perform_request( # type: ignore[return-value]
285
+ "GET",
286
+ __path,
287
+ params=__query,
288
+ headers=__headers,
289
+ endpoint_id="enrich.stats",
290
+ path_parts=__path_parts,
291
+ )