@retter/elasticsearch 8.4.0

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