@elastic/elasticsearch 7.15.0 → 8.0.0-beta.1

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 (344) hide show
  1. package/README.md +10 -11
  2. package/index.d.ts +4 -2971
  3. package/index.js +25 -321
  4. package/lib/api/api/async_search.d.ts +23 -0
  5. package/lib/api/api/async_search.js +130 -0
  6. package/lib/api/api/async_search.js.map +1 -0
  7. package/lib/api/api/autoscaling.d.ts +23 -0
  8. package/lib/api/api/autoscaling.js +109 -0
  9. package/lib/api/api/autoscaling.js.map +1 -0
  10. package/lib/api/api/bulk.d.ts +10 -0
  11. package/lib/api/api/bulk.js +58 -0
  12. package/lib/api/api/bulk.js.map +1 -0
  13. package/lib/api/api/cat.d.ts +86 -0
  14. package/lib/api/api/cat.js +611 -0
  15. package/lib/api/api/cat.js.map +1 -0
  16. package/lib/api/api/ccr.d.ts +50 -0
  17. package/lib/api/api/ccr.js +320 -0
  18. package/lib/api/api/ccr.js.map +1 -0
  19. package/lib/api/api/clear_scroll.d.ts +10 -0
  20. package/lib/api/api/clear_scroll.js +54 -0
  21. package/lib/api/api/clear_scroll.js.map +1 -0
  22. package/lib/api/api/close_point_in_time.d.ts +10 -0
  23. package/lib/api/api/close_point_in_time.js +53 -0
  24. package/lib/api/api/close_point_in_time.js.map +1 -0
  25. package/lib/api/api/cluster.d.ts +56 -0
  26. package/lib/api/api/cluster.js +392 -0
  27. package/lib/api/api/cluster.js.map +1 -0
  28. package/lib/api/api/count.d.ts +10 -0
  29. package/lib/api/api/count.js +62 -0
  30. package/lib/api/api/count.js.map +1 -0
  31. package/lib/api/api/create.d.ts +10 -0
  32. package/lib/api/api/create.js +46 -0
  33. package/lib/api/api/create.js.map +1 -0
  34. package/lib/api/api/dangling_indices.d.ts +20 -0
  35. package/lib/api/api/dangling_indices.js +85 -0
  36. package/lib/api/api/dangling_indices.js.map +1 -0
  37. package/lib/api/api/delete.d.ts +10 -0
  38. package/lib/api/api/delete.js +39 -0
  39. package/lib/api/api/delete.js.map +1 -0
  40. package/lib/api/api/delete_by_query.d.ts +10 -0
  41. package/lib/api/api/delete_by_query.js +53 -0
  42. package/lib/api/api/delete_by_query.js.map +1 -0
  43. package/lib/api/api/delete_by_query_rethrottle.d.ts +10 -0
  44. package/lib/api/api/delete_by_query_rethrottle.js +39 -0
  45. package/lib/api/api/delete_by_query_rethrottle.js.map +1 -0
  46. package/lib/api/api/delete_script.d.ts +10 -0
  47. package/lib/api/api/delete_script.js +39 -0
  48. package/lib/api/api/delete_script.js.map +1 -0
  49. package/lib/api/api/enrich.d.ts +26 -0
  50. package/lib/api/api/enrich.js +142 -0
  51. package/lib/api/api/enrich.js.map +1 -0
  52. package/lib/api/api/eql.d.ts +23 -0
  53. package/lib/api/api/eql.js +115 -0
  54. package/lib/api/api/eql.js.map +1 -0
  55. package/lib/api/api/exists.d.ts +10 -0
  56. package/lib/api/api/exists.js +39 -0
  57. package/lib/api/api/exists.js.map +1 -0
  58. package/lib/api/api/exists_source.d.ts +10 -0
  59. package/lib/api/api/exists_source.js +39 -0
  60. package/lib/api/api/exists_source.js.map +1 -0
  61. package/lib/api/api/explain.d.ts +10 -0
  62. package/lib/api/api/explain.js +53 -0
  63. package/lib/api/api/explain.js.map +1 -0
  64. package/lib/api/api/features.d.ts +17 -0
  65. package/lib/api/api/features.js +69 -0
  66. package/lib/api/api/features.js.map +1 -0
  67. package/lib/api/api/field_caps.d.ts +10 -0
  68. package/lib/api/api/field_caps.js +62 -0
  69. package/lib/api/api/field_caps.js.map +1 -0
  70. package/lib/api/api/fleet.d.ts +20 -0
  71. package/lib/api/api/fleet.js +92 -0
  72. package/lib/api/api/fleet.js.map +1 -0
  73. package/lib/api/api/get.d.ts +10 -0
  74. package/lib/api/api/get.js +39 -0
  75. package/lib/api/api/get.js.map +1 -0
  76. package/lib/api/api/get_script.d.ts +10 -0
  77. package/lib/api/api/get_script.js +39 -0
  78. package/lib/api/api/get_script.js.map +1 -0
  79. package/lib/api/api/get_script_context.d.ts +10 -0
  80. package/lib/api/api/get_script_context.js +40 -0
  81. package/lib/api/api/get_script_context.js.map +1 -0
  82. package/lib/api/api/get_script_languages.d.ts +10 -0
  83. package/lib/api/api/get_script_languages.js +40 -0
  84. package/lib/api/api/get_script_languages.js.map +1 -0
  85. package/lib/api/api/get_source.d.ts +10 -0
  86. package/lib/api/api/get_source.js +39 -0
  87. package/lib/api/api/get_source.js.map +1 -0
  88. package/lib/api/api/graph.d.ts +14 -0
  89. package/lib/api/api/graph.js +64 -0
  90. package/lib/api/api/graph.js.map +1 -0
  91. package/lib/api/api/ilm.d.ts +44 -0
  92. package/lib/api/api/ilm.js +260 -0
  93. package/lib/api/api/ilm.js.map +1 -0
  94. package/lib/api/api/index.d.ts +10 -0
  95. package/lib/api/api/index.js +54 -0
  96. package/lib/api/api/index.js.map +1 -0
  97. package/lib/api/api/indices.d.ts +173 -0
  98. package/lib/api/api/indices.js +1381 -0
  99. package/lib/api/api/indices.js.map +1 -0
  100. package/lib/api/api/info.d.ts +10 -0
  101. package/lib/{Serializer.d.ts → api/api/info.js} +21 -11
  102. package/lib/api/api/info.js.map +1 -0
  103. package/lib/api/api/ingest.d.ts +29 -0
  104. package/lib/api/api/ingest.js +183 -0
  105. package/lib/api/api/ingest.js.map +1 -0
  106. package/lib/api/api/knn_search.d.ts +10 -0
  107. package/lib/api/api/knn_search.js +53 -0
  108. package/lib/api/api/knn_search.js.map +1 -0
  109. package/lib/api/api/license.d.ts +32 -0
  110. package/lib/api/api/license.js +173 -0
  111. package/lib/api/api/license.js.map +1 -0
  112. package/lib/api/api/logstash.d.ts +20 -0
  113. package/lib/api/api/logstash.js +91 -0
  114. package/lib/api/api/logstash.js.map +1 -0
  115. package/lib/api/api/mget.d.ts +10 -0
  116. package/lib/api/api/mget.js +62 -0
  117. package/lib/api/api/mget.js.map +1 -0
  118. package/lib/api/api/migration.d.ts +20 -0
  119. package/lib/api/api/migration.js +93 -0
  120. package/lib/api/api/migration.js.map +1 -0
  121. package/lib/api/api/ml.d.ts +221 -0
  122. package/lib/api/api/ml.js +1818 -0
  123. package/lib/api/api/ml.js.map +1 -0
  124. package/lib/api/api/monitoring.d.ts +14 -0
  125. package/lib/api/api/monitoring.js +57 -0
  126. package/lib/api/api/monitoring.js.map +1 -0
  127. package/lib/api/api/msearch.d.ts +10 -0
  128. package/lib/api/api/msearch.js +54 -0
  129. package/lib/api/api/msearch.js.map +1 -0
  130. package/lib/api/api/msearch_template.d.ts +10 -0
  131. package/lib/api/api/msearch_template.js +54 -0
  132. package/lib/api/api/msearch_template.js.map +1 -0
  133. package/lib/api/api/mtermvectors.d.ts +10 -0
  134. package/lib/api/api/mtermvectors.js +62 -0
  135. package/lib/api/api/mtermvectors.js.map +1 -0
  136. package/lib/api/api/nodes.d.ts +32 -0
  137. package/lib/api/api/nodes.js +243 -0
  138. package/lib/api/api/nodes.js.map +1 -0
  139. package/lib/api/api/open_point_in_time.d.ts +10 -0
  140. package/lib/api/api/open_point_in_time.js +39 -0
  141. package/lib/api/api/open_point_in_time.js.map +1 -0
  142. package/lib/api/api/ping.d.ts +10 -0
  143. package/lib/api/api/ping.js +40 -0
  144. package/lib/api/api/ping.js.map +1 -0
  145. package/lib/api/api/put_script.d.ts +10 -0
  146. package/lib/api/api/put_script.js +61 -0
  147. package/lib/api/api/put_script.js.map +1 -0
  148. package/lib/api/api/rank_eval.d.ts +10 -0
  149. package/lib/api/api/rank_eval.js +61 -0
  150. package/lib/api/api/rank_eval.js.map +1 -0
  151. package/lib/api/api/reindex.d.ts +10 -0
  152. package/lib/api/api/reindex.js +54 -0
  153. package/lib/api/api/reindex.js.map +1 -0
  154. package/lib/api/api/reindex_rethrottle.d.ts +10 -0
  155. package/lib/api/api/reindex_rethrottle.js +39 -0
  156. package/lib/api/api/reindex_rethrottle.js.map +1 -0
  157. package/lib/api/api/render_search_template.d.ts +10 -0
  158. package/lib/api/api/render_search_template.js +62 -0
  159. package/lib/api/api/render_search_template.js.map +1 -0
  160. package/lib/api/api/rollup.d.ts +38 -0
  161. package/lib/api/api/rollup.js +239 -0
  162. package/lib/api/api/rollup.js.map +1 -0
  163. package/lib/api/api/scripts_painless_execute.d.ts +10 -0
  164. package/lib/api/api/scripts_painless_execute.js +54 -0
  165. package/lib/api/api/scripts_painless_execute.js.map +1 -0
  166. package/lib/api/api/scroll.d.ts +10 -0
  167. package/lib/api/api/scroll.js +53 -0
  168. package/lib/api/api/scroll.js.map +1 -0
  169. package/lib/api/api/search.d.ts +10 -0
  170. package/lib/api/api/search.js +68 -0
  171. package/lib/api/api/search.js.map +1 -0
  172. package/lib/api/api/search_mvt.d.ts +10 -0
  173. package/lib/api/api/search_mvt.js +53 -0
  174. package/lib/api/api/search_mvt.js.map +1 -0
  175. package/lib/api/api/search_shards.d.ts +10 -0
  176. package/lib/api/api/search_shards.js +48 -0
  177. package/lib/api/api/search_shards.js.map +1 -0
  178. package/lib/api/api/search_template.d.ts +10 -0
  179. package/lib/api/api/search_template.js +62 -0
  180. package/lib/api/api/search_template.js.map +1 -0
  181. package/lib/api/api/searchable_snapshots.d.ts +23 -0
  182. package/lib/api/api/searchable_snapshots.js +141 -0
  183. package/lib/api/api/searchable_snapshots.js.map +1 -0
  184. package/lib/api/api/security.d.ts +140 -0
  185. package/lib/api/api/security.js +998 -0
  186. package/lib/api/api/security.js.map +1 -0
  187. package/lib/api/api/shutdown.d.ts +20 -0
  188. package/lib/api/api/shutdown.js +93 -0
  189. package/lib/api/api/shutdown.js.map +1 -0
  190. package/lib/api/api/slm.d.ts +38 -0
  191. package/lib/api/api/slm.js +214 -0
  192. package/lib/api/api/slm.js.map +1 -0
  193. package/lib/api/api/snapshot.d.ts +47 -0
  194. package/lib/api/api/snapshot.js +315 -0
  195. package/lib/api/api/snapshot.js.map +1 -0
  196. package/lib/api/api/sql.d.ts +29 -0
  197. package/lib/api/api/sql.js +178 -0
  198. package/lib/api/api/sql.js.map +1 -0
  199. package/lib/api/api/ssl.d.ts +14 -0
  200. package/lib/api/api/ssl.js +51 -0
  201. package/lib/api/api/ssl.js.map +1 -0
  202. package/lib/api/api/tasks.d.ts +20 -0
  203. package/lib/api/api/tasks.js +94 -0
  204. package/lib/api/api/tasks.js.map +1 -0
  205. package/lib/api/api/terms_enum.d.ts +10 -0
  206. package/lib/api/api/terms_enum.js +53 -0
  207. package/lib/api/api/terms_enum.js.map +1 -0
  208. package/lib/api/api/termvectors.d.ts +10 -0
  209. package/lib/api/api/termvectors.js +61 -0
  210. package/lib/api/api/termvectors.js.map +1 -0
  211. package/lib/api/api/text_structure.d.ts +14 -0
  212. package/lib/api/api/text_structure.js +57 -0
  213. package/lib/api/api/text_structure.js.map +1 -0
  214. package/lib/api/api/transform.d.ts +38 -0
  215. package/lib/api/api/transform.js +246 -0
  216. package/lib/api/api/transform.js.map +1 -0
  217. package/lib/api/api/update.d.ts +10 -0
  218. package/lib/api/api/update.js +53 -0
  219. package/lib/api/api/update.js.map +1 -0
  220. package/lib/api/api/update_by_query.d.ts +10 -0
  221. package/lib/api/api/update_by_query.js +53 -0
  222. package/lib/api/api/update_by_query.js.map +1 -0
  223. package/lib/api/api/update_by_query_rethrottle.d.ts +10 -0
  224. package/lib/api/api/update_by_query_rethrottle.js +39 -0
  225. package/lib/api/api/update_by_query_rethrottle.js.map +1 -0
  226. package/lib/api/api/watcher.d.ts +44 -0
  227. package/lib/api/api/watcher.js +291 -0
  228. package/lib/api/api/watcher.js.map +1 -0
  229. package/lib/api/api/xpack.d.ts +17 -0
  230. package/lib/api/api/xpack.js +69 -0
  231. package/lib/api/api/xpack.js.map +1 -0
  232. package/lib/api/index.d.ts +225 -0
  233. package/lib/api/index.js +520 -0
  234. package/lib/api/index.js.map +1 -0
  235. package/lib/api/types.d.ts +13525 -0
  236. package/lib/{pool/index.js → api/types.js} +3 -12
  237. package/lib/api/types.js.map +1 -0
  238. package/lib/api/typesWithBodyKey.d.ts +13931 -0
  239. package/{index.mjs → lib/api/typesWithBodyKey.js} +3 -11
  240. package/lib/api/typesWithBodyKey.js.map +1 -0
  241. package/lib/client.d.ts +69 -0
  242. package/lib/client.js +282 -0
  243. package/lib/client.js.map +1 -0
  244. package/lib/helpers.d.ts +148 -0
  245. package/lib/helpers.js +769 -0
  246. package/lib/helpers.js.map +1 -0
  247. package/lib/sniffingTransport.d.ts +4 -0
  248. package/lib/sniffingTransport.js +56 -0
  249. package/lib/sniffingTransport.js.map +1 -0
  250. package/package.json +46 -59
  251. package/tsconfig.json +37 -0
  252. package/api/api/async_search.js +0 -141
  253. package/api/api/autoscaling.js +0 -147
  254. package/api/api/bulk.js +0 -70
  255. package/api/api/cat.js +0 -648
  256. package/api/api/ccr.js +0 -403
  257. package/api/api/clear_scroll.js +0 -55
  258. package/api/api/close_point_in_time.js +0 -50
  259. package/api/api/cluster.js +0 -420
  260. package/api/api/count.js +0 -64
  261. package/api/api/create.js +0 -69
  262. package/api/api/dangling_indices.js +0 -115
  263. package/api/api/delete.js +0 -65
  264. package/api/api/delete_by_query.js +0 -71
  265. package/api/api/delete_by_query_rethrottle.js +0 -60
  266. package/api/api/delete_script.js +0 -56
  267. package/api/api/enrich.js +0 -173
  268. package/api/api/eql.js +0 -150
  269. package/api/api/exists.js +0 -65
  270. package/api/api/exists_source.js +0 -74
  271. package/api/api/explain.js +0 -65
  272. package/api/api/features.js +0 -81
  273. package/api/api/field_caps.js +0 -55
  274. package/api/api/fleet.js +0 -65
  275. package/api/api/get.js +0 -65
  276. package/api/api/get_script.js +0 -56
  277. package/api/api/get_script_context.js +0 -50
  278. package/api/api/get_script_languages.js +0 -50
  279. package/api/api/get_source.js +0 -65
  280. package/api/api/graph.js +0 -72
  281. package/api/api/ilm.js +0 -317
  282. package/api/api/index.js +0 -71
  283. package/api/api/indices.js +0 -1753
  284. package/api/api/info.js +0 -50
  285. package/api/api/ingest.js +0 -200
  286. package/api/api/license.js +0 -188
  287. package/api/api/logstash.js +0 -125
  288. package/api/api/mget.js +0 -70
  289. package/api/api/migration.js +0 -60
  290. package/api/api/ml.js +0 -2010
  291. package/api/api/monitoring.js +0 -66
  292. package/api/api/msearch.js +0 -70
  293. package/api/api/msearch_template.js +0 -70
  294. package/api/api/mtermvectors.js +0 -64
  295. package/api/api/nodes.js +0 -268
  296. package/api/api/open_point_in_time.js +0 -56
  297. package/api/api/ping.js +0 -50
  298. package/api/api/put_script.js +0 -71
  299. package/api/api/rank_eval.js +0 -61
  300. package/api/api/reindex.js +0 -56
  301. package/api/api/reindex_rethrottle.js +0 -60
  302. package/api/api/render_search_template.js +0 -55
  303. package/api/api/rollup.js +0 -319
  304. package/api/api/scripts_painless_execute.js +0 -50
  305. package/api/api/scroll.js +0 -55
  306. package/api/api/search.js +0 -64
  307. package/api/api/search_mvt.js +0 -87
  308. package/api/api/search_shards.js +0 -55
  309. package/api/api/search_template.js +0 -70
  310. package/api/api/searchable_snapshots.js +0 -186
  311. package/api/api/security.js +0 -1261
  312. package/api/api/shutdown.js +0 -124
  313. package/api/api/slm.js +0 -256
  314. package/api/api/snapshot.js +0 -439
  315. package/api/api/sql.js +0 -203
  316. package/api/api/ssl.js +0 -55
  317. package/api/api/tasks.js +0 -108
  318. package/api/api/terms_enum.js +0 -56
  319. package/api/api/termvectors.js +0 -67
  320. package/api/api/text_structure.js +0 -65
  321. package/api/api/transform.js +0 -268
  322. package/api/api/update.js +0 -69
  323. package/api/api/update_by_query.js +0 -67
  324. package/api/api/update_by_query_rethrottle.js +0 -60
  325. package/api/api/watcher.js +0 -333
  326. package/api/api/xpack.js +0 -76
  327. package/api/index.js +0 -508
  328. package/api/new.d.ts +0 -1585
  329. package/api/requestParams.d.ts +0 -2920
  330. package/api/types.d.ts +0 -15420
  331. package/api/utils.js +0 -58
  332. package/lib/Connection.d.ts +0 -99
  333. package/lib/Connection.js +0 -392
  334. package/lib/Helpers.d.ts +0 -124
  335. package/lib/Helpers.js +0 -770
  336. package/lib/Serializer.js +0 -94
  337. package/lib/Transport.d.ts +0 -162
  338. package/lib/Transport.js +0 -689
  339. package/lib/errors.d.ts +0 -90
  340. package/lib/errors.js +0 -159
  341. package/lib/pool/BaseConnectionPool.js +0 -262
  342. package/lib/pool/CloudConnectionPool.js +0 -64
  343. package/lib/pool/ConnectionPool.js +0 -246
  344. package/lib/pool/index.d.ts +0 -220
@@ -0,0 +1,1818 @@
1
+ "use strict";
2
+ /*
3
+ * Licensed to Elasticsearch B.V. under one or more contributor
4
+ * license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright
6
+ * ownership. Elasticsearch B.V. licenses this file to you under
7
+ * the Apache License, Version 2.0 (the "License"); you may
8
+ * not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing,
14
+ * software distributed under the License is distributed on an
15
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ * KIND, either express or implied. See the License for the
17
+ * specific language governing permissions and limitations
18
+ * under the License.
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ class Ml {
22
+ constructor(transport) {
23
+ Object.defineProperty(this, "transport", {
24
+ enumerable: true,
25
+ configurable: true,
26
+ writable: true,
27
+ value: void 0
28
+ });
29
+ this.transport = transport;
30
+ }
31
+ async closeJob(params, options) {
32
+ const acceptedPath = ['job_id'];
33
+ const querystring = {};
34
+ const body = undefined;
35
+ for (const key in params) {
36
+ if (acceptedPath.includes(key)) {
37
+ continue;
38
+ }
39
+ else if (key !== 'body') {
40
+ // @ts-expect-error
41
+ querystring[key] = params[key];
42
+ }
43
+ }
44
+ const method = 'POST';
45
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_close`;
46
+ return await this.transport.request({ path, method, querystring, body }, options);
47
+ }
48
+ async deleteCalendar(params, options) {
49
+ const acceptedPath = ['calendar_id'];
50
+ const querystring = {};
51
+ const body = undefined;
52
+ for (const key in params) {
53
+ if (acceptedPath.includes(key)) {
54
+ continue;
55
+ }
56
+ else if (key !== 'body') {
57
+ // @ts-expect-error
58
+ querystring[key] = params[key];
59
+ }
60
+ }
61
+ const method = 'DELETE';
62
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
63
+ return await this.transport.request({ path, method, querystring, body }, options);
64
+ }
65
+ async deleteCalendarEvent(params, options) {
66
+ const acceptedPath = ['calendar_id', 'event_id'];
67
+ const querystring = {};
68
+ const body = undefined;
69
+ for (const key in params) {
70
+ if (acceptedPath.includes(key)) {
71
+ continue;
72
+ }
73
+ else if (key !== 'body') {
74
+ // @ts-expect-error
75
+ querystring[key] = params[key];
76
+ }
77
+ }
78
+ const method = 'DELETE';
79
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events/${encodeURIComponent(params.event_id.toString())}`;
80
+ return await this.transport.request({ path, method, querystring, body }, options);
81
+ }
82
+ async deleteCalendarJob(params, options) {
83
+ const acceptedPath = ['calendar_id', 'job_id'];
84
+ const querystring = {};
85
+ const body = undefined;
86
+ for (const key in params) {
87
+ if (acceptedPath.includes(key)) {
88
+ continue;
89
+ }
90
+ else if (key !== 'body') {
91
+ // @ts-expect-error
92
+ querystring[key] = params[key];
93
+ }
94
+ }
95
+ const method = 'DELETE';
96
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/jobs/${encodeURIComponent(params.job_id.toString())}`;
97
+ return await this.transport.request({ path, method, querystring, body }, options);
98
+ }
99
+ async deleteDataFrameAnalytics(params, options) {
100
+ const acceptedPath = ['id'];
101
+ const querystring = {};
102
+ const body = undefined;
103
+ for (const key in params) {
104
+ if (acceptedPath.includes(key)) {
105
+ continue;
106
+ }
107
+ else if (key !== 'body') {
108
+ // @ts-expect-error
109
+ querystring[key] = params[key];
110
+ }
111
+ }
112
+ const method = 'DELETE';
113
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
114
+ return await this.transport.request({ path, method, querystring, body }, options);
115
+ }
116
+ async deleteDatafeed(params, options) {
117
+ const acceptedPath = ['datafeed_id'];
118
+ const querystring = {};
119
+ const body = undefined;
120
+ for (const key in params) {
121
+ if (acceptedPath.includes(key)) {
122
+ continue;
123
+ }
124
+ else if (key !== 'body') {
125
+ // @ts-expect-error
126
+ querystring[key] = params[key];
127
+ }
128
+ }
129
+ const method = 'DELETE';
130
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
131
+ return await this.transport.request({ path, method, querystring, body }, options);
132
+ }
133
+ async deleteExpiredData(params, options) {
134
+ const acceptedPath = ['job_id'];
135
+ const acceptedBody = ['requests_per_second', 'timeout'];
136
+ const querystring = {};
137
+ // @ts-expect-error
138
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
139
+ let body;
140
+ if (typeof userBody === 'string') {
141
+ body = userBody;
142
+ }
143
+ else {
144
+ body = userBody != null ? { ...userBody } : undefined;
145
+ }
146
+ params = params !== null && params !== void 0 ? params : {};
147
+ for (const key in params) {
148
+ if (acceptedBody.includes(key)) {
149
+ body = body !== null && body !== void 0 ? body : {};
150
+ // @ts-expect-error
151
+ body[key] = params[key];
152
+ }
153
+ else if (acceptedPath.includes(key)) {
154
+ continue;
155
+ }
156
+ else if (key !== 'body') {
157
+ // @ts-expect-error
158
+ querystring[key] = params[key];
159
+ }
160
+ }
161
+ let method = '';
162
+ let path = '';
163
+ if (params.job_id != null) {
164
+ method = 'DELETE';
165
+ path = `/_ml/_delete_expired_data/${encodeURIComponent(params.job_id.toString())}`;
166
+ }
167
+ else {
168
+ method = 'DELETE';
169
+ path = '/_ml/_delete_expired_data';
170
+ }
171
+ return await this.transport.request({ path, method, querystring, body }, options);
172
+ }
173
+ async deleteFilter(params, options) {
174
+ const acceptedPath = ['filter_id'];
175
+ const querystring = {};
176
+ const body = undefined;
177
+ for (const key in params) {
178
+ if (acceptedPath.includes(key)) {
179
+ continue;
180
+ }
181
+ else if (key !== 'body') {
182
+ // @ts-expect-error
183
+ querystring[key] = params[key];
184
+ }
185
+ }
186
+ const method = 'DELETE';
187
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
188
+ return await this.transport.request({ path, method, querystring, body }, options);
189
+ }
190
+ async deleteForecast(params, options) {
191
+ const acceptedPath = ['job_id', 'forecast_id'];
192
+ const querystring = {};
193
+ const body = undefined;
194
+ for (const key in params) {
195
+ if (acceptedPath.includes(key)) {
196
+ continue;
197
+ }
198
+ else if (key !== 'body') {
199
+ // @ts-expect-error
200
+ querystring[key] = params[key];
201
+ }
202
+ }
203
+ let method = '';
204
+ let path = '';
205
+ if (params.job_id != null && params.forecast_id != null) {
206
+ method = 'DELETE';
207
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast/${encodeURIComponent(params.forecast_id.toString())}`;
208
+ }
209
+ else {
210
+ method = 'DELETE';
211
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast`;
212
+ }
213
+ return await this.transport.request({ path, method, querystring, body }, options);
214
+ }
215
+ async deleteJob(params, options) {
216
+ const acceptedPath = ['job_id'];
217
+ const querystring = {};
218
+ const body = undefined;
219
+ for (const key in params) {
220
+ if (acceptedPath.includes(key)) {
221
+ continue;
222
+ }
223
+ else if (key !== 'body') {
224
+ // @ts-expect-error
225
+ querystring[key] = params[key];
226
+ }
227
+ }
228
+ const method = 'DELETE';
229
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
230
+ return await this.transport.request({ path, method, querystring, body }, options);
231
+ }
232
+ async deleteModelSnapshot(params, options) {
233
+ const acceptedPath = ['job_id', 'snapshot_id'];
234
+ const querystring = {};
235
+ const body = undefined;
236
+ for (const key in params) {
237
+ if (acceptedPath.includes(key)) {
238
+ continue;
239
+ }
240
+ else if (key !== 'body') {
241
+ // @ts-expect-error
242
+ querystring[key] = params[key];
243
+ }
244
+ }
245
+ const method = 'DELETE';
246
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}`;
247
+ return await this.transport.request({ path, method, querystring, body }, options);
248
+ }
249
+ async deleteTrainedModel(params, options) {
250
+ const acceptedPath = ['model_id'];
251
+ const querystring = {};
252
+ const body = undefined;
253
+ for (const key in params) {
254
+ if (acceptedPath.includes(key)) {
255
+ continue;
256
+ }
257
+ else if (key !== 'body') {
258
+ // @ts-expect-error
259
+ querystring[key] = params[key];
260
+ }
261
+ }
262
+ const method = 'DELETE';
263
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
264
+ return await this.transport.request({ path, method, querystring, body }, options);
265
+ }
266
+ async deleteTrainedModelAlias(params, options) {
267
+ const acceptedPath = ['model_alias', 'model_id'];
268
+ const querystring = {};
269
+ const body = undefined;
270
+ for (const key in params) {
271
+ if (acceptedPath.includes(key)) {
272
+ continue;
273
+ }
274
+ else if (key !== 'body') {
275
+ // @ts-expect-error
276
+ querystring[key] = params[key];
277
+ }
278
+ }
279
+ const method = 'DELETE';
280
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/model_aliases/${encodeURIComponent(params.model_alias.toString())}`;
281
+ return await this.transport.request({ path, method, querystring, body }, options);
282
+ }
283
+ async estimateModelMemory(params, options) {
284
+ const acceptedPath = [];
285
+ const acceptedBody = ['analysis_config', 'max_bucket_cardinality', 'overall_cardinality'];
286
+ const querystring = {};
287
+ // @ts-expect-error
288
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
289
+ let body;
290
+ if (typeof userBody === 'string') {
291
+ body = userBody;
292
+ }
293
+ else {
294
+ body = userBody != null ? { ...userBody } : undefined;
295
+ }
296
+ params = params !== null && params !== void 0 ? params : {};
297
+ for (const key in params) {
298
+ if (acceptedBody.includes(key)) {
299
+ body = body !== null && body !== void 0 ? body : {};
300
+ // @ts-expect-error
301
+ body[key] = params[key];
302
+ }
303
+ else if (acceptedPath.includes(key)) {
304
+ continue;
305
+ }
306
+ else if (key !== 'body') {
307
+ // @ts-expect-error
308
+ querystring[key] = params[key];
309
+ }
310
+ }
311
+ const method = 'POST';
312
+ const path = '/_ml/anomaly_detectors/_estimate_model_memory';
313
+ return await this.transport.request({ path, method, querystring, body }, options);
314
+ }
315
+ async evaluateDataFrame(params, options) {
316
+ const acceptedPath = [];
317
+ const acceptedBody = ['evaluation', 'index', 'query'];
318
+ const querystring = {};
319
+ // @ts-expect-error
320
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
321
+ let body;
322
+ if (typeof userBody === 'string') {
323
+ body = userBody;
324
+ }
325
+ else {
326
+ body = userBody != null ? { ...userBody } : undefined;
327
+ }
328
+ for (const key in params) {
329
+ if (acceptedBody.includes(key)) {
330
+ body = body !== null && body !== void 0 ? body : {};
331
+ // @ts-expect-error
332
+ body[key] = params[key];
333
+ }
334
+ else if (acceptedPath.includes(key)) {
335
+ continue;
336
+ }
337
+ else if (key !== 'body') {
338
+ // @ts-expect-error
339
+ querystring[key] = params[key];
340
+ }
341
+ }
342
+ const method = 'POST';
343
+ const path = '/_ml/data_frame/_evaluate';
344
+ return await this.transport.request({ path, method, querystring, body }, options);
345
+ }
346
+ async explainDataFrameAnalytics(params, options) {
347
+ const acceptedPath = ['id'];
348
+ const acceptedBody = ['source', 'dest', 'analysis', 'description', 'model_memory_limit', 'max_num_threads', 'analyzed_fields', 'allow_lazy_start'];
349
+ const querystring = {};
350
+ // @ts-expect-error
351
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
352
+ let body;
353
+ if (typeof userBody === 'string') {
354
+ body = userBody;
355
+ }
356
+ else {
357
+ body = userBody != null ? { ...userBody } : undefined;
358
+ }
359
+ for (const key in params) {
360
+ if (acceptedBody.includes(key)) {
361
+ body = body !== null && body !== void 0 ? body : {};
362
+ // @ts-expect-error
363
+ body[key] = params[key];
364
+ }
365
+ else if (acceptedPath.includes(key)) {
366
+ continue;
367
+ }
368
+ else if (key !== 'body') {
369
+ // @ts-expect-error
370
+ querystring[key] = params[key];
371
+ }
372
+ }
373
+ let method = '';
374
+ let path = '';
375
+ if (params.id != null) {
376
+ method = body != null ? 'POST' : 'GET';
377
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_explain`;
378
+ }
379
+ else {
380
+ method = body != null ? 'POST' : 'GET';
381
+ path = '/_ml/data_frame/analytics/_explain';
382
+ }
383
+ return await this.transport.request({ path, method, querystring, body }, options);
384
+ }
385
+ async flushJob(params, options) {
386
+ const acceptedPath = ['job_id'];
387
+ const acceptedBody = ['advance_time', 'calc_interim', 'end', 'start'];
388
+ const querystring = {};
389
+ // @ts-expect-error
390
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
391
+ let body;
392
+ if (typeof userBody === 'string') {
393
+ body = userBody;
394
+ }
395
+ else {
396
+ body = userBody != null ? { ...userBody } : undefined;
397
+ }
398
+ for (const key in params) {
399
+ if (acceptedBody.includes(key)) {
400
+ body = body !== null && body !== void 0 ? body : {};
401
+ // @ts-expect-error
402
+ body[key] = params[key];
403
+ }
404
+ else if (acceptedPath.includes(key)) {
405
+ continue;
406
+ }
407
+ else if (key !== 'body') {
408
+ // @ts-expect-error
409
+ querystring[key] = params[key];
410
+ }
411
+ }
412
+ const method = 'POST';
413
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_flush`;
414
+ return await this.transport.request({ path, method, querystring, body }, options);
415
+ }
416
+ async forecast(params, options) {
417
+ const acceptedPath = ['job_id'];
418
+ const acceptedBody = ['duration', 'expires_in', 'max_model_memory'];
419
+ const querystring = {};
420
+ // @ts-expect-error
421
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
422
+ let body;
423
+ if (typeof userBody === 'string') {
424
+ body = userBody;
425
+ }
426
+ else {
427
+ body = userBody != null ? { ...userBody } : undefined;
428
+ }
429
+ for (const key in params) {
430
+ if (acceptedBody.includes(key)) {
431
+ body = body !== null && body !== void 0 ? body : {};
432
+ // @ts-expect-error
433
+ body[key] = params[key];
434
+ }
435
+ else if (acceptedPath.includes(key)) {
436
+ continue;
437
+ }
438
+ else if (key !== 'body') {
439
+ // @ts-expect-error
440
+ querystring[key] = params[key];
441
+ }
442
+ }
443
+ const method = 'POST';
444
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_forecast`;
445
+ return await this.transport.request({ path, method, querystring, body }, options);
446
+ }
447
+ async getBuckets(params, options) {
448
+ const acceptedPath = ['job_id', 'timestamp'];
449
+ const acceptedBody = ['anomaly_score', 'desc', 'exclude_interim', 'expand', 'sort', 'start', 'end'];
450
+ const querystring = {};
451
+ // @ts-expect-error
452
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
453
+ let body;
454
+ if (typeof userBody === 'string') {
455
+ body = userBody;
456
+ }
457
+ else {
458
+ body = userBody != null ? { ...userBody } : undefined;
459
+ }
460
+ for (const key in params) {
461
+ if (acceptedBody.includes(key)) {
462
+ body = body !== null && body !== void 0 ? body : {};
463
+ // @ts-expect-error
464
+ body[key] = params[key];
465
+ }
466
+ else if (acceptedPath.includes(key)) {
467
+ continue;
468
+ }
469
+ else if (key !== 'body') {
470
+ // @ts-expect-error
471
+ querystring[key] = params[key];
472
+ }
473
+ }
474
+ let method = '';
475
+ let path = '';
476
+ if (params.job_id != null && params.timestamp != null) {
477
+ method = body != null ? 'POST' : 'GET';
478
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/buckets/${encodeURIComponent(params.timestamp.toString())}`;
479
+ }
480
+ else {
481
+ method = body != null ? 'POST' : 'GET';
482
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/buckets`;
483
+ }
484
+ return await this.transport.request({ path, method, querystring, body }, options);
485
+ }
486
+ async getCalendarEvents(params, options) {
487
+ const acceptedPath = ['calendar_id'];
488
+ const querystring = {};
489
+ const body = undefined;
490
+ for (const key in params) {
491
+ if (acceptedPath.includes(key)) {
492
+ continue;
493
+ }
494
+ else if (key !== 'body') {
495
+ // @ts-expect-error
496
+ querystring[key] = params[key];
497
+ }
498
+ }
499
+ const method = 'GET';
500
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events`;
501
+ return await this.transport.request({ path, method, querystring, body }, options);
502
+ }
503
+ async getCalendars(params, options) {
504
+ const acceptedPath = ['calendar_id'];
505
+ const acceptedBody = ['page'];
506
+ const querystring = {};
507
+ // @ts-expect-error
508
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
509
+ let body;
510
+ if (typeof userBody === 'string') {
511
+ body = userBody;
512
+ }
513
+ else {
514
+ body = userBody != null ? { ...userBody } : undefined;
515
+ }
516
+ params = params !== null && params !== void 0 ? params : {};
517
+ for (const key in params) {
518
+ if (acceptedBody.includes(key)) {
519
+ body = body !== null && body !== void 0 ? body : {};
520
+ // @ts-expect-error
521
+ body[key] = params[key];
522
+ }
523
+ else if (acceptedPath.includes(key)) {
524
+ continue;
525
+ }
526
+ else if (key !== 'body') {
527
+ // @ts-expect-error
528
+ querystring[key] = params[key];
529
+ }
530
+ }
531
+ let method = '';
532
+ let path = '';
533
+ if (params.calendar_id != null) {
534
+ method = body != null ? 'POST' : 'GET';
535
+ path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
536
+ }
537
+ else {
538
+ method = body != null ? 'POST' : 'GET';
539
+ path = '/_ml/calendars';
540
+ }
541
+ return await this.transport.request({ path, method, querystring, body }, options);
542
+ }
543
+ async getCategories(params, options) {
544
+ const acceptedPath = ['job_id', 'category_id'];
545
+ const acceptedBody = ['page'];
546
+ const querystring = {};
547
+ // @ts-expect-error
548
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
549
+ let body;
550
+ if (typeof userBody === 'string') {
551
+ body = userBody;
552
+ }
553
+ else {
554
+ body = userBody != null ? { ...userBody } : undefined;
555
+ }
556
+ for (const key in params) {
557
+ if (acceptedBody.includes(key)) {
558
+ body = body !== null && body !== void 0 ? body : {};
559
+ // @ts-expect-error
560
+ body[key] = params[key];
561
+ }
562
+ else if (acceptedPath.includes(key)) {
563
+ continue;
564
+ }
565
+ else if (key !== 'body') {
566
+ // @ts-expect-error
567
+ querystring[key] = params[key];
568
+ }
569
+ }
570
+ let method = '';
571
+ let path = '';
572
+ if (params.job_id != null && params.category_id != null) {
573
+ method = body != null ? 'POST' : 'GET';
574
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories/${encodeURIComponent(params.category_id.toString())}`;
575
+ }
576
+ else {
577
+ method = body != null ? 'POST' : 'GET';
578
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/categories/`;
579
+ }
580
+ return await this.transport.request({ path, method, querystring, body }, options);
581
+ }
582
+ async getDataFrameAnalytics(params, options) {
583
+ const acceptedPath = ['id'];
584
+ const querystring = {};
585
+ const body = undefined;
586
+ params = params !== null && params !== void 0 ? params : {};
587
+ for (const key in params) {
588
+ if (acceptedPath.includes(key)) {
589
+ continue;
590
+ }
591
+ else if (key !== 'body') {
592
+ // @ts-expect-error
593
+ querystring[key] = params[key];
594
+ }
595
+ }
596
+ let method = '';
597
+ let path = '';
598
+ if (params.id != null) {
599
+ method = 'GET';
600
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
601
+ }
602
+ else {
603
+ method = 'GET';
604
+ path = '/_ml/data_frame/analytics';
605
+ }
606
+ return await this.transport.request({ path, method, querystring, body }, options);
607
+ }
608
+ async getDataFrameAnalyticsStats(params, options) {
609
+ const acceptedPath = ['id'];
610
+ const querystring = {};
611
+ const body = undefined;
612
+ params = params !== null && params !== void 0 ? params : {};
613
+ for (const key in params) {
614
+ if (acceptedPath.includes(key)) {
615
+ continue;
616
+ }
617
+ else if (key !== 'body') {
618
+ // @ts-expect-error
619
+ querystring[key] = params[key];
620
+ }
621
+ }
622
+ let method = '';
623
+ let path = '';
624
+ if (params.id != null) {
625
+ method = 'GET';
626
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_stats`;
627
+ }
628
+ else {
629
+ method = 'GET';
630
+ path = '/_ml/data_frame/analytics/_stats';
631
+ }
632
+ return await this.transport.request({ path, method, querystring, body }, options);
633
+ }
634
+ async getDatafeedStats(params, options) {
635
+ const acceptedPath = ['datafeed_id'];
636
+ const querystring = {};
637
+ const body = undefined;
638
+ params = params !== null && params !== void 0 ? params : {};
639
+ for (const key in params) {
640
+ if (acceptedPath.includes(key)) {
641
+ continue;
642
+ }
643
+ else if (key !== 'body') {
644
+ // @ts-expect-error
645
+ querystring[key] = params[key];
646
+ }
647
+ }
648
+ let method = '';
649
+ let path = '';
650
+ if (params.datafeed_id != null) {
651
+ method = 'GET';
652
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_stats`;
653
+ }
654
+ else {
655
+ method = 'GET';
656
+ path = '/_ml/datafeeds/_stats';
657
+ }
658
+ return await this.transport.request({ path, method, querystring, body }, options);
659
+ }
660
+ async getDatafeeds(params, options) {
661
+ const acceptedPath = ['datafeed_id'];
662
+ const querystring = {};
663
+ const body = undefined;
664
+ params = params !== null && params !== void 0 ? params : {};
665
+ for (const key in params) {
666
+ if (acceptedPath.includes(key)) {
667
+ continue;
668
+ }
669
+ else if (key !== 'body') {
670
+ // @ts-expect-error
671
+ querystring[key] = params[key];
672
+ }
673
+ }
674
+ let method = '';
675
+ let path = '';
676
+ if (params.datafeed_id != null) {
677
+ method = 'GET';
678
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
679
+ }
680
+ else {
681
+ method = 'GET';
682
+ path = '/_ml/datafeeds';
683
+ }
684
+ return await this.transport.request({ path, method, querystring, body }, options);
685
+ }
686
+ async getFilters(params, options) {
687
+ const acceptedPath = ['filter_id'];
688
+ const querystring = {};
689
+ const body = undefined;
690
+ params = params !== null && params !== void 0 ? params : {};
691
+ for (const key in params) {
692
+ if (acceptedPath.includes(key)) {
693
+ continue;
694
+ }
695
+ else if (key !== 'body') {
696
+ // @ts-expect-error
697
+ querystring[key] = params[key];
698
+ }
699
+ }
700
+ let method = '';
701
+ let path = '';
702
+ if (params.filter_id != null) {
703
+ method = 'GET';
704
+ path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
705
+ }
706
+ else {
707
+ method = 'GET';
708
+ path = '/_ml/filters';
709
+ }
710
+ return await this.transport.request({ path, method, querystring, body }, options);
711
+ }
712
+ async getInfluencers(params, options) {
713
+ const acceptedPath = ['job_id'];
714
+ const acceptedBody = ['page'];
715
+ const querystring = {};
716
+ // @ts-expect-error
717
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
718
+ let body;
719
+ if (typeof userBody === 'string') {
720
+ body = userBody;
721
+ }
722
+ else {
723
+ body = userBody != null ? { ...userBody } : undefined;
724
+ }
725
+ for (const key in params) {
726
+ if (acceptedBody.includes(key)) {
727
+ body = body !== null && body !== void 0 ? body : {};
728
+ // @ts-expect-error
729
+ body[key] = params[key];
730
+ }
731
+ else if (acceptedPath.includes(key)) {
732
+ continue;
733
+ }
734
+ else if (key !== 'body') {
735
+ // @ts-expect-error
736
+ querystring[key] = params[key];
737
+ }
738
+ }
739
+ const method = body != null ? 'POST' : 'GET';
740
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/influencers`;
741
+ return await this.transport.request({ path, method, querystring, body }, options);
742
+ }
743
+ async getJobStats(params, options) {
744
+ const acceptedPath = ['job_id'];
745
+ const querystring = {};
746
+ const body = undefined;
747
+ params = params !== null && params !== void 0 ? params : {};
748
+ for (const key in params) {
749
+ if (acceptedPath.includes(key)) {
750
+ continue;
751
+ }
752
+ else if (key !== 'body') {
753
+ // @ts-expect-error
754
+ querystring[key] = params[key];
755
+ }
756
+ }
757
+ let method = '';
758
+ let path = '';
759
+ if (params.job_id != null) {
760
+ method = 'GET';
761
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_stats`;
762
+ }
763
+ else {
764
+ method = 'GET';
765
+ path = '/_ml/anomaly_detectors/_stats';
766
+ }
767
+ return await this.transport.request({ path, method, querystring, body }, options);
768
+ }
769
+ async getJobs(params, options) {
770
+ const acceptedPath = ['job_id'];
771
+ const querystring = {};
772
+ const body = undefined;
773
+ params = params !== null && params !== void 0 ? params : {};
774
+ for (const key in params) {
775
+ if (acceptedPath.includes(key)) {
776
+ continue;
777
+ }
778
+ else if (key !== 'body') {
779
+ // @ts-expect-error
780
+ querystring[key] = params[key];
781
+ }
782
+ }
783
+ let method = '';
784
+ let path = '';
785
+ if (params.job_id != null) {
786
+ method = 'GET';
787
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
788
+ }
789
+ else {
790
+ method = 'GET';
791
+ path = '/_ml/anomaly_detectors';
792
+ }
793
+ return await this.transport.request({ path, method, querystring, body }, options);
794
+ }
795
+ async getModelSnapshots(params, options) {
796
+ const acceptedPath = ['job_id', 'snapshot_id'];
797
+ const acceptedBody = ['start', 'end'];
798
+ const querystring = {};
799
+ // @ts-expect-error
800
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
801
+ let body;
802
+ if (typeof userBody === 'string') {
803
+ body = userBody;
804
+ }
805
+ else {
806
+ body = userBody != null ? { ...userBody } : undefined;
807
+ }
808
+ for (const key in params) {
809
+ if (acceptedBody.includes(key)) {
810
+ body = body !== null && body !== void 0 ? body : {};
811
+ // @ts-expect-error
812
+ body[key] = params[key];
813
+ }
814
+ else if (acceptedPath.includes(key)) {
815
+ continue;
816
+ }
817
+ else if (key !== 'body') {
818
+ // @ts-expect-error
819
+ querystring[key] = params[key];
820
+ }
821
+ }
822
+ let method = '';
823
+ let path = '';
824
+ if (params.job_id != null && params.snapshot_id != null) {
825
+ method = body != null ? 'POST' : 'GET';
826
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}`;
827
+ }
828
+ else {
829
+ method = body != null ? 'POST' : 'GET';
830
+ path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots`;
831
+ }
832
+ return await this.transport.request({ path, method, querystring, body }, options);
833
+ }
834
+ async getOverallBuckets(params, options) {
835
+ const acceptedPath = ['job_id'];
836
+ const querystring = {};
837
+ const body = undefined;
838
+ for (const key in params) {
839
+ if (acceptedPath.includes(key)) {
840
+ continue;
841
+ }
842
+ else if (key !== 'body') {
843
+ // @ts-expect-error
844
+ querystring[key] = params[key];
845
+ }
846
+ }
847
+ const method = body != null ? 'POST' : 'GET';
848
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/overall_buckets`;
849
+ return await this.transport.request({ path, method, querystring, body }, options);
850
+ }
851
+ async getRecords(params, options) {
852
+ const acceptedPath = ['job_id'];
853
+ const acceptedBody = ['desc', 'exclude_interim', 'page', 'record_score', 'sort', 'start', 'end'];
854
+ const querystring = {};
855
+ // @ts-expect-error
856
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
857
+ let body;
858
+ if (typeof userBody === 'string') {
859
+ body = userBody;
860
+ }
861
+ else {
862
+ body = userBody != null ? { ...userBody } : undefined;
863
+ }
864
+ for (const key in params) {
865
+ if (acceptedBody.includes(key)) {
866
+ body = body !== null && body !== void 0 ? body : {};
867
+ // @ts-expect-error
868
+ body[key] = params[key];
869
+ }
870
+ else if (acceptedPath.includes(key)) {
871
+ continue;
872
+ }
873
+ else if (key !== 'body') {
874
+ // @ts-expect-error
875
+ querystring[key] = params[key];
876
+ }
877
+ }
878
+ const method = body != null ? 'POST' : 'GET';
879
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/results/records`;
880
+ return await this.transport.request({ path, method, querystring, body }, options);
881
+ }
882
+ async getTrainedModelDeploymentStats(params, options) {
883
+ const acceptedPath = ['model_id'];
884
+ const querystring = {};
885
+ const body = undefined;
886
+ params = params !== null && params !== void 0 ? params : {};
887
+ for (const key in params) {
888
+ if (acceptedPath.includes(key)) {
889
+ continue;
890
+ }
891
+ else if (key !== 'body') {
892
+ querystring[key] = params[key];
893
+ }
894
+ }
895
+ const method = 'GET';
896
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_stats`;
897
+ return await this.transport.request({ path, method, querystring, body }, options);
898
+ }
899
+ async getTrainedModels(params, options) {
900
+ const acceptedPath = ['model_id'];
901
+ const querystring = {};
902
+ const body = undefined;
903
+ params = params !== null && params !== void 0 ? params : {};
904
+ for (const key in params) {
905
+ if (acceptedPath.includes(key)) {
906
+ continue;
907
+ }
908
+ else if (key !== 'body') {
909
+ // @ts-expect-error
910
+ querystring[key] = params[key];
911
+ }
912
+ }
913
+ let method = '';
914
+ let path = '';
915
+ if (params.model_id != null) {
916
+ method = 'GET';
917
+ path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
918
+ }
919
+ else {
920
+ method = 'GET';
921
+ path = '/_ml/trained_models';
922
+ }
923
+ return await this.transport.request({ path, method, querystring, body }, options);
924
+ }
925
+ async getTrainedModelsStats(params, options) {
926
+ const acceptedPath = ['model_id'];
927
+ const querystring = {};
928
+ const body = undefined;
929
+ params = params !== null && params !== void 0 ? params : {};
930
+ for (const key in params) {
931
+ if (acceptedPath.includes(key)) {
932
+ continue;
933
+ }
934
+ else if (key !== 'body') {
935
+ // @ts-expect-error
936
+ querystring[key] = params[key];
937
+ }
938
+ }
939
+ let method = '';
940
+ let path = '';
941
+ if (params.model_id != null) {
942
+ method = 'GET';
943
+ path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/_stats`;
944
+ }
945
+ else {
946
+ method = 'GET';
947
+ path = '/_ml/trained_models/_stats';
948
+ }
949
+ return await this.transport.request({ path, method, querystring, body }, options);
950
+ }
951
+ async inferTrainedModelDeployment(params, options) {
952
+ const acceptedPath = ['model_id'];
953
+ const querystring = {};
954
+ const body = undefined;
955
+ params = params !== null && params !== void 0 ? params : {};
956
+ for (const key in params) {
957
+ if (acceptedPath.includes(key)) {
958
+ continue;
959
+ }
960
+ else if (key !== 'body') {
961
+ querystring[key] = params[key];
962
+ }
963
+ }
964
+ const method = 'POST';
965
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_infer`;
966
+ return await this.transport.request({ path, method, querystring, body }, options);
967
+ }
968
+ async info(params, options) {
969
+ const acceptedPath = [];
970
+ const querystring = {};
971
+ const body = undefined;
972
+ params = params !== null && params !== void 0 ? params : {};
973
+ for (const key in params) {
974
+ if (acceptedPath.includes(key)) {
975
+ continue;
976
+ }
977
+ else if (key !== 'body') {
978
+ // @ts-expect-error
979
+ querystring[key] = params[key];
980
+ }
981
+ }
982
+ const method = 'GET';
983
+ const path = '/_ml/info';
984
+ return await this.transport.request({ path, method, querystring, body }, options);
985
+ }
986
+ async openJob(params, options) {
987
+ const acceptedPath = ['job_id'];
988
+ const acceptedBody = ['timeout'];
989
+ const querystring = {};
990
+ // @ts-expect-error
991
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
992
+ let body;
993
+ if (typeof userBody === 'string') {
994
+ body = userBody;
995
+ }
996
+ else {
997
+ body = userBody != null ? { ...userBody } : undefined;
998
+ }
999
+ for (const key in params) {
1000
+ if (acceptedBody.includes(key)) {
1001
+ body = body !== null && body !== void 0 ? body : {};
1002
+ // @ts-expect-error
1003
+ body[key] = params[key];
1004
+ }
1005
+ else if (acceptedPath.includes(key)) {
1006
+ continue;
1007
+ }
1008
+ else if (key !== 'body') {
1009
+ // @ts-expect-error
1010
+ querystring[key] = params[key];
1011
+ }
1012
+ }
1013
+ const method = 'POST';
1014
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_open`;
1015
+ return await this.transport.request({ path, method, querystring, body }, options);
1016
+ }
1017
+ async postCalendarEvents(params, options) {
1018
+ const acceptedPath = ['calendar_id'];
1019
+ const acceptedBody = ['events'];
1020
+ const querystring = {};
1021
+ // @ts-expect-error
1022
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1023
+ let body;
1024
+ if (typeof userBody === 'string') {
1025
+ body = userBody;
1026
+ }
1027
+ else {
1028
+ body = userBody != null ? { ...userBody } : undefined;
1029
+ }
1030
+ for (const key in params) {
1031
+ if (acceptedBody.includes(key)) {
1032
+ body = body !== null && body !== void 0 ? body : {};
1033
+ // @ts-expect-error
1034
+ body[key] = params[key];
1035
+ }
1036
+ else if (acceptedPath.includes(key)) {
1037
+ continue;
1038
+ }
1039
+ else if (key !== 'body') {
1040
+ // @ts-expect-error
1041
+ querystring[key] = params[key];
1042
+ }
1043
+ }
1044
+ const method = 'POST';
1045
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/events`;
1046
+ return await this.transport.request({ path, method, querystring, body }, options);
1047
+ }
1048
+ async postData(params, options) {
1049
+ var _a;
1050
+ const acceptedPath = ['job_id'];
1051
+ const acceptedBody = ['data'];
1052
+ const querystring = {};
1053
+ // @ts-expect-error
1054
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1055
+ for (const key in params) {
1056
+ if (acceptedBody.includes(key)) {
1057
+ // @ts-expect-error
1058
+ body = params[key];
1059
+ }
1060
+ else if (acceptedPath.includes(key)) {
1061
+ continue;
1062
+ }
1063
+ else if (key !== 'body') {
1064
+ // @ts-expect-error
1065
+ querystring[key] = params[key];
1066
+ }
1067
+ }
1068
+ const method = 'POST';
1069
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_data`;
1070
+ return await this.transport.request({ path, method, querystring, bulkBody: body }, options);
1071
+ }
1072
+ async previewDataFrameAnalytics(params, options) {
1073
+ const acceptedPath = ['id'];
1074
+ const acceptedBody = ['config'];
1075
+ const querystring = {};
1076
+ // @ts-expect-error
1077
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1078
+ let body;
1079
+ if (typeof userBody === 'string') {
1080
+ body = userBody;
1081
+ }
1082
+ else {
1083
+ body = userBody != null ? { ...userBody } : undefined;
1084
+ }
1085
+ params = params !== null && params !== void 0 ? params : {};
1086
+ for (const key in params) {
1087
+ if (acceptedBody.includes(key)) {
1088
+ body = body !== null && body !== void 0 ? body : {};
1089
+ // @ts-expect-error
1090
+ body[key] = params[key];
1091
+ }
1092
+ else if (acceptedPath.includes(key)) {
1093
+ continue;
1094
+ }
1095
+ else if (key !== 'body') {
1096
+ // @ts-expect-error
1097
+ querystring[key] = params[key];
1098
+ }
1099
+ }
1100
+ let method = '';
1101
+ let path = '';
1102
+ if (params.id != null) {
1103
+ method = body != null ? 'POST' : 'GET';
1104
+ path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_preview`;
1105
+ }
1106
+ else {
1107
+ method = body != null ? 'POST' : 'GET';
1108
+ path = '/_ml/data_frame/analytics/_preview';
1109
+ }
1110
+ return await this.transport.request({ path, method, querystring, body }, options);
1111
+ }
1112
+ async previewDatafeed(params, options) {
1113
+ const acceptedPath = ['datafeed_id'];
1114
+ const acceptedBody = ['datafeed_config', 'job_config'];
1115
+ const querystring = {};
1116
+ // @ts-expect-error
1117
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1118
+ let body;
1119
+ if (typeof userBody === 'string') {
1120
+ body = userBody;
1121
+ }
1122
+ else {
1123
+ body = userBody != null ? { ...userBody } : undefined;
1124
+ }
1125
+ params = params !== null && params !== void 0 ? params : {};
1126
+ for (const key in params) {
1127
+ if (acceptedBody.includes(key)) {
1128
+ body = body !== null && body !== void 0 ? body : {};
1129
+ // @ts-expect-error
1130
+ body[key] = params[key];
1131
+ }
1132
+ else if (acceptedPath.includes(key)) {
1133
+ continue;
1134
+ }
1135
+ else if (key !== 'body') {
1136
+ // @ts-expect-error
1137
+ querystring[key] = params[key];
1138
+ }
1139
+ }
1140
+ let method = '';
1141
+ let path = '';
1142
+ if (params.datafeed_id != null) {
1143
+ method = body != null ? 'POST' : 'GET';
1144
+ path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_preview`;
1145
+ }
1146
+ else {
1147
+ method = body != null ? 'POST' : 'GET';
1148
+ path = '/_ml/datafeeds/_preview';
1149
+ }
1150
+ return await this.transport.request({ path, method, querystring, body }, options);
1151
+ }
1152
+ async putCalendar(params, options) {
1153
+ const acceptedPath = ['calendar_id'];
1154
+ const acceptedBody = ['description'];
1155
+ const querystring = {};
1156
+ // @ts-expect-error
1157
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1158
+ let body;
1159
+ if (typeof userBody === 'string') {
1160
+ body = userBody;
1161
+ }
1162
+ else {
1163
+ body = userBody != null ? { ...userBody } : undefined;
1164
+ }
1165
+ for (const key in params) {
1166
+ if (acceptedBody.includes(key)) {
1167
+ body = body !== null && body !== void 0 ? body : {};
1168
+ // @ts-expect-error
1169
+ body[key] = params[key];
1170
+ }
1171
+ else if (acceptedPath.includes(key)) {
1172
+ continue;
1173
+ }
1174
+ else if (key !== 'body') {
1175
+ // @ts-expect-error
1176
+ querystring[key] = params[key];
1177
+ }
1178
+ }
1179
+ const method = 'PUT';
1180
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}`;
1181
+ return await this.transport.request({ path, method, querystring, body }, options);
1182
+ }
1183
+ async putCalendarJob(params, options) {
1184
+ const acceptedPath = ['calendar_id', 'job_id'];
1185
+ const querystring = {};
1186
+ const body = undefined;
1187
+ for (const key in params) {
1188
+ if (acceptedPath.includes(key)) {
1189
+ continue;
1190
+ }
1191
+ else if (key !== 'body') {
1192
+ // @ts-expect-error
1193
+ querystring[key] = params[key];
1194
+ }
1195
+ }
1196
+ const method = 'PUT';
1197
+ const path = `/_ml/calendars/${encodeURIComponent(params.calendar_id.toString())}/jobs/${encodeURIComponent(params.job_id.toString())}`;
1198
+ return await this.transport.request({ path, method, querystring, body }, options);
1199
+ }
1200
+ async putDataFrameAnalytics(params, options) {
1201
+ const acceptedPath = ['id'];
1202
+ const acceptedBody = ['allow_lazy_start', 'analysis', 'analyzed_fields', 'description', 'dest', 'max_num_threads', 'model_memory_limit', 'source'];
1203
+ const querystring = {};
1204
+ // @ts-expect-error
1205
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1206
+ let body;
1207
+ if (typeof userBody === 'string') {
1208
+ body = userBody;
1209
+ }
1210
+ else {
1211
+ body = userBody != null ? { ...userBody } : undefined;
1212
+ }
1213
+ for (const key in params) {
1214
+ if (acceptedBody.includes(key)) {
1215
+ body = body !== null && body !== void 0 ? body : {};
1216
+ // @ts-expect-error
1217
+ body[key] = params[key];
1218
+ }
1219
+ else if (acceptedPath.includes(key)) {
1220
+ continue;
1221
+ }
1222
+ else if (key !== 'body') {
1223
+ // @ts-expect-error
1224
+ querystring[key] = params[key];
1225
+ }
1226
+ }
1227
+ const method = 'PUT';
1228
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}`;
1229
+ return await this.transport.request({ path, method, querystring, body }, options);
1230
+ }
1231
+ async putDatafeed(params, options) {
1232
+ const acceptedPath = ['datafeed_id'];
1233
+ const acceptedBody = ['aggregations', 'chunking_config', 'delayed_data_check_config', 'frequency', 'indices', 'indices_options', 'job_id', 'max_empty_searches', 'query', 'query_delay', 'runtime_mappings', 'script_fields', 'scroll_size'];
1234
+ const querystring = {};
1235
+ // @ts-expect-error
1236
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1237
+ let body;
1238
+ if (typeof userBody === 'string') {
1239
+ body = userBody;
1240
+ }
1241
+ else {
1242
+ body = userBody != null ? { ...userBody } : undefined;
1243
+ }
1244
+ for (const key in params) {
1245
+ if (acceptedBody.includes(key)) {
1246
+ body = body !== null && body !== void 0 ? body : {};
1247
+ // @ts-expect-error
1248
+ body[key] = params[key];
1249
+ }
1250
+ else if (acceptedPath.includes(key)) {
1251
+ continue;
1252
+ }
1253
+ else if (key !== 'body') {
1254
+ // @ts-expect-error
1255
+ querystring[key] = params[key];
1256
+ }
1257
+ }
1258
+ const method = 'PUT';
1259
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}`;
1260
+ return await this.transport.request({ path, method, querystring, body }, options);
1261
+ }
1262
+ async putFilter(params, options) {
1263
+ const acceptedPath = ['filter_id'];
1264
+ const acceptedBody = ['description', 'items'];
1265
+ const querystring = {};
1266
+ // @ts-expect-error
1267
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1268
+ let body;
1269
+ if (typeof userBody === 'string') {
1270
+ body = userBody;
1271
+ }
1272
+ else {
1273
+ body = userBody != null ? { ...userBody } : undefined;
1274
+ }
1275
+ for (const key in params) {
1276
+ if (acceptedBody.includes(key)) {
1277
+ body = body !== null && body !== void 0 ? body : {};
1278
+ // @ts-expect-error
1279
+ body[key] = params[key];
1280
+ }
1281
+ else if (acceptedPath.includes(key)) {
1282
+ continue;
1283
+ }
1284
+ else if (key !== 'body') {
1285
+ // @ts-expect-error
1286
+ querystring[key] = params[key];
1287
+ }
1288
+ }
1289
+ const method = 'PUT';
1290
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}`;
1291
+ return await this.transport.request({ path, method, querystring, body }, options);
1292
+ }
1293
+ async putJob(params, options) {
1294
+ const acceptedPath = ['job_id'];
1295
+ const acceptedBody = ['allow_lazy_open', 'analysis_config', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'daily_model_snapshot_retention_after_days', 'data_description', 'datafeed_config', 'description', 'groups', 'model_plot_config', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_index_name', 'results_retention_days'];
1296
+ const querystring = {};
1297
+ // @ts-expect-error
1298
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1299
+ let body;
1300
+ if (typeof userBody === 'string') {
1301
+ body = userBody;
1302
+ }
1303
+ else {
1304
+ body = userBody != null ? { ...userBody } : undefined;
1305
+ }
1306
+ for (const key in params) {
1307
+ if (acceptedBody.includes(key)) {
1308
+ body = body !== null && body !== void 0 ? body : {};
1309
+ // @ts-expect-error
1310
+ body[key] = params[key];
1311
+ }
1312
+ else if (acceptedPath.includes(key)) {
1313
+ continue;
1314
+ }
1315
+ else if (key !== 'body') {
1316
+ // @ts-expect-error
1317
+ querystring[key] = params[key];
1318
+ }
1319
+ }
1320
+ const method = 'PUT';
1321
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}`;
1322
+ return await this.transport.request({ path, method, querystring, body }, options);
1323
+ }
1324
+ async putTrainedModel(params, options) {
1325
+ const acceptedPath = ['model_id'];
1326
+ const acceptedBody = ['compressed_definition', 'definition', 'description', 'inference_config', 'input', 'metadata', 'tags'];
1327
+ const querystring = {};
1328
+ // @ts-expect-error
1329
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1330
+ let body;
1331
+ if (typeof userBody === 'string') {
1332
+ body = userBody;
1333
+ }
1334
+ else {
1335
+ body = userBody != null ? { ...userBody } : undefined;
1336
+ }
1337
+ for (const key in params) {
1338
+ if (acceptedBody.includes(key)) {
1339
+ body = body !== null && body !== void 0 ? body : {};
1340
+ // @ts-expect-error
1341
+ body[key] = params[key];
1342
+ }
1343
+ else if (acceptedPath.includes(key)) {
1344
+ continue;
1345
+ }
1346
+ else if (key !== 'body') {
1347
+ // @ts-expect-error
1348
+ querystring[key] = params[key];
1349
+ }
1350
+ }
1351
+ const method = 'PUT';
1352
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}`;
1353
+ return await this.transport.request({ path, method, querystring, body }, options);
1354
+ }
1355
+ async putTrainedModelAlias(params, options) {
1356
+ const acceptedPath = ['model_alias', 'model_id'];
1357
+ const querystring = {};
1358
+ const body = undefined;
1359
+ for (const key in params) {
1360
+ if (acceptedPath.includes(key)) {
1361
+ continue;
1362
+ }
1363
+ else if (key !== 'body') {
1364
+ // @ts-expect-error
1365
+ querystring[key] = params[key];
1366
+ }
1367
+ }
1368
+ const method = 'PUT';
1369
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/model_aliases/${encodeURIComponent(params.model_alias.toString())}`;
1370
+ return await this.transport.request({ path, method, querystring, body }, options);
1371
+ }
1372
+ async putTrainedModelDefinitionPart(params, options) {
1373
+ const acceptedPath = ['model_id', 'part'];
1374
+ const querystring = {};
1375
+ const body = undefined;
1376
+ params = params !== null && params !== void 0 ? params : {};
1377
+ for (const key in params) {
1378
+ if (acceptedPath.includes(key)) {
1379
+ continue;
1380
+ }
1381
+ else if (key !== 'body') {
1382
+ querystring[key] = params[key];
1383
+ }
1384
+ }
1385
+ const method = 'PUT';
1386
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/definition/${encodeURIComponent(params.part.toString())}`;
1387
+ return await this.transport.request({ path, method, querystring, body }, options);
1388
+ }
1389
+ async putTrainedModelVocabulary(params, options) {
1390
+ const acceptedPath = ['model_id'];
1391
+ const querystring = {};
1392
+ const body = undefined;
1393
+ params = params !== null && params !== void 0 ? params : {};
1394
+ for (const key in params) {
1395
+ if (acceptedPath.includes(key)) {
1396
+ continue;
1397
+ }
1398
+ else if (key !== 'body') {
1399
+ querystring[key] = params[key];
1400
+ }
1401
+ }
1402
+ const method = 'PUT';
1403
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/vocabulary`;
1404
+ return await this.transport.request({ path, method, querystring, body }, options);
1405
+ }
1406
+ async resetJob(params, options) {
1407
+ const acceptedPath = ['job_id'];
1408
+ const querystring = {};
1409
+ const body = undefined;
1410
+ for (const key in params) {
1411
+ if (acceptedPath.includes(key)) {
1412
+ continue;
1413
+ }
1414
+ else if (key !== 'body') {
1415
+ // @ts-expect-error
1416
+ querystring[key] = params[key];
1417
+ }
1418
+ }
1419
+ const method = 'POST';
1420
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_reset`;
1421
+ return await this.transport.request({ path, method, querystring, body }, options);
1422
+ }
1423
+ async revertModelSnapshot(params, options) {
1424
+ const acceptedPath = ['job_id', 'snapshot_id'];
1425
+ const acceptedBody = ['delete_intervening_results'];
1426
+ const querystring = {};
1427
+ // @ts-expect-error
1428
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1429
+ let body;
1430
+ if (typeof userBody === 'string') {
1431
+ body = userBody;
1432
+ }
1433
+ else {
1434
+ body = userBody != null ? { ...userBody } : undefined;
1435
+ }
1436
+ for (const key in params) {
1437
+ if (acceptedBody.includes(key)) {
1438
+ body = body !== null && body !== void 0 ? body : {};
1439
+ // @ts-expect-error
1440
+ body[key] = params[key];
1441
+ }
1442
+ else if (acceptedPath.includes(key)) {
1443
+ continue;
1444
+ }
1445
+ else if (key !== 'body') {
1446
+ // @ts-expect-error
1447
+ querystring[key] = params[key];
1448
+ }
1449
+ }
1450
+ const method = 'POST';
1451
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_revert`;
1452
+ return await this.transport.request({ path, method, querystring, body }, options);
1453
+ }
1454
+ async setUpgradeMode(params, options) {
1455
+ const acceptedPath = [];
1456
+ const querystring = {};
1457
+ const body = undefined;
1458
+ params = params !== null && params !== void 0 ? params : {};
1459
+ for (const key in params) {
1460
+ if (acceptedPath.includes(key)) {
1461
+ continue;
1462
+ }
1463
+ else if (key !== 'body') {
1464
+ // @ts-expect-error
1465
+ querystring[key] = params[key];
1466
+ }
1467
+ }
1468
+ const method = 'POST';
1469
+ const path = '/_ml/set_upgrade_mode';
1470
+ return await this.transport.request({ path, method, querystring, body }, options);
1471
+ }
1472
+ async startDataFrameAnalytics(params, options) {
1473
+ const acceptedPath = ['id'];
1474
+ const querystring = {};
1475
+ const body = undefined;
1476
+ for (const key in params) {
1477
+ if (acceptedPath.includes(key)) {
1478
+ continue;
1479
+ }
1480
+ else if (key !== 'body') {
1481
+ // @ts-expect-error
1482
+ querystring[key] = params[key];
1483
+ }
1484
+ }
1485
+ const method = 'POST';
1486
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_start`;
1487
+ return await this.transport.request({ path, method, querystring, body }, options);
1488
+ }
1489
+ async startDatafeed(params, options) {
1490
+ const acceptedPath = ['datafeed_id'];
1491
+ const acceptedBody = ['end', 'start', 'timeout'];
1492
+ const querystring = {};
1493
+ // @ts-expect-error
1494
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1495
+ let body;
1496
+ if (typeof userBody === 'string') {
1497
+ body = userBody;
1498
+ }
1499
+ else {
1500
+ body = userBody != null ? { ...userBody } : undefined;
1501
+ }
1502
+ for (const key in params) {
1503
+ if (acceptedBody.includes(key)) {
1504
+ body = body !== null && body !== void 0 ? body : {};
1505
+ // @ts-expect-error
1506
+ body[key] = params[key];
1507
+ }
1508
+ else if (acceptedPath.includes(key)) {
1509
+ continue;
1510
+ }
1511
+ else if (key !== 'body') {
1512
+ // @ts-expect-error
1513
+ querystring[key] = params[key];
1514
+ }
1515
+ }
1516
+ const method = 'POST';
1517
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_start`;
1518
+ return await this.transport.request({ path, method, querystring, body }, options);
1519
+ }
1520
+ async startTrainedModelDeployment(params, options) {
1521
+ const acceptedPath = ['model_id'];
1522
+ const querystring = {};
1523
+ const body = undefined;
1524
+ params = params !== null && params !== void 0 ? params : {};
1525
+ for (const key in params) {
1526
+ if (acceptedPath.includes(key)) {
1527
+ continue;
1528
+ }
1529
+ else if (key !== 'body') {
1530
+ querystring[key] = params[key];
1531
+ }
1532
+ }
1533
+ const method = 'POST';
1534
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_start`;
1535
+ return await this.transport.request({ path, method, querystring, body }, options);
1536
+ }
1537
+ async stopDataFrameAnalytics(params, options) {
1538
+ const acceptedPath = ['id'];
1539
+ const querystring = {};
1540
+ const body = undefined;
1541
+ for (const key in params) {
1542
+ if (acceptedPath.includes(key)) {
1543
+ continue;
1544
+ }
1545
+ else if (key !== 'body') {
1546
+ // @ts-expect-error
1547
+ querystring[key] = params[key];
1548
+ }
1549
+ }
1550
+ const method = 'POST';
1551
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_stop`;
1552
+ return await this.transport.request({ path, method, querystring, body }, options);
1553
+ }
1554
+ async stopDatafeed(params, options) {
1555
+ const acceptedPath = ['datafeed_id'];
1556
+ const acceptedBody = ['force', 'timeout'];
1557
+ const querystring = {};
1558
+ // @ts-expect-error
1559
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1560
+ let body;
1561
+ if (typeof userBody === 'string') {
1562
+ body = userBody;
1563
+ }
1564
+ else {
1565
+ body = userBody != null ? { ...userBody } : undefined;
1566
+ }
1567
+ for (const key in params) {
1568
+ if (acceptedBody.includes(key)) {
1569
+ body = body !== null && body !== void 0 ? body : {};
1570
+ // @ts-expect-error
1571
+ body[key] = params[key];
1572
+ }
1573
+ else if (acceptedPath.includes(key)) {
1574
+ continue;
1575
+ }
1576
+ else if (key !== 'body') {
1577
+ // @ts-expect-error
1578
+ querystring[key] = params[key];
1579
+ }
1580
+ }
1581
+ const method = 'POST';
1582
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_stop`;
1583
+ return await this.transport.request({ path, method, querystring, body }, options);
1584
+ }
1585
+ async stopTrainedModelDeployment(params, options) {
1586
+ const acceptedPath = ['model_id'];
1587
+ const querystring = {};
1588
+ const body = undefined;
1589
+ params = params !== null && params !== void 0 ? params : {};
1590
+ for (const key in params) {
1591
+ if (acceptedPath.includes(key)) {
1592
+ continue;
1593
+ }
1594
+ else if (key !== 'body') {
1595
+ querystring[key] = params[key];
1596
+ }
1597
+ }
1598
+ const method = 'POST';
1599
+ const path = `/_ml/trained_models/${encodeURIComponent(params.model_id.toString())}/deployment/_stop`;
1600
+ return await this.transport.request({ path, method, querystring, body }, options);
1601
+ }
1602
+ async updateDataFrameAnalytics(params, options) {
1603
+ const acceptedPath = ['id'];
1604
+ const acceptedBody = ['description', 'model_memory_limit', 'max_num_threads', 'allow_lazy_start'];
1605
+ const querystring = {};
1606
+ // @ts-expect-error
1607
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1608
+ let body;
1609
+ if (typeof userBody === 'string') {
1610
+ body = userBody;
1611
+ }
1612
+ else {
1613
+ body = userBody != null ? { ...userBody } : undefined;
1614
+ }
1615
+ for (const key in params) {
1616
+ if (acceptedBody.includes(key)) {
1617
+ body = body !== null && body !== void 0 ? body : {};
1618
+ // @ts-expect-error
1619
+ body[key] = params[key];
1620
+ }
1621
+ else if (acceptedPath.includes(key)) {
1622
+ continue;
1623
+ }
1624
+ else if (key !== 'body') {
1625
+ // @ts-expect-error
1626
+ querystring[key] = params[key];
1627
+ }
1628
+ }
1629
+ const method = 'POST';
1630
+ const path = `/_ml/data_frame/analytics/${encodeURIComponent(params.id.toString())}/_update`;
1631
+ return await this.transport.request({ path, method, querystring, body }, options);
1632
+ }
1633
+ async updateDatafeed(params, options) {
1634
+ const acceptedPath = ['datafeed_id'];
1635
+ const querystring = {};
1636
+ const body = undefined;
1637
+ params = params !== null && params !== void 0 ? params : {};
1638
+ for (const key in params) {
1639
+ if (acceptedPath.includes(key)) {
1640
+ continue;
1641
+ }
1642
+ else if (key !== 'body') {
1643
+ querystring[key] = params[key];
1644
+ }
1645
+ }
1646
+ const method = 'POST';
1647
+ const path = `/_ml/datafeeds/${encodeURIComponent(params.datafeed_id.toString())}/_update`;
1648
+ return await this.transport.request({ path, method, querystring, body }, options);
1649
+ }
1650
+ async updateFilter(params, options) {
1651
+ const acceptedPath = ['filter_id'];
1652
+ const acceptedBody = ['add_items', 'description', 'remove_items'];
1653
+ const querystring = {};
1654
+ // @ts-expect-error
1655
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1656
+ let body;
1657
+ if (typeof userBody === 'string') {
1658
+ body = userBody;
1659
+ }
1660
+ else {
1661
+ body = userBody != null ? { ...userBody } : undefined;
1662
+ }
1663
+ for (const key in params) {
1664
+ if (acceptedBody.includes(key)) {
1665
+ body = body !== null && body !== void 0 ? body : {};
1666
+ // @ts-expect-error
1667
+ body[key] = params[key];
1668
+ }
1669
+ else if (acceptedPath.includes(key)) {
1670
+ continue;
1671
+ }
1672
+ else if (key !== 'body') {
1673
+ // @ts-expect-error
1674
+ querystring[key] = params[key];
1675
+ }
1676
+ }
1677
+ const method = 'POST';
1678
+ const path = `/_ml/filters/${encodeURIComponent(params.filter_id.toString())}/_update`;
1679
+ return await this.transport.request({ path, method, querystring, body }, options);
1680
+ }
1681
+ async updateJob(params, options) {
1682
+ const acceptedPath = ['job_id'];
1683
+ const acceptedBody = ['allow_lazy_open', 'analysis_limits', 'background_persist_interval', 'custom_settings', 'categorization_filters', 'description', 'model_plot_config', 'daily_model_snapshot_retention_after_days', 'model_snapshot_retention_days', 'renormalization_window_days', 'results_retention_days', 'groups', 'detectors', 'per_partition_categorization'];
1684
+ const querystring = {};
1685
+ // @ts-expect-error
1686
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1687
+ let body;
1688
+ if (typeof userBody === 'string') {
1689
+ body = userBody;
1690
+ }
1691
+ else {
1692
+ body = userBody != null ? { ...userBody } : undefined;
1693
+ }
1694
+ for (const key in params) {
1695
+ if (acceptedBody.includes(key)) {
1696
+ body = body !== null && body !== void 0 ? body : {};
1697
+ // @ts-expect-error
1698
+ body[key] = params[key];
1699
+ }
1700
+ else if (acceptedPath.includes(key)) {
1701
+ continue;
1702
+ }
1703
+ else if (key !== 'body') {
1704
+ // @ts-expect-error
1705
+ querystring[key] = params[key];
1706
+ }
1707
+ }
1708
+ const method = 'POST';
1709
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/_update`;
1710
+ return await this.transport.request({ path, method, querystring, body }, options);
1711
+ }
1712
+ async updateModelSnapshot(params, options) {
1713
+ const acceptedPath = ['job_id', 'snapshot_id'];
1714
+ const acceptedBody = ['description', 'retain'];
1715
+ const querystring = {};
1716
+ // @ts-expect-error
1717
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1718
+ let body;
1719
+ if (typeof userBody === 'string') {
1720
+ body = userBody;
1721
+ }
1722
+ else {
1723
+ body = userBody != null ? { ...userBody } : undefined;
1724
+ }
1725
+ for (const key in params) {
1726
+ if (acceptedBody.includes(key)) {
1727
+ body = body !== null && body !== void 0 ? body : {};
1728
+ // @ts-expect-error
1729
+ body[key] = params[key];
1730
+ }
1731
+ else if (acceptedPath.includes(key)) {
1732
+ continue;
1733
+ }
1734
+ else if (key !== 'body') {
1735
+ // @ts-expect-error
1736
+ querystring[key] = params[key];
1737
+ }
1738
+ }
1739
+ const method = 'POST';
1740
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_update`;
1741
+ return await this.transport.request({ path, method, querystring, body }, options);
1742
+ }
1743
+ async upgradeJobSnapshot(params, options) {
1744
+ const acceptedPath = ['job_id', 'snapshot_id'];
1745
+ const querystring = {};
1746
+ const body = undefined;
1747
+ for (const key in params) {
1748
+ if (acceptedPath.includes(key)) {
1749
+ continue;
1750
+ }
1751
+ else if (key !== 'body') {
1752
+ // @ts-expect-error
1753
+ querystring[key] = params[key];
1754
+ }
1755
+ }
1756
+ const method = 'POST';
1757
+ const path = `/_ml/anomaly_detectors/${encodeURIComponent(params.job_id.toString())}/model_snapshots/${encodeURIComponent(params.snapshot_id.toString())}/_upgrade`;
1758
+ return await this.transport.request({ path, method, querystring, body }, options);
1759
+ }
1760
+ async validate(params, options) {
1761
+ const acceptedPath = [];
1762
+ const acceptedBody = ['job_id', 'analysis_config', 'analysis_limits', 'data_description', 'description', 'model_plot', 'model_snapshot_retention_days', 'results_index_name'];
1763
+ const querystring = {};
1764
+ // @ts-expect-error
1765
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1766
+ let body;
1767
+ if (typeof userBody === 'string') {
1768
+ body = userBody;
1769
+ }
1770
+ else {
1771
+ body = userBody != null ? { ...userBody } : undefined;
1772
+ }
1773
+ params = params !== null && params !== void 0 ? params : {};
1774
+ for (const key in params) {
1775
+ if (acceptedBody.includes(key)) {
1776
+ body = body !== null && body !== void 0 ? body : {};
1777
+ // @ts-expect-error
1778
+ body[key] = params[key];
1779
+ }
1780
+ else if (acceptedPath.includes(key)) {
1781
+ continue;
1782
+ }
1783
+ else if (key !== 'body') {
1784
+ // @ts-expect-error
1785
+ querystring[key] = params[key];
1786
+ }
1787
+ }
1788
+ const method = 'POST';
1789
+ const path = '/_ml/anomaly_detectors/_validate';
1790
+ return await this.transport.request({ path, method, querystring, body }, options);
1791
+ }
1792
+ async validateDetector(params, options) {
1793
+ var _a;
1794
+ const acceptedPath = [];
1795
+ const acceptedBody = ['detector'];
1796
+ const querystring = {};
1797
+ // @ts-expect-error
1798
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1799
+ for (const key in params) {
1800
+ if (acceptedBody.includes(key)) {
1801
+ // @ts-expect-error
1802
+ body = params[key];
1803
+ }
1804
+ else if (acceptedPath.includes(key)) {
1805
+ continue;
1806
+ }
1807
+ else if (key !== 'body') {
1808
+ // @ts-expect-error
1809
+ querystring[key] = params[key];
1810
+ }
1811
+ }
1812
+ const method = 'POST';
1813
+ const path = '/_ml/anomaly_detectors/_validate/detector';
1814
+ return await this.transport.request({ path, method, querystring, body }, options);
1815
+ }
1816
+ }
1817
+ exports.default = Ml;
1818
+ //# sourceMappingURL=ml.js.map