@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,1381 @@
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 Indices {
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 addBlock(params, options) {
32
+ const acceptedPath = ['index', 'block'];
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 = 'PUT';
45
+ const path = `/${encodeURIComponent(params.index.toString())}/_block/${encodeURIComponent(params.block.toString())}`;
46
+ return await this.transport.request({ path, method, querystring, body }, options);
47
+ }
48
+ async analyze(params, options) {
49
+ const acceptedPath = ['index'];
50
+ const acceptedBody = ['analyzer', 'attributes', 'char_filter', 'explain', 'field', 'filter', 'normalizer', 'text', 'tokenizer'];
51
+ const querystring = {};
52
+ // @ts-expect-error
53
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
54
+ let body;
55
+ if (typeof userBody === 'string') {
56
+ body = userBody;
57
+ }
58
+ else {
59
+ body = userBody != null ? { ...userBody } : undefined;
60
+ }
61
+ params = params !== null && params !== void 0 ? params : {};
62
+ for (const key in params) {
63
+ if (acceptedBody.includes(key)) {
64
+ body = body !== null && body !== void 0 ? body : {};
65
+ // @ts-expect-error
66
+ body[key] = params[key];
67
+ }
68
+ else if (acceptedPath.includes(key)) {
69
+ continue;
70
+ }
71
+ else if (key !== 'body') {
72
+ // @ts-expect-error
73
+ querystring[key] = params[key];
74
+ }
75
+ }
76
+ let method = '';
77
+ let path = '';
78
+ if (params.index != null) {
79
+ method = body != null ? 'POST' : 'GET';
80
+ path = `/${encodeURIComponent(params.index.toString())}/_analyze`;
81
+ }
82
+ else {
83
+ method = body != null ? 'POST' : 'GET';
84
+ path = '/_analyze';
85
+ }
86
+ return await this.transport.request({ path, method, querystring, body }, options);
87
+ }
88
+ async clearCache(params, options) {
89
+ const acceptedPath = ['index'];
90
+ const querystring = {};
91
+ const body = undefined;
92
+ params = params !== null && params !== void 0 ? params : {};
93
+ for (const key in params) {
94
+ if (acceptedPath.includes(key)) {
95
+ continue;
96
+ }
97
+ else if (key !== 'body') {
98
+ // @ts-expect-error
99
+ querystring[key] = params[key];
100
+ }
101
+ }
102
+ let method = '';
103
+ let path = '';
104
+ if (params.index != null) {
105
+ method = 'POST';
106
+ path = `/${encodeURIComponent(params.index.toString())}/_cache/clear`;
107
+ }
108
+ else {
109
+ method = 'POST';
110
+ path = '/_cache/clear';
111
+ }
112
+ return await this.transport.request({ path, method, querystring, body }, options);
113
+ }
114
+ async clone(params, options) {
115
+ const acceptedPath = ['index', 'target'];
116
+ const acceptedBody = ['aliases', 'settings'];
117
+ const querystring = {};
118
+ // @ts-expect-error
119
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
120
+ let body;
121
+ if (typeof userBody === 'string') {
122
+ body = userBody;
123
+ }
124
+ else {
125
+ body = userBody != null ? { ...userBody } : undefined;
126
+ }
127
+ for (const key in params) {
128
+ if (acceptedBody.includes(key)) {
129
+ body = body !== null && body !== void 0 ? body : {};
130
+ // @ts-expect-error
131
+ body[key] = params[key];
132
+ }
133
+ else if (acceptedPath.includes(key)) {
134
+ continue;
135
+ }
136
+ else if (key !== 'body') {
137
+ // @ts-expect-error
138
+ querystring[key] = params[key];
139
+ }
140
+ }
141
+ const method = 'PUT';
142
+ const path = `/${encodeURIComponent(params.index.toString())}/_clone/${encodeURIComponent(params.target.toString())}`;
143
+ return await this.transport.request({ path, method, querystring, body }, options);
144
+ }
145
+ async close(params, options) {
146
+ const acceptedPath = ['index'];
147
+ const querystring = {};
148
+ const body = undefined;
149
+ for (const key in params) {
150
+ if (acceptedPath.includes(key)) {
151
+ continue;
152
+ }
153
+ else if (key !== 'body') {
154
+ // @ts-expect-error
155
+ querystring[key] = params[key];
156
+ }
157
+ }
158
+ const method = 'POST';
159
+ const path = `/${encodeURIComponent(params.index.toString())}/_close`;
160
+ return await this.transport.request({ path, method, querystring, body }, options);
161
+ }
162
+ async create(params, options) {
163
+ const acceptedPath = ['index'];
164
+ const acceptedBody = ['aliases', 'mappings', 'settings'];
165
+ const querystring = {};
166
+ // @ts-expect-error
167
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
168
+ let body;
169
+ if (typeof userBody === 'string') {
170
+ body = userBody;
171
+ }
172
+ else {
173
+ body = userBody != null ? { ...userBody } : undefined;
174
+ }
175
+ for (const key in params) {
176
+ if (acceptedBody.includes(key)) {
177
+ body = body !== null && body !== void 0 ? body : {};
178
+ // @ts-expect-error
179
+ body[key] = params[key];
180
+ }
181
+ else if (acceptedPath.includes(key)) {
182
+ continue;
183
+ }
184
+ else if (key !== 'body') {
185
+ // @ts-expect-error
186
+ querystring[key] = params[key];
187
+ }
188
+ }
189
+ const method = 'PUT';
190
+ const path = `/${encodeURIComponent(params.index.toString())}`;
191
+ return await this.transport.request({ path, method, querystring, body }, options);
192
+ }
193
+ async createDataStream(params, options) {
194
+ const acceptedPath = ['name'];
195
+ const querystring = {};
196
+ const body = undefined;
197
+ for (const key in params) {
198
+ if (acceptedPath.includes(key)) {
199
+ continue;
200
+ }
201
+ else if (key !== 'body') {
202
+ // @ts-expect-error
203
+ querystring[key] = params[key];
204
+ }
205
+ }
206
+ const method = 'PUT';
207
+ const path = `/_data_stream/${encodeURIComponent(params.name.toString())}`;
208
+ return await this.transport.request({ path, method, querystring, body }, options);
209
+ }
210
+ async dataStreamsStats(params, options) {
211
+ const acceptedPath = ['name'];
212
+ const querystring = {};
213
+ const body = undefined;
214
+ params = params !== null && params !== void 0 ? params : {};
215
+ for (const key in params) {
216
+ if (acceptedPath.includes(key)) {
217
+ continue;
218
+ }
219
+ else if (key !== 'body') {
220
+ // @ts-expect-error
221
+ querystring[key] = params[key];
222
+ }
223
+ }
224
+ let method = '';
225
+ let path = '';
226
+ if (params.name != null) {
227
+ method = 'GET';
228
+ path = `/_data_stream/${encodeURIComponent(params.name.toString())}/_stats`;
229
+ }
230
+ else {
231
+ method = 'GET';
232
+ path = '/_data_stream/_stats';
233
+ }
234
+ return await this.transport.request({ path, method, querystring, body }, options);
235
+ }
236
+ async delete(params, options) {
237
+ const acceptedPath = ['index'];
238
+ const querystring = {};
239
+ const body = undefined;
240
+ for (const key in params) {
241
+ if (acceptedPath.includes(key)) {
242
+ continue;
243
+ }
244
+ else if (key !== 'body') {
245
+ // @ts-expect-error
246
+ querystring[key] = params[key];
247
+ }
248
+ }
249
+ const method = 'DELETE';
250
+ const path = `/${encodeURIComponent(params.index.toString())}`;
251
+ return await this.transport.request({ path, method, querystring, body }, options);
252
+ }
253
+ async deleteAlias(params, options) {
254
+ const acceptedPath = ['index', 'name'];
255
+ const querystring = {};
256
+ const body = undefined;
257
+ for (const key in params) {
258
+ if (acceptedPath.includes(key)) {
259
+ continue;
260
+ }
261
+ else if (key !== 'body') {
262
+ // @ts-expect-error
263
+ querystring[key] = params[key];
264
+ }
265
+ }
266
+ let method = '';
267
+ let path = '';
268
+ if (params.index != null && params.name != null) {
269
+ method = 'DELETE';
270
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
271
+ }
272
+ else {
273
+ method = 'DELETE';
274
+ path = `/${encodeURIComponent(params.index.toString())}/_aliases/${encodeURIComponent(params.name.toString())}`;
275
+ }
276
+ return await this.transport.request({ path, method, querystring, body }, options);
277
+ }
278
+ async deleteDataStream(params, options) {
279
+ const acceptedPath = ['name'];
280
+ const querystring = {};
281
+ const body = undefined;
282
+ for (const key in params) {
283
+ if (acceptedPath.includes(key)) {
284
+ continue;
285
+ }
286
+ else if (key !== 'body') {
287
+ // @ts-expect-error
288
+ querystring[key] = params[key];
289
+ }
290
+ }
291
+ const method = 'DELETE';
292
+ const path = `/_data_stream/${encodeURIComponent(params.name.toString())}`;
293
+ return await this.transport.request({ path, method, querystring, body }, options);
294
+ }
295
+ async deleteIndexTemplate(params, options) {
296
+ const acceptedPath = ['name'];
297
+ const querystring = {};
298
+ const body = undefined;
299
+ for (const key in params) {
300
+ if (acceptedPath.includes(key)) {
301
+ continue;
302
+ }
303
+ else if (key !== 'body') {
304
+ // @ts-expect-error
305
+ querystring[key] = params[key];
306
+ }
307
+ }
308
+ const method = 'DELETE';
309
+ const path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
310
+ return await this.transport.request({ path, method, querystring, body }, options);
311
+ }
312
+ async deleteTemplate(params, options) {
313
+ const acceptedPath = ['name'];
314
+ const querystring = {};
315
+ const body = undefined;
316
+ for (const key in params) {
317
+ 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 = 'DELETE';
326
+ const path = `/_template/${encodeURIComponent(params.name.toString())}`;
327
+ return await this.transport.request({ path, method, querystring, body }, options);
328
+ }
329
+ async diskUsage(params, options) {
330
+ const acceptedPath = ['index'];
331
+ const querystring = {};
332
+ const body = undefined;
333
+ for (const key in params) {
334
+ 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 = `/${encodeURIComponent(params.index.toString())}/_disk_usage`;
344
+ return await this.transport.request({ path, method, querystring, body }, options);
345
+ }
346
+ async exists(params, options) {
347
+ const acceptedPath = ['index'];
348
+ const querystring = {};
349
+ const body = undefined;
350
+ for (const key in params) {
351
+ if (acceptedPath.includes(key)) {
352
+ continue;
353
+ }
354
+ else if (key !== 'body') {
355
+ // @ts-expect-error
356
+ querystring[key] = params[key];
357
+ }
358
+ }
359
+ const method = 'HEAD';
360
+ const path = `/${encodeURIComponent(params.index.toString())}`;
361
+ return await this.transport.request({ path, method, querystring, body }, options);
362
+ }
363
+ async existsAlias(params, options) {
364
+ const acceptedPath = ['name', 'index'];
365
+ const querystring = {};
366
+ const body = undefined;
367
+ for (const key in params) {
368
+ if (acceptedPath.includes(key)) {
369
+ continue;
370
+ }
371
+ else if (key !== 'body') {
372
+ // @ts-expect-error
373
+ querystring[key] = params[key];
374
+ }
375
+ }
376
+ let method = '';
377
+ let path = '';
378
+ if (params.index != null && params.name != null) {
379
+ method = 'HEAD';
380
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
381
+ }
382
+ else {
383
+ method = 'HEAD';
384
+ path = `/_alias/${encodeURIComponent(params.name.toString())}`;
385
+ }
386
+ return await this.transport.request({ path, method, querystring, body }, options);
387
+ }
388
+ async existsIndexTemplate(params, options) {
389
+ const acceptedPath = ['name'];
390
+ const querystring = {};
391
+ const body = undefined;
392
+ for (const key in params) {
393
+ if (acceptedPath.includes(key)) {
394
+ continue;
395
+ }
396
+ else if (key !== 'body') {
397
+ // @ts-expect-error
398
+ querystring[key] = params[key];
399
+ }
400
+ }
401
+ const method = 'HEAD';
402
+ const path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
403
+ return await this.transport.request({ path, method, querystring, body }, options);
404
+ }
405
+ async existsTemplate(params, options) {
406
+ const acceptedPath = ['name'];
407
+ const querystring = {};
408
+ const body = undefined;
409
+ for (const key in params) {
410
+ if (acceptedPath.includes(key)) {
411
+ continue;
412
+ }
413
+ else if (key !== 'body') {
414
+ // @ts-expect-error
415
+ querystring[key] = params[key];
416
+ }
417
+ }
418
+ const method = 'HEAD';
419
+ const path = `/_template/${encodeURIComponent(params.name.toString())}`;
420
+ return await this.transport.request({ path, method, querystring, body }, options);
421
+ }
422
+ async existsType(params, options) {
423
+ const acceptedPath = ['index', 'type'];
424
+ const querystring = {};
425
+ const body = undefined;
426
+ for (const key in params) {
427
+ if (acceptedPath.includes(key)) {
428
+ continue;
429
+ }
430
+ else if (key !== 'body') {
431
+ // @ts-expect-error
432
+ querystring[key] = params[key];
433
+ }
434
+ }
435
+ const method = 'HEAD';
436
+ const path = `/${encodeURIComponent(params.index.toString())}/_mapping/${encodeURIComponent(params.type.toString())}`;
437
+ return await this.transport.request({ path, method, querystring, body }, options);
438
+ }
439
+ async fieldUsageStats(params, options) {
440
+ const acceptedPath = ['index'];
441
+ const querystring = {};
442
+ const body = undefined;
443
+ params = params !== null && params !== void 0 ? params : {};
444
+ for (const key in params) {
445
+ if (acceptedPath.includes(key)) {
446
+ continue;
447
+ }
448
+ else if (key !== 'body') {
449
+ querystring[key] = params[key];
450
+ }
451
+ }
452
+ const method = 'GET';
453
+ const path = `/${encodeURIComponent(params.index.toString())}/_field_usage_stats`;
454
+ return await this.transport.request({ path, method, querystring, body }, options);
455
+ }
456
+ async flush(params, options) {
457
+ const acceptedPath = ['index'];
458
+ const querystring = {};
459
+ const body = undefined;
460
+ params = params !== null && params !== void 0 ? params : {};
461
+ for (const key in params) {
462
+ if (acceptedPath.includes(key)) {
463
+ continue;
464
+ }
465
+ else if (key !== 'body') {
466
+ // @ts-expect-error
467
+ querystring[key] = params[key];
468
+ }
469
+ }
470
+ let method = '';
471
+ let path = '';
472
+ if (params.index != null) {
473
+ method = body != null ? 'POST' : 'GET';
474
+ path = `/${encodeURIComponent(params.index.toString())}/_flush`;
475
+ }
476
+ else {
477
+ method = body != null ? 'POST' : 'GET';
478
+ path = '/_flush';
479
+ }
480
+ return await this.transport.request({ path, method, querystring, body }, options);
481
+ }
482
+ async forcemerge(params, options) {
483
+ const acceptedPath = ['index'];
484
+ const querystring = {};
485
+ const body = undefined;
486
+ params = params !== null && params !== void 0 ? params : {};
487
+ for (const key in params) {
488
+ if (acceptedPath.includes(key)) {
489
+ continue;
490
+ }
491
+ else if (key !== 'body') {
492
+ // @ts-expect-error
493
+ querystring[key] = params[key];
494
+ }
495
+ }
496
+ let method = '';
497
+ let path = '';
498
+ if (params.index != null) {
499
+ method = 'POST';
500
+ path = `/${encodeURIComponent(params.index.toString())}/_forcemerge`;
501
+ }
502
+ else {
503
+ method = 'POST';
504
+ path = '/_forcemerge';
505
+ }
506
+ return await this.transport.request({ path, method, querystring, body }, options);
507
+ }
508
+ async get(params, options) {
509
+ const acceptedPath = ['index'];
510
+ const querystring = {};
511
+ const body = undefined;
512
+ for (const key in params) {
513
+ if (acceptedPath.includes(key)) {
514
+ continue;
515
+ }
516
+ else if (key !== 'body') {
517
+ // @ts-expect-error
518
+ querystring[key] = params[key];
519
+ }
520
+ }
521
+ const method = 'GET';
522
+ const path = `/${encodeURIComponent(params.index.toString())}`;
523
+ return await this.transport.request({ path, method, querystring, body }, options);
524
+ }
525
+ async getAlias(params, options) {
526
+ const acceptedPath = ['name', 'index'];
527
+ const querystring = {};
528
+ const body = undefined;
529
+ params = params !== null && params !== void 0 ? params : {};
530
+ for (const key in params) {
531
+ if (acceptedPath.includes(key)) {
532
+ continue;
533
+ }
534
+ else if (key !== 'body') {
535
+ // @ts-expect-error
536
+ querystring[key] = params[key];
537
+ }
538
+ }
539
+ let method = '';
540
+ let path = '';
541
+ if (params.index != null && params.name != null) {
542
+ method = 'GET';
543
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
544
+ }
545
+ else if (params.name != null) {
546
+ method = 'GET';
547
+ path = `/_alias/${encodeURIComponent(params.name.toString())}`;
548
+ }
549
+ else if (params.index != null) {
550
+ method = 'GET';
551
+ path = `/${encodeURIComponent(params.index.toString())}/_alias`;
552
+ }
553
+ else {
554
+ method = 'GET';
555
+ path = '/_alias';
556
+ }
557
+ return await this.transport.request({ path, method, querystring, body }, options);
558
+ }
559
+ async getDataStream(params, options) {
560
+ const acceptedPath = ['name'];
561
+ const querystring = {};
562
+ const body = undefined;
563
+ params = params !== null && params !== void 0 ? params : {};
564
+ for (const key in params) {
565
+ if (acceptedPath.includes(key)) {
566
+ continue;
567
+ }
568
+ else if (key !== 'body') {
569
+ // @ts-expect-error
570
+ querystring[key] = params[key];
571
+ }
572
+ }
573
+ let method = '';
574
+ let path = '';
575
+ if (params.name != null) {
576
+ method = 'GET';
577
+ path = `/_data_stream/${encodeURIComponent(params.name.toString())}`;
578
+ }
579
+ else {
580
+ method = 'GET';
581
+ path = '/_data_stream';
582
+ }
583
+ return await this.transport.request({ path, method, querystring, body }, options);
584
+ }
585
+ async getFieldMapping(params, options) {
586
+ const acceptedPath = ['fields', 'index'];
587
+ const querystring = {};
588
+ const body = undefined;
589
+ for (const key in params) {
590
+ if (acceptedPath.includes(key)) {
591
+ continue;
592
+ }
593
+ else if (key !== 'body') {
594
+ // @ts-expect-error
595
+ querystring[key] = params[key];
596
+ }
597
+ }
598
+ let method = '';
599
+ let path = '';
600
+ if (params.index != null && params.fields != null) {
601
+ method = 'GET';
602
+ path = `/${encodeURIComponent(params.index.toString())}/_mapping/field/${encodeURIComponent(params.fields.toString())}`;
603
+ }
604
+ else {
605
+ method = 'GET';
606
+ path = `/_mapping/field/${encodeURIComponent(params.fields.toString())}`;
607
+ }
608
+ return await this.transport.request({ path, method, querystring, body }, options);
609
+ }
610
+ async getIndexTemplate(params, options) {
611
+ const acceptedPath = ['name'];
612
+ const querystring = {};
613
+ const body = undefined;
614
+ params = params !== null && params !== void 0 ? params : {};
615
+ for (const key in params) {
616
+ if (acceptedPath.includes(key)) {
617
+ continue;
618
+ }
619
+ else if (key !== 'body') {
620
+ // @ts-expect-error
621
+ querystring[key] = params[key];
622
+ }
623
+ }
624
+ let method = '';
625
+ let path = '';
626
+ if (params.name != null) {
627
+ method = 'GET';
628
+ path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
629
+ }
630
+ else {
631
+ method = 'GET';
632
+ path = '/_index_template';
633
+ }
634
+ return await this.transport.request({ path, method, querystring, body }, options);
635
+ }
636
+ async getMapping(params, options) {
637
+ const acceptedPath = ['index'];
638
+ const querystring = {};
639
+ const body = undefined;
640
+ params = params !== null && params !== void 0 ? params : {};
641
+ for (const key in params) {
642
+ if (acceptedPath.includes(key)) {
643
+ continue;
644
+ }
645
+ else if (key !== 'body') {
646
+ // @ts-expect-error
647
+ querystring[key] = params[key];
648
+ }
649
+ }
650
+ let method = '';
651
+ let path = '';
652
+ if (params.index != null) {
653
+ method = 'GET';
654
+ path = `/${encodeURIComponent(params.index.toString())}/_mapping`;
655
+ }
656
+ else {
657
+ method = 'GET';
658
+ path = '/_mapping';
659
+ }
660
+ return await this.transport.request({ path, method, querystring, body }, options);
661
+ }
662
+ async getSettings(params, options) {
663
+ const acceptedPath = ['index', 'name'];
664
+ const querystring = {};
665
+ const body = undefined;
666
+ params = params !== null && params !== void 0 ? params : {};
667
+ for (const key in params) {
668
+ if (acceptedPath.includes(key)) {
669
+ continue;
670
+ }
671
+ else if (key !== 'body') {
672
+ // @ts-expect-error
673
+ querystring[key] = params[key];
674
+ }
675
+ }
676
+ let method = '';
677
+ let path = '';
678
+ if (params.index != null && params.name != null) {
679
+ method = 'GET';
680
+ path = `/${encodeURIComponent(params.index.toString())}/_settings/${encodeURIComponent(params.name.toString())}`;
681
+ }
682
+ else if (params.index != null) {
683
+ method = 'GET';
684
+ path = `/${encodeURIComponent(params.index.toString())}/_settings`;
685
+ }
686
+ else if (params.name != null) {
687
+ method = 'GET';
688
+ path = `/_settings/${encodeURIComponent(params.name.toString())}`;
689
+ }
690
+ else {
691
+ method = 'GET';
692
+ path = '/_settings';
693
+ }
694
+ return await this.transport.request({ path, method, querystring, body }, options);
695
+ }
696
+ async getTemplate(params, options) {
697
+ const acceptedPath = ['name'];
698
+ const querystring = {};
699
+ const body = undefined;
700
+ params = params !== null && params !== void 0 ? params : {};
701
+ for (const key in params) {
702
+ if (acceptedPath.includes(key)) {
703
+ continue;
704
+ }
705
+ else if (key !== 'body') {
706
+ // @ts-expect-error
707
+ querystring[key] = params[key];
708
+ }
709
+ }
710
+ let method = '';
711
+ let path = '';
712
+ if (params.name != null) {
713
+ method = 'GET';
714
+ path = `/_template/${encodeURIComponent(params.name.toString())}`;
715
+ }
716
+ else {
717
+ method = 'GET';
718
+ path = '/_template';
719
+ }
720
+ return await this.transport.request({ path, method, querystring, body }, options);
721
+ }
722
+ async migrateToDataStream(params, options) {
723
+ const acceptedPath = ['name'];
724
+ const querystring = {};
725
+ const body = undefined;
726
+ for (const key in params) {
727
+ if (acceptedPath.includes(key)) {
728
+ continue;
729
+ }
730
+ else if (key !== 'body') {
731
+ // @ts-expect-error
732
+ querystring[key] = params[key];
733
+ }
734
+ }
735
+ const method = 'POST';
736
+ const path = `/_data_stream/_migrate/${encodeURIComponent(params.name.toString())}`;
737
+ return await this.transport.request({ path, method, querystring, body }, options);
738
+ }
739
+ async modifyDataStream(params, options) {
740
+ const acceptedPath = [];
741
+ const querystring = {};
742
+ const body = undefined;
743
+ params = params !== null && params !== void 0 ? params : {};
744
+ for (const key in params) {
745
+ if (acceptedPath.includes(key)) {
746
+ continue;
747
+ }
748
+ else if (key !== 'body') {
749
+ querystring[key] = params[key];
750
+ }
751
+ }
752
+ const method = 'POST';
753
+ const path = '/_data_stream/_modify';
754
+ return await this.transport.request({ path, method, querystring, body }, options);
755
+ }
756
+ async open(params, options) {
757
+ const acceptedPath = ['index'];
758
+ const querystring = {};
759
+ const body = undefined;
760
+ for (const key in params) {
761
+ if (acceptedPath.includes(key)) {
762
+ continue;
763
+ }
764
+ else if (key !== 'body') {
765
+ // @ts-expect-error
766
+ querystring[key] = params[key];
767
+ }
768
+ }
769
+ const method = 'POST';
770
+ const path = `/${encodeURIComponent(params.index.toString())}/_open`;
771
+ return await this.transport.request({ path, method, querystring, body }, options);
772
+ }
773
+ async promoteDataStream(params, options) {
774
+ const acceptedPath = ['name'];
775
+ const querystring = {};
776
+ const body = undefined;
777
+ for (const key in params) {
778
+ if (acceptedPath.includes(key)) {
779
+ continue;
780
+ }
781
+ else if (key !== 'body') {
782
+ // @ts-expect-error
783
+ querystring[key] = params[key];
784
+ }
785
+ }
786
+ const method = 'POST';
787
+ const path = `/_data_stream/_promote/${encodeURIComponent(params.name.toString())}`;
788
+ return await this.transport.request({ path, method, querystring, body }, options);
789
+ }
790
+ async putAlias(params, options) {
791
+ const acceptedPath = ['index', 'name'];
792
+ const acceptedBody = ['filter', 'index_routing', 'is_write_index', 'routing', 'search_routing'];
793
+ const querystring = {};
794
+ // @ts-expect-error
795
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
796
+ let body;
797
+ if (typeof userBody === 'string') {
798
+ body = userBody;
799
+ }
800
+ else {
801
+ body = userBody != null ? { ...userBody } : undefined;
802
+ }
803
+ for (const key in params) {
804
+ if (acceptedBody.includes(key)) {
805
+ body = body !== null && body !== void 0 ? body : {};
806
+ // @ts-expect-error
807
+ body[key] = params[key];
808
+ }
809
+ else if (acceptedPath.includes(key)) {
810
+ continue;
811
+ }
812
+ else if (key !== 'body') {
813
+ // @ts-expect-error
814
+ querystring[key] = params[key];
815
+ }
816
+ }
817
+ let method = '';
818
+ let path = '';
819
+ if (params.index != null && params.name != null) {
820
+ method = 'PUT';
821
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
822
+ }
823
+ else {
824
+ method = 'PUT';
825
+ path = `/${encodeURIComponent(params.index.toString())}/_aliases/${encodeURIComponent(params.name.toString())}`;
826
+ }
827
+ return await this.transport.request({ path, method, querystring, body }, options);
828
+ }
829
+ async putIndexTemplate(params, options) {
830
+ const acceptedPath = ['name'];
831
+ const acceptedBody = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta'];
832
+ const querystring = {};
833
+ // @ts-expect-error
834
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
835
+ let body;
836
+ if (typeof userBody === 'string') {
837
+ body = userBody;
838
+ }
839
+ else {
840
+ body = userBody != null ? { ...userBody } : undefined;
841
+ }
842
+ for (const key in params) {
843
+ if (acceptedBody.includes(key)) {
844
+ body = body !== null && body !== void 0 ? body : {};
845
+ // @ts-expect-error
846
+ body[key] = params[key];
847
+ }
848
+ else if (acceptedPath.includes(key)) {
849
+ continue;
850
+ }
851
+ else if (key !== 'body') {
852
+ // @ts-expect-error
853
+ querystring[key] = params[key];
854
+ }
855
+ }
856
+ const method = 'PUT';
857
+ const path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
858
+ return await this.transport.request({ path, method, querystring, body }, options);
859
+ }
860
+ async putMapping(params, options) {
861
+ const acceptedPath = ['index'];
862
+ const acceptedBody = ['date_detection', 'dynamic', 'dynamic_date_formats', 'dynamic_templates', '_field_names', '_meta', 'numeric_detection', 'properties', '_routing', '_source', 'runtime'];
863
+ const querystring = {};
864
+ // @ts-expect-error
865
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
866
+ let body;
867
+ if (typeof userBody === 'string') {
868
+ body = userBody;
869
+ }
870
+ else {
871
+ body = userBody != null ? { ...userBody } : undefined;
872
+ }
873
+ for (const key in params) {
874
+ if (acceptedBody.includes(key)) {
875
+ body = body !== null && body !== void 0 ? body : {};
876
+ // @ts-expect-error
877
+ body[key] = params[key];
878
+ }
879
+ else if (acceptedPath.includes(key)) {
880
+ continue;
881
+ }
882
+ else if (key !== 'body') {
883
+ // @ts-expect-error
884
+ querystring[key] = params[key];
885
+ }
886
+ }
887
+ const method = 'PUT';
888
+ const path = `/${encodeURIComponent(params.index.toString())}/_mapping`;
889
+ return await this.transport.request({ path, method, querystring, body }, options);
890
+ }
891
+ async putSettings(params, options) {
892
+ var _a;
893
+ const acceptedPath = ['index'];
894
+ const acceptedBody = ['settings'];
895
+ const querystring = {};
896
+ // @ts-expect-error
897
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
898
+ for (const key in params) {
899
+ if (acceptedBody.includes(key)) {
900
+ // @ts-expect-error
901
+ body = params[key];
902
+ }
903
+ else if (acceptedPath.includes(key)) {
904
+ continue;
905
+ }
906
+ else if (key !== 'body') {
907
+ // @ts-expect-error
908
+ querystring[key] = params[key];
909
+ }
910
+ }
911
+ let method = '';
912
+ let path = '';
913
+ if (params.index != null) {
914
+ method = 'PUT';
915
+ path = `/${encodeURIComponent(params.index.toString())}/_settings`;
916
+ }
917
+ else {
918
+ method = 'PUT';
919
+ path = '/_settings';
920
+ }
921
+ return await this.transport.request({ path, method, querystring, body }, options);
922
+ }
923
+ async putTemplate(params, options) {
924
+ const acceptedPath = ['name'];
925
+ const acceptedBody = ['aliases', 'index_patterns', 'mappings', 'order', 'settings', 'version'];
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 = 'PUT';
951
+ const path = `/_template/${encodeURIComponent(params.name.toString())}`;
952
+ return await this.transport.request({ path, method, querystring, body }, options);
953
+ }
954
+ async recovery(params, options) {
955
+ const acceptedPath = ['index'];
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.index != null) {
971
+ method = 'GET';
972
+ path = `/${encodeURIComponent(params.index.toString())}/_recovery`;
973
+ }
974
+ else {
975
+ method = 'GET';
976
+ path = '/_recovery';
977
+ }
978
+ return await this.transport.request({ path, method, querystring, body }, options);
979
+ }
980
+ async refresh(params, options) {
981
+ const acceptedPath = ['index'];
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.index != null) {
997
+ method = body != null ? 'POST' : 'GET';
998
+ path = `/${encodeURIComponent(params.index.toString())}/_refresh`;
999
+ }
1000
+ else {
1001
+ method = body != null ? 'POST' : 'GET';
1002
+ path = '/_refresh';
1003
+ }
1004
+ return await this.transport.request({ path, method, querystring, body }, options);
1005
+ }
1006
+ async reloadSearchAnalyzers(params, options) {
1007
+ const acceptedPath = ['index'];
1008
+ const querystring = {};
1009
+ const body = undefined;
1010
+ for (const key in params) {
1011
+ if (acceptedPath.includes(key)) {
1012
+ continue;
1013
+ }
1014
+ else if (key !== 'body') {
1015
+ // @ts-expect-error
1016
+ querystring[key] = params[key];
1017
+ }
1018
+ }
1019
+ const method = body != null ? 'POST' : 'GET';
1020
+ const path = `/${encodeURIComponent(params.index.toString())}/_reload_search_analyzers`;
1021
+ return await this.transport.request({ path, method, querystring, body }, options);
1022
+ }
1023
+ async resolveIndex(params, options) {
1024
+ const acceptedPath = ['name'];
1025
+ const querystring = {};
1026
+ const body = undefined;
1027
+ for (const key in params) {
1028
+ if (acceptedPath.includes(key)) {
1029
+ continue;
1030
+ }
1031
+ else if (key !== 'body') {
1032
+ // @ts-expect-error
1033
+ querystring[key] = params[key];
1034
+ }
1035
+ }
1036
+ const method = 'GET';
1037
+ const path = `/_resolve/index/${encodeURIComponent(params.name.toString())}`;
1038
+ return await this.transport.request({ path, method, querystring, body }, options);
1039
+ }
1040
+ async rollover(params, options) {
1041
+ const acceptedPath = ['alias', 'new_index'];
1042
+ const acceptedBody = ['aliases', 'conditions', 'mappings', 'settings'];
1043
+ const querystring = {};
1044
+ // @ts-expect-error
1045
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1046
+ let body;
1047
+ if (typeof userBody === 'string') {
1048
+ body = userBody;
1049
+ }
1050
+ else {
1051
+ body = userBody != null ? { ...userBody } : undefined;
1052
+ }
1053
+ for (const key in params) {
1054
+ if (acceptedBody.includes(key)) {
1055
+ body = body !== null && body !== void 0 ? body : {};
1056
+ // @ts-expect-error
1057
+ body[key] = params[key];
1058
+ }
1059
+ else if (acceptedPath.includes(key)) {
1060
+ continue;
1061
+ }
1062
+ else if (key !== 'body') {
1063
+ // @ts-expect-error
1064
+ querystring[key] = params[key];
1065
+ }
1066
+ }
1067
+ let method = '';
1068
+ let path = '';
1069
+ if (params.alias != null && params.new_index != null) {
1070
+ method = 'POST';
1071
+ path = `/${encodeURIComponent(params.alias.toString())}/_rollover/${encodeURIComponent(params.new_index.toString())}`;
1072
+ }
1073
+ else {
1074
+ method = 'POST';
1075
+ path = `/${encodeURIComponent(params.alias.toString())}/_rollover`;
1076
+ }
1077
+ return await this.transport.request({ path, method, querystring, body }, options);
1078
+ }
1079
+ async segments(params, options) {
1080
+ const acceptedPath = ['index'];
1081
+ const querystring = {};
1082
+ const body = undefined;
1083
+ params = params !== null && params !== void 0 ? params : {};
1084
+ for (const key in params) {
1085
+ if (acceptedPath.includes(key)) {
1086
+ continue;
1087
+ }
1088
+ else if (key !== 'body') {
1089
+ // @ts-expect-error
1090
+ querystring[key] = params[key];
1091
+ }
1092
+ }
1093
+ let method = '';
1094
+ let path = '';
1095
+ if (params.index != null) {
1096
+ method = 'GET';
1097
+ path = `/${encodeURIComponent(params.index.toString())}/_segments`;
1098
+ }
1099
+ else {
1100
+ method = 'GET';
1101
+ path = '/_segments';
1102
+ }
1103
+ return await this.transport.request({ path, method, querystring, body }, options);
1104
+ }
1105
+ async shardStores(params, options) {
1106
+ const acceptedPath = ['index'];
1107
+ const querystring = {};
1108
+ const body = undefined;
1109
+ params = params !== null && params !== void 0 ? params : {};
1110
+ for (const key in params) {
1111
+ if (acceptedPath.includes(key)) {
1112
+ continue;
1113
+ }
1114
+ else if (key !== 'body') {
1115
+ // @ts-expect-error
1116
+ querystring[key] = params[key];
1117
+ }
1118
+ }
1119
+ let method = '';
1120
+ let path = '';
1121
+ if (params.index != null) {
1122
+ method = 'GET';
1123
+ path = `/${encodeURIComponent(params.index.toString())}/_shard_stores`;
1124
+ }
1125
+ else {
1126
+ method = 'GET';
1127
+ path = '/_shard_stores';
1128
+ }
1129
+ return await this.transport.request({ path, method, querystring, body }, options);
1130
+ }
1131
+ async shrink(params, options) {
1132
+ const acceptedPath = ['index', 'target'];
1133
+ const acceptedBody = ['aliases', 'settings'];
1134
+ const querystring = {};
1135
+ // @ts-expect-error
1136
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1137
+ let body;
1138
+ if (typeof userBody === 'string') {
1139
+ body = userBody;
1140
+ }
1141
+ else {
1142
+ body = userBody != null ? { ...userBody } : undefined;
1143
+ }
1144
+ for (const key in params) {
1145
+ if (acceptedBody.includes(key)) {
1146
+ body = body !== null && body !== void 0 ? body : {};
1147
+ // @ts-expect-error
1148
+ body[key] = params[key];
1149
+ }
1150
+ else if (acceptedPath.includes(key)) {
1151
+ continue;
1152
+ }
1153
+ else if (key !== 'body') {
1154
+ // @ts-expect-error
1155
+ querystring[key] = params[key];
1156
+ }
1157
+ }
1158
+ const method = 'PUT';
1159
+ const path = `/${encodeURIComponent(params.index.toString())}/_shrink/${encodeURIComponent(params.target.toString())}`;
1160
+ return await this.transport.request({ path, method, querystring, body }, options);
1161
+ }
1162
+ async simulateIndexTemplate(params, options) {
1163
+ const acceptedPath = ['name'];
1164
+ const acceptedBody = ['index_patterns', 'composed_of', 'overlapping', 'template'];
1165
+ const querystring = {};
1166
+ // @ts-expect-error
1167
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1168
+ let body;
1169
+ if (typeof userBody === 'string') {
1170
+ body = userBody;
1171
+ }
1172
+ else {
1173
+ body = userBody != null ? { ...userBody } : undefined;
1174
+ }
1175
+ for (const key in params) {
1176
+ if (acceptedBody.includes(key)) {
1177
+ body = body !== null && body !== void 0 ? body : {};
1178
+ // @ts-expect-error
1179
+ body[key] = params[key];
1180
+ }
1181
+ else if (acceptedPath.includes(key)) {
1182
+ continue;
1183
+ }
1184
+ else if (key !== 'body') {
1185
+ // @ts-expect-error
1186
+ querystring[key] = params[key];
1187
+ }
1188
+ }
1189
+ const method = 'POST';
1190
+ const path = `/_index_template/_simulate_index/${encodeURIComponent(params.name.toString())}`;
1191
+ return await this.transport.request({ path, method, querystring, body }, options);
1192
+ }
1193
+ async simulateTemplate(params, options) {
1194
+ var _a;
1195
+ const acceptedPath = ['name'];
1196
+ const acceptedBody = ['template'];
1197
+ const querystring = {};
1198
+ // @ts-expect-error
1199
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1200
+ for (const key in params) {
1201
+ if (acceptedBody.includes(key)) {
1202
+ // @ts-expect-error
1203
+ body = params[key];
1204
+ }
1205
+ else if (acceptedPath.includes(key)) {
1206
+ continue;
1207
+ }
1208
+ else if (key !== 'body') {
1209
+ // @ts-expect-error
1210
+ querystring[key] = params[key];
1211
+ }
1212
+ }
1213
+ let method = '';
1214
+ let path = '';
1215
+ if (params.name != null) {
1216
+ method = 'POST';
1217
+ path = `/_index_template/_simulate/${encodeURIComponent(params.name.toString())}`;
1218
+ }
1219
+ else {
1220
+ method = 'POST';
1221
+ path = '/_index_template/_simulate';
1222
+ }
1223
+ return await this.transport.request({ path, method, querystring, body }, options);
1224
+ }
1225
+ async split(params, options) {
1226
+ const acceptedPath = ['index', 'target'];
1227
+ const acceptedBody = ['aliases', 'settings'];
1228
+ const querystring = {};
1229
+ // @ts-expect-error
1230
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1231
+ let body;
1232
+ if (typeof userBody === 'string') {
1233
+ body = userBody;
1234
+ }
1235
+ else {
1236
+ body = userBody != null ? { ...userBody } : undefined;
1237
+ }
1238
+ for (const key in params) {
1239
+ if (acceptedBody.includes(key)) {
1240
+ body = body !== null && body !== void 0 ? body : {};
1241
+ // @ts-expect-error
1242
+ body[key] = params[key];
1243
+ }
1244
+ else if (acceptedPath.includes(key)) {
1245
+ continue;
1246
+ }
1247
+ else if (key !== 'body') {
1248
+ // @ts-expect-error
1249
+ querystring[key] = params[key];
1250
+ }
1251
+ }
1252
+ const method = 'PUT';
1253
+ const path = `/${encodeURIComponent(params.index.toString())}/_split/${encodeURIComponent(params.target.toString())}`;
1254
+ return await this.transport.request({ path, method, querystring, body }, options);
1255
+ }
1256
+ async stats(params, options) {
1257
+ const acceptedPath = ['metric', 'index'];
1258
+ const querystring = {};
1259
+ const body = undefined;
1260
+ params = params !== null && params !== void 0 ? params : {};
1261
+ for (const key in params) {
1262
+ if (acceptedPath.includes(key)) {
1263
+ continue;
1264
+ }
1265
+ else if (key !== 'body') {
1266
+ // @ts-expect-error
1267
+ querystring[key] = params[key];
1268
+ }
1269
+ }
1270
+ let method = '';
1271
+ let path = '';
1272
+ if (params.index != null && params.metric != null) {
1273
+ method = 'GET';
1274
+ path = `/${encodeURIComponent(params.index.toString())}/_stats/${encodeURIComponent(params.metric.toString())}`;
1275
+ }
1276
+ else if (params.metric != null) {
1277
+ method = 'GET';
1278
+ path = `/_stats/${encodeURIComponent(params.metric.toString())}`;
1279
+ }
1280
+ else if (params.index != null) {
1281
+ method = 'GET';
1282
+ path = `/${encodeURIComponent(params.index.toString())}/_stats`;
1283
+ }
1284
+ else {
1285
+ method = 'GET';
1286
+ path = '/_stats';
1287
+ }
1288
+ return await this.transport.request({ path, method, querystring, body }, options);
1289
+ }
1290
+ async unfreeze(params, options) {
1291
+ const acceptedPath = ['index'];
1292
+ const querystring = {};
1293
+ const body = undefined;
1294
+ for (const key in params) {
1295
+ if (acceptedPath.includes(key)) {
1296
+ continue;
1297
+ }
1298
+ else if (key !== 'body') {
1299
+ // @ts-expect-error
1300
+ querystring[key] = params[key];
1301
+ }
1302
+ }
1303
+ const method = 'POST';
1304
+ const path = `/${encodeURIComponent(params.index.toString())}/_unfreeze`;
1305
+ return await this.transport.request({ path, method, querystring, body }, options);
1306
+ }
1307
+ async updateAliases(params, options) {
1308
+ const acceptedPath = [];
1309
+ const acceptedBody = ['actions'];
1310
+ const querystring = {};
1311
+ // @ts-expect-error
1312
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1313
+ let body;
1314
+ if (typeof userBody === 'string') {
1315
+ body = userBody;
1316
+ }
1317
+ else {
1318
+ body = userBody != null ? { ...userBody } : undefined;
1319
+ }
1320
+ params = params !== null && params !== void 0 ? params : {};
1321
+ for (const key in params) {
1322
+ if (acceptedBody.includes(key)) {
1323
+ body = body !== null && body !== void 0 ? body : {};
1324
+ // @ts-expect-error
1325
+ body[key] = params[key];
1326
+ }
1327
+ else if (acceptedPath.includes(key)) {
1328
+ continue;
1329
+ }
1330
+ else if (key !== 'body') {
1331
+ // @ts-expect-error
1332
+ querystring[key] = params[key];
1333
+ }
1334
+ }
1335
+ const method = 'POST';
1336
+ const path = '/_aliases';
1337
+ return await this.transport.request({ path, method, querystring, body }, options);
1338
+ }
1339
+ async validateQuery(params, options) {
1340
+ const acceptedPath = ['index', 'type'];
1341
+ const acceptedBody = ['query'];
1342
+ const querystring = {};
1343
+ // @ts-expect-error
1344
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1345
+ let body;
1346
+ if (typeof userBody === 'string') {
1347
+ body = userBody;
1348
+ }
1349
+ else {
1350
+ body = userBody != null ? { ...userBody } : undefined;
1351
+ }
1352
+ params = params !== null && params !== void 0 ? params : {};
1353
+ for (const key in params) {
1354
+ if (acceptedBody.includes(key)) {
1355
+ body = body !== null && body !== void 0 ? body : {};
1356
+ // @ts-expect-error
1357
+ body[key] = params[key];
1358
+ }
1359
+ else if (acceptedPath.includes(key)) {
1360
+ continue;
1361
+ }
1362
+ else if (key !== 'body') {
1363
+ // @ts-expect-error
1364
+ querystring[key] = params[key];
1365
+ }
1366
+ }
1367
+ let method = '';
1368
+ let path = '';
1369
+ if (params.index != null) {
1370
+ method = body != null ? 'POST' : 'GET';
1371
+ path = `/${encodeURIComponent(params.index.toString())}/_validate/query`;
1372
+ }
1373
+ else {
1374
+ method = body != null ? 'POST' : 'GET';
1375
+ path = '/_validate/query';
1376
+ }
1377
+ return await this.transport.request({ path, method, querystring, body }, options);
1378
+ }
1379
+ }
1380
+ exports.default = Indices;
1381
+ //# sourceMappingURL=indices.js.map