@retter/elasticsearch 8.4.0

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 (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,1378 @@
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 fieldUsageStats(params, options) {
423
+ const acceptedPath = ['index'];
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 = 'GET';
436
+ const path = `/${encodeURIComponent(params.index.toString())}/_field_usage_stats`;
437
+ return await this.transport.request({ path, method, querystring, body }, options);
438
+ }
439
+ async flush(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
+ // @ts-expect-error
450
+ querystring[key] = params[key];
451
+ }
452
+ }
453
+ let method = '';
454
+ let path = '';
455
+ if (params.index != null) {
456
+ method = body != null ? 'POST' : 'GET';
457
+ path = `/${encodeURIComponent(params.index.toString())}/_flush`;
458
+ }
459
+ else {
460
+ method = body != null ? 'POST' : 'GET';
461
+ path = '/_flush';
462
+ }
463
+ return await this.transport.request({ path, method, querystring, body }, options);
464
+ }
465
+ async forcemerge(params, options) {
466
+ const acceptedPath = ['index'];
467
+ const querystring = {};
468
+ const body = undefined;
469
+ params = params !== null && params !== void 0 ? params : {};
470
+ for (const key in params) {
471
+ if (acceptedPath.includes(key)) {
472
+ continue;
473
+ }
474
+ else if (key !== 'body') {
475
+ // @ts-expect-error
476
+ querystring[key] = params[key];
477
+ }
478
+ }
479
+ let method = '';
480
+ let path = '';
481
+ if (params.index != null) {
482
+ method = 'POST';
483
+ path = `/${encodeURIComponent(params.index.toString())}/_forcemerge`;
484
+ }
485
+ else {
486
+ method = 'POST';
487
+ path = '/_forcemerge';
488
+ }
489
+ return await this.transport.request({ path, method, querystring, body }, options);
490
+ }
491
+ async get(params, options) {
492
+ const acceptedPath = ['index'];
493
+ const querystring = {};
494
+ const body = undefined;
495
+ for (const key in params) {
496
+ if (acceptedPath.includes(key)) {
497
+ continue;
498
+ }
499
+ else if (key !== 'body') {
500
+ // @ts-expect-error
501
+ querystring[key] = params[key];
502
+ }
503
+ }
504
+ const method = 'GET';
505
+ const path = `/${encodeURIComponent(params.index.toString())}`;
506
+ return await this.transport.request({ path, method, querystring, body }, options);
507
+ }
508
+ async getAlias(params, options) {
509
+ const acceptedPath = ['name', 'index'];
510
+ const querystring = {};
511
+ const body = undefined;
512
+ params = params !== null && params !== void 0 ? params : {};
513
+ for (const key in params) {
514
+ if (acceptedPath.includes(key)) {
515
+ continue;
516
+ }
517
+ else if (key !== 'body') {
518
+ // @ts-expect-error
519
+ querystring[key] = params[key];
520
+ }
521
+ }
522
+ let method = '';
523
+ let path = '';
524
+ if (params.index != null && params.name != null) {
525
+ method = 'GET';
526
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
527
+ }
528
+ else if (params.name != null) {
529
+ method = 'GET';
530
+ path = `/_alias/${encodeURIComponent(params.name.toString())}`;
531
+ }
532
+ else if (params.index != null) {
533
+ method = 'GET';
534
+ path = `/${encodeURIComponent(params.index.toString())}/_alias`;
535
+ }
536
+ else {
537
+ method = 'GET';
538
+ path = '/_alias';
539
+ }
540
+ return await this.transport.request({ path, method, querystring, body }, options);
541
+ }
542
+ async getDataStream(params, options) {
543
+ const acceptedPath = ['name'];
544
+ const querystring = {};
545
+ const body = undefined;
546
+ params = params !== null && params !== void 0 ? params : {};
547
+ for (const key in params) {
548
+ if (acceptedPath.includes(key)) {
549
+ continue;
550
+ }
551
+ else if (key !== 'body') {
552
+ // @ts-expect-error
553
+ querystring[key] = params[key];
554
+ }
555
+ }
556
+ let method = '';
557
+ let path = '';
558
+ if (params.name != null) {
559
+ method = 'GET';
560
+ path = `/_data_stream/${encodeURIComponent(params.name.toString())}`;
561
+ }
562
+ else {
563
+ method = 'GET';
564
+ path = '/_data_stream';
565
+ }
566
+ return await this.transport.request({ path, method, querystring, body }, options);
567
+ }
568
+ async getFieldMapping(params, options) {
569
+ const acceptedPath = ['fields', 'index'];
570
+ const querystring = {};
571
+ const body = undefined;
572
+ for (const key in params) {
573
+ if (acceptedPath.includes(key)) {
574
+ continue;
575
+ }
576
+ else if (key !== 'body') {
577
+ // @ts-expect-error
578
+ querystring[key] = params[key];
579
+ }
580
+ }
581
+ let method = '';
582
+ let path = '';
583
+ if (params.index != null && params.fields != null) {
584
+ method = 'GET';
585
+ path = `/${encodeURIComponent(params.index.toString())}/_mapping/field/${encodeURIComponent(params.fields.toString())}`;
586
+ }
587
+ else {
588
+ method = 'GET';
589
+ path = `/_mapping/field/${encodeURIComponent(params.fields.toString())}`;
590
+ }
591
+ return await this.transport.request({ path, method, querystring, body }, options);
592
+ }
593
+ async getIndexTemplate(params, options) {
594
+ const acceptedPath = ['name'];
595
+ const querystring = {};
596
+ const body = undefined;
597
+ params = params !== null && params !== void 0 ? params : {};
598
+ for (const key in params) {
599
+ if (acceptedPath.includes(key)) {
600
+ continue;
601
+ }
602
+ else if (key !== 'body') {
603
+ // @ts-expect-error
604
+ querystring[key] = params[key];
605
+ }
606
+ }
607
+ let method = '';
608
+ let path = '';
609
+ if (params.name != null) {
610
+ method = 'GET';
611
+ path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
612
+ }
613
+ else {
614
+ method = 'GET';
615
+ path = '/_index_template';
616
+ }
617
+ return await this.transport.request({ path, method, querystring, body }, options);
618
+ }
619
+ async getMapping(params, options) {
620
+ const acceptedPath = ['index'];
621
+ const querystring = {};
622
+ const body = undefined;
623
+ params = params !== null && params !== void 0 ? params : {};
624
+ for (const key in params) {
625
+ if (acceptedPath.includes(key)) {
626
+ continue;
627
+ }
628
+ else if (key !== 'body') {
629
+ // @ts-expect-error
630
+ querystring[key] = params[key];
631
+ }
632
+ }
633
+ let method = '';
634
+ let path = '';
635
+ if (params.index != null) {
636
+ method = 'GET';
637
+ path = `/${encodeURIComponent(params.index.toString())}/_mapping`;
638
+ }
639
+ else {
640
+ method = 'GET';
641
+ path = '/_mapping';
642
+ }
643
+ return await this.transport.request({ path, method, querystring, body }, options);
644
+ }
645
+ async getSettings(params, options) {
646
+ const acceptedPath = ['index', 'name'];
647
+ const querystring = {};
648
+ const body = undefined;
649
+ params = params !== null && params !== void 0 ? params : {};
650
+ for (const key in params) {
651
+ if (acceptedPath.includes(key)) {
652
+ continue;
653
+ }
654
+ else if (key !== 'body') {
655
+ // @ts-expect-error
656
+ querystring[key] = params[key];
657
+ }
658
+ }
659
+ let method = '';
660
+ let path = '';
661
+ if (params.index != null && params.name != null) {
662
+ method = 'GET';
663
+ path = `/${encodeURIComponent(params.index.toString())}/_settings/${encodeURIComponent(params.name.toString())}`;
664
+ }
665
+ else if (params.index != null) {
666
+ method = 'GET';
667
+ path = `/${encodeURIComponent(params.index.toString())}/_settings`;
668
+ }
669
+ else if (params.name != null) {
670
+ method = 'GET';
671
+ path = `/_settings/${encodeURIComponent(params.name.toString())}`;
672
+ }
673
+ else {
674
+ method = 'GET';
675
+ path = '/_settings';
676
+ }
677
+ return await this.transport.request({ path, method, querystring, body }, options);
678
+ }
679
+ async getTemplate(params, options) {
680
+ const acceptedPath = ['name'];
681
+ const querystring = {};
682
+ const body = undefined;
683
+ params = params !== null && params !== void 0 ? params : {};
684
+ for (const key in params) {
685
+ if (acceptedPath.includes(key)) {
686
+ continue;
687
+ }
688
+ else if (key !== 'body') {
689
+ // @ts-expect-error
690
+ querystring[key] = params[key];
691
+ }
692
+ }
693
+ let method = '';
694
+ let path = '';
695
+ if (params.name != null) {
696
+ method = 'GET';
697
+ path = `/_template/${encodeURIComponent(params.name.toString())}`;
698
+ }
699
+ else {
700
+ method = 'GET';
701
+ path = '/_template';
702
+ }
703
+ return await this.transport.request({ path, method, querystring, body }, options);
704
+ }
705
+ async migrateToDataStream(params, options) {
706
+ const acceptedPath = ['name'];
707
+ const querystring = {};
708
+ const body = undefined;
709
+ for (const key in params) {
710
+ if (acceptedPath.includes(key)) {
711
+ continue;
712
+ }
713
+ else if (key !== 'body') {
714
+ // @ts-expect-error
715
+ querystring[key] = params[key];
716
+ }
717
+ }
718
+ const method = 'POST';
719
+ const path = `/_data_stream/_migrate/${encodeURIComponent(params.name.toString())}`;
720
+ return await this.transport.request({ path, method, querystring, body }, options);
721
+ }
722
+ async modifyDataStream(params, options) {
723
+ const acceptedPath = [];
724
+ const acceptedBody = ['actions'];
725
+ const querystring = {};
726
+ // @ts-expect-error
727
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
728
+ let body;
729
+ if (typeof userBody === 'string') {
730
+ body = userBody;
731
+ }
732
+ else {
733
+ body = userBody != null ? { ...userBody } : undefined;
734
+ }
735
+ for (const key in params) {
736
+ if (acceptedBody.includes(key)) {
737
+ body = body !== null && body !== void 0 ? body : {};
738
+ // @ts-expect-error
739
+ body[key] = params[key];
740
+ }
741
+ else if (acceptedPath.includes(key)) {
742
+ continue;
743
+ }
744
+ else if (key !== 'body') {
745
+ // @ts-expect-error
746
+ querystring[key] = params[key];
747
+ }
748
+ }
749
+ const method = 'POST';
750
+ const path = '/_data_stream/_modify';
751
+ return await this.transport.request({ path, method, querystring, body }, options);
752
+ }
753
+ async open(params, options) {
754
+ const acceptedPath = ['index'];
755
+ const querystring = {};
756
+ const body = undefined;
757
+ for (const key in params) {
758
+ if (acceptedPath.includes(key)) {
759
+ continue;
760
+ }
761
+ else if (key !== 'body') {
762
+ // @ts-expect-error
763
+ querystring[key] = params[key];
764
+ }
765
+ }
766
+ const method = 'POST';
767
+ const path = `/${encodeURIComponent(params.index.toString())}/_open`;
768
+ return await this.transport.request({ path, method, querystring, body }, options);
769
+ }
770
+ async promoteDataStream(params, options) {
771
+ const acceptedPath = ['name'];
772
+ const querystring = {};
773
+ const body = undefined;
774
+ for (const key in params) {
775
+ if (acceptedPath.includes(key)) {
776
+ continue;
777
+ }
778
+ else if (key !== 'body') {
779
+ // @ts-expect-error
780
+ querystring[key] = params[key];
781
+ }
782
+ }
783
+ const method = 'POST';
784
+ const path = `/_data_stream/_promote/${encodeURIComponent(params.name.toString())}`;
785
+ return await this.transport.request({ path, method, querystring, body }, options);
786
+ }
787
+ async putAlias(params, options) {
788
+ const acceptedPath = ['index', 'name'];
789
+ const acceptedBody = ['filter', 'index_routing', 'is_write_index', 'routing', 'search_routing'];
790
+ const querystring = {};
791
+ // @ts-expect-error
792
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
793
+ let body;
794
+ if (typeof userBody === 'string') {
795
+ body = userBody;
796
+ }
797
+ else {
798
+ body = userBody != null ? { ...userBody } : undefined;
799
+ }
800
+ for (const key in params) {
801
+ if (acceptedBody.includes(key)) {
802
+ body = body !== null && body !== void 0 ? body : {};
803
+ // @ts-expect-error
804
+ body[key] = params[key];
805
+ }
806
+ else if (acceptedPath.includes(key)) {
807
+ continue;
808
+ }
809
+ else if (key !== 'body') {
810
+ // @ts-expect-error
811
+ querystring[key] = params[key];
812
+ }
813
+ }
814
+ let method = '';
815
+ let path = '';
816
+ if (params.index != null && params.name != null) {
817
+ method = 'PUT';
818
+ path = `/${encodeURIComponent(params.index.toString())}/_alias/${encodeURIComponent(params.name.toString())}`;
819
+ }
820
+ else {
821
+ method = 'PUT';
822
+ path = `/${encodeURIComponent(params.index.toString())}/_aliases/${encodeURIComponent(params.name.toString())}`;
823
+ }
824
+ return await this.transport.request({ path, method, querystring, body }, options);
825
+ }
826
+ async putIndexTemplate(params, options) {
827
+ const acceptedPath = ['name'];
828
+ const acceptedBody = ['index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta'];
829
+ const querystring = {};
830
+ // @ts-expect-error
831
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
832
+ let body;
833
+ if (typeof userBody === 'string') {
834
+ body = userBody;
835
+ }
836
+ else {
837
+ body = userBody != null ? { ...userBody } : undefined;
838
+ }
839
+ for (const key in params) {
840
+ if (acceptedBody.includes(key)) {
841
+ body = body !== null && body !== void 0 ? body : {};
842
+ // @ts-expect-error
843
+ body[key] = params[key];
844
+ }
845
+ else if (acceptedPath.includes(key)) {
846
+ continue;
847
+ }
848
+ else if (key !== 'body') {
849
+ // @ts-expect-error
850
+ querystring[key] = params[key];
851
+ }
852
+ }
853
+ const method = 'PUT';
854
+ const path = `/_index_template/${encodeURIComponent(params.name.toString())}`;
855
+ return await this.transport.request({ path, method, querystring, body }, options);
856
+ }
857
+ async putMapping(params, options) {
858
+ const acceptedPath = ['index'];
859
+ const acceptedBody = ['date_detection', 'dynamic', 'dynamic_date_formats', 'dynamic_templates', '_field_names', '_meta', 'numeric_detection', 'properties', '_routing', '_source', 'runtime'];
860
+ const querystring = {};
861
+ // @ts-expect-error
862
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
863
+ let body;
864
+ if (typeof userBody === 'string') {
865
+ body = userBody;
866
+ }
867
+ else {
868
+ body = userBody != null ? { ...userBody } : undefined;
869
+ }
870
+ for (const key in params) {
871
+ if (acceptedBody.includes(key)) {
872
+ body = body !== null && body !== void 0 ? body : {};
873
+ // @ts-expect-error
874
+ body[key] = params[key];
875
+ }
876
+ else if (acceptedPath.includes(key)) {
877
+ continue;
878
+ }
879
+ else if (key !== 'body') {
880
+ // @ts-expect-error
881
+ querystring[key] = params[key];
882
+ }
883
+ }
884
+ const method = 'PUT';
885
+ const path = `/${encodeURIComponent(params.index.toString())}/_mapping`;
886
+ return await this.transport.request({ path, method, querystring, body }, options);
887
+ }
888
+ async putSettings(params, options) {
889
+ var _a;
890
+ const acceptedPath = ['index'];
891
+ const acceptedBody = ['settings'];
892
+ const querystring = {};
893
+ // @ts-expect-error
894
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
895
+ for (const key in params) {
896
+ if (acceptedBody.includes(key)) {
897
+ // @ts-expect-error
898
+ body = params[key];
899
+ }
900
+ else if (acceptedPath.includes(key)) {
901
+ continue;
902
+ }
903
+ else if (key !== 'body') {
904
+ // @ts-expect-error
905
+ querystring[key] = params[key];
906
+ }
907
+ }
908
+ let method = '';
909
+ let path = '';
910
+ if (params.index != null) {
911
+ method = 'PUT';
912
+ path = `/${encodeURIComponent(params.index.toString())}/_settings`;
913
+ }
914
+ else {
915
+ method = 'PUT';
916
+ path = '/_settings';
917
+ }
918
+ return await this.transport.request({ path, method, querystring, body }, options);
919
+ }
920
+ async putTemplate(params, options) {
921
+ const acceptedPath = ['name'];
922
+ const acceptedBody = ['aliases', 'index_patterns', 'mappings', 'order', 'settings', 'version'];
923
+ const querystring = {};
924
+ // @ts-expect-error
925
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
926
+ let body;
927
+ if (typeof userBody === 'string') {
928
+ body = userBody;
929
+ }
930
+ else {
931
+ body = userBody != null ? { ...userBody } : undefined;
932
+ }
933
+ for (const key in params) {
934
+ if (acceptedBody.includes(key)) {
935
+ body = body !== null && body !== void 0 ? body : {};
936
+ // @ts-expect-error
937
+ body[key] = params[key];
938
+ }
939
+ else if (acceptedPath.includes(key)) {
940
+ continue;
941
+ }
942
+ else if (key !== 'body') {
943
+ // @ts-expect-error
944
+ querystring[key] = params[key];
945
+ }
946
+ }
947
+ const method = 'PUT';
948
+ const path = `/_template/${encodeURIComponent(params.name.toString())}`;
949
+ return await this.transport.request({ path, method, querystring, body }, options);
950
+ }
951
+ async recovery(params, options) {
952
+ const acceptedPath = ['index'];
953
+ const querystring = {};
954
+ const body = undefined;
955
+ params = params !== null && params !== void 0 ? params : {};
956
+ for (const key in params) {
957
+ if (acceptedPath.includes(key)) {
958
+ continue;
959
+ }
960
+ else if (key !== 'body') {
961
+ // @ts-expect-error
962
+ querystring[key] = params[key];
963
+ }
964
+ }
965
+ let method = '';
966
+ let path = '';
967
+ if (params.index != null) {
968
+ method = 'GET';
969
+ path = `/${encodeURIComponent(params.index.toString())}/_recovery`;
970
+ }
971
+ else {
972
+ method = 'GET';
973
+ path = '/_recovery';
974
+ }
975
+ return await this.transport.request({ path, method, querystring, body }, options);
976
+ }
977
+ async refresh(params, options) {
978
+ const acceptedPath = ['index'];
979
+ const querystring = {};
980
+ const body = undefined;
981
+ params = params !== null && params !== void 0 ? params : {};
982
+ for (const key in params) {
983
+ if (acceptedPath.includes(key)) {
984
+ continue;
985
+ }
986
+ else if (key !== 'body') {
987
+ // @ts-expect-error
988
+ querystring[key] = params[key];
989
+ }
990
+ }
991
+ let method = '';
992
+ let path = '';
993
+ if (params.index != null) {
994
+ method = body != null ? 'POST' : 'GET';
995
+ path = `/${encodeURIComponent(params.index.toString())}/_refresh`;
996
+ }
997
+ else {
998
+ method = body != null ? 'POST' : 'GET';
999
+ path = '/_refresh';
1000
+ }
1001
+ return await this.transport.request({ path, method, querystring, body }, options);
1002
+ }
1003
+ async reloadSearchAnalyzers(params, options) {
1004
+ const acceptedPath = ['index'];
1005
+ const querystring = {};
1006
+ const body = undefined;
1007
+ for (const key in params) {
1008
+ if (acceptedPath.includes(key)) {
1009
+ continue;
1010
+ }
1011
+ else if (key !== 'body') {
1012
+ // @ts-expect-error
1013
+ querystring[key] = params[key];
1014
+ }
1015
+ }
1016
+ const method = body != null ? 'POST' : 'GET';
1017
+ const path = `/${encodeURIComponent(params.index.toString())}/_reload_search_analyzers`;
1018
+ return await this.transport.request({ path, method, querystring, body }, options);
1019
+ }
1020
+ async resolveIndex(params, options) {
1021
+ const acceptedPath = ['name'];
1022
+ const querystring = {};
1023
+ const body = undefined;
1024
+ for (const key in params) {
1025
+ 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 = 'GET';
1034
+ const path = `/_resolve/index/${encodeURIComponent(params.name.toString())}`;
1035
+ return await this.transport.request({ path, method, querystring, body }, options);
1036
+ }
1037
+ async rollover(params, options) {
1038
+ const acceptedPath = ['alias', 'new_index'];
1039
+ const acceptedBody = ['aliases', 'conditions', 'mappings', 'settings'];
1040
+ const querystring = {};
1041
+ // @ts-expect-error
1042
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1043
+ let body;
1044
+ if (typeof userBody === 'string') {
1045
+ body = userBody;
1046
+ }
1047
+ else {
1048
+ body = userBody != null ? { ...userBody } : undefined;
1049
+ }
1050
+ for (const key in params) {
1051
+ if (acceptedBody.includes(key)) {
1052
+ body = body !== null && body !== void 0 ? body : {};
1053
+ // @ts-expect-error
1054
+ body[key] = params[key];
1055
+ }
1056
+ else if (acceptedPath.includes(key)) {
1057
+ continue;
1058
+ }
1059
+ else if (key !== 'body') {
1060
+ // @ts-expect-error
1061
+ querystring[key] = params[key];
1062
+ }
1063
+ }
1064
+ let method = '';
1065
+ let path = '';
1066
+ if (params.alias != null && params.new_index != null) {
1067
+ method = 'POST';
1068
+ path = `/${encodeURIComponent(params.alias.toString())}/_rollover/${encodeURIComponent(params.new_index.toString())}`;
1069
+ }
1070
+ else {
1071
+ method = 'POST';
1072
+ path = `/${encodeURIComponent(params.alias.toString())}/_rollover`;
1073
+ }
1074
+ return await this.transport.request({ path, method, querystring, body }, options);
1075
+ }
1076
+ async segments(params, options) {
1077
+ const acceptedPath = ['index'];
1078
+ const querystring = {};
1079
+ const body = undefined;
1080
+ params = params !== null && params !== void 0 ? params : {};
1081
+ for (const key in params) {
1082
+ if (acceptedPath.includes(key)) {
1083
+ continue;
1084
+ }
1085
+ else if (key !== 'body') {
1086
+ // @ts-expect-error
1087
+ querystring[key] = params[key];
1088
+ }
1089
+ }
1090
+ let method = '';
1091
+ let path = '';
1092
+ if (params.index != null) {
1093
+ method = 'GET';
1094
+ path = `/${encodeURIComponent(params.index.toString())}/_segments`;
1095
+ }
1096
+ else {
1097
+ method = 'GET';
1098
+ path = '/_segments';
1099
+ }
1100
+ return await this.transport.request({ path, method, querystring, body }, options);
1101
+ }
1102
+ async shardStores(params, options) {
1103
+ const acceptedPath = ['index'];
1104
+ const querystring = {};
1105
+ const body = undefined;
1106
+ params = params !== null && params !== void 0 ? params : {};
1107
+ for (const key in params) {
1108
+ if (acceptedPath.includes(key)) {
1109
+ continue;
1110
+ }
1111
+ else if (key !== 'body') {
1112
+ // @ts-expect-error
1113
+ querystring[key] = params[key];
1114
+ }
1115
+ }
1116
+ let method = '';
1117
+ let path = '';
1118
+ if (params.index != null) {
1119
+ method = 'GET';
1120
+ path = `/${encodeURIComponent(params.index.toString())}/_shard_stores`;
1121
+ }
1122
+ else {
1123
+ method = 'GET';
1124
+ path = '/_shard_stores';
1125
+ }
1126
+ return await this.transport.request({ path, method, querystring, body }, options);
1127
+ }
1128
+ async shrink(params, options) {
1129
+ const acceptedPath = ['index', 'target'];
1130
+ const acceptedBody = ['aliases', 'settings'];
1131
+ const querystring = {};
1132
+ // @ts-expect-error
1133
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1134
+ let body;
1135
+ if (typeof userBody === 'string') {
1136
+ body = userBody;
1137
+ }
1138
+ else {
1139
+ body = userBody != null ? { ...userBody } : undefined;
1140
+ }
1141
+ for (const key in params) {
1142
+ if (acceptedBody.includes(key)) {
1143
+ body = body !== null && body !== void 0 ? body : {};
1144
+ // @ts-expect-error
1145
+ body[key] = params[key];
1146
+ }
1147
+ else if (acceptedPath.includes(key)) {
1148
+ continue;
1149
+ }
1150
+ else if (key !== 'body') {
1151
+ // @ts-expect-error
1152
+ querystring[key] = params[key];
1153
+ }
1154
+ }
1155
+ const method = 'PUT';
1156
+ const path = `/${encodeURIComponent(params.index.toString())}/_shrink/${encodeURIComponent(params.target.toString())}`;
1157
+ return await this.transport.request({ path, method, querystring, body }, options);
1158
+ }
1159
+ async simulateIndexTemplate(params, options) {
1160
+ const acceptedPath = ['name'];
1161
+ const acceptedBody = ['allow_auto_create', 'index_patterns', 'composed_of', 'template', 'data_stream', 'priority', 'version', '_meta'];
1162
+ const querystring = {};
1163
+ // @ts-expect-error
1164
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1165
+ let body;
1166
+ if (typeof userBody === 'string') {
1167
+ body = userBody;
1168
+ }
1169
+ else {
1170
+ body = userBody != null ? { ...userBody } : undefined;
1171
+ }
1172
+ for (const key in params) {
1173
+ if (acceptedBody.includes(key)) {
1174
+ body = body !== null && body !== void 0 ? body : {};
1175
+ // @ts-expect-error
1176
+ body[key] = params[key];
1177
+ }
1178
+ else if (acceptedPath.includes(key)) {
1179
+ continue;
1180
+ }
1181
+ else if (key !== 'body') {
1182
+ // @ts-expect-error
1183
+ querystring[key] = params[key];
1184
+ }
1185
+ }
1186
+ const method = 'POST';
1187
+ const path = `/_index_template/_simulate_index/${encodeURIComponent(params.name.toString())}`;
1188
+ return await this.transport.request({ path, method, querystring, body }, options);
1189
+ }
1190
+ async simulateTemplate(params, options) {
1191
+ var _a;
1192
+ const acceptedPath = ['name'];
1193
+ const acceptedBody = ['template'];
1194
+ const querystring = {};
1195
+ // @ts-expect-error
1196
+ let body = (_a = params.body) !== null && _a !== void 0 ? _a : undefined;
1197
+ for (const key in params) {
1198
+ if (acceptedBody.includes(key)) {
1199
+ // @ts-expect-error
1200
+ body = params[key];
1201
+ }
1202
+ else if (acceptedPath.includes(key)) {
1203
+ continue;
1204
+ }
1205
+ else if (key !== 'body') {
1206
+ // @ts-expect-error
1207
+ querystring[key] = params[key];
1208
+ }
1209
+ }
1210
+ let method = '';
1211
+ let path = '';
1212
+ if (params.name != null) {
1213
+ method = 'POST';
1214
+ path = `/_index_template/_simulate/${encodeURIComponent(params.name.toString())}`;
1215
+ }
1216
+ else {
1217
+ method = 'POST';
1218
+ path = '/_index_template/_simulate';
1219
+ }
1220
+ return await this.transport.request({ path, method, querystring, body }, options);
1221
+ }
1222
+ async split(params, options) {
1223
+ const acceptedPath = ['index', 'target'];
1224
+ const acceptedBody = ['aliases', 'settings'];
1225
+ const querystring = {};
1226
+ // @ts-expect-error
1227
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1228
+ let body;
1229
+ if (typeof userBody === 'string') {
1230
+ body = userBody;
1231
+ }
1232
+ else {
1233
+ body = userBody != null ? { ...userBody } : undefined;
1234
+ }
1235
+ for (const key in params) {
1236
+ if (acceptedBody.includes(key)) {
1237
+ body = body !== null && body !== void 0 ? body : {};
1238
+ // @ts-expect-error
1239
+ body[key] = params[key];
1240
+ }
1241
+ else if (acceptedPath.includes(key)) {
1242
+ continue;
1243
+ }
1244
+ else if (key !== 'body') {
1245
+ // @ts-expect-error
1246
+ querystring[key] = params[key];
1247
+ }
1248
+ }
1249
+ const method = 'PUT';
1250
+ const path = `/${encodeURIComponent(params.index.toString())}/_split/${encodeURIComponent(params.target.toString())}`;
1251
+ return await this.transport.request({ path, method, querystring, body }, options);
1252
+ }
1253
+ async stats(params, options) {
1254
+ const acceptedPath = ['metric', 'index'];
1255
+ const querystring = {};
1256
+ const body = undefined;
1257
+ params = params !== null && params !== void 0 ? params : {};
1258
+ for (const key in params) {
1259
+ if (acceptedPath.includes(key)) {
1260
+ continue;
1261
+ }
1262
+ else if (key !== 'body') {
1263
+ // @ts-expect-error
1264
+ querystring[key] = params[key];
1265
+ }
1266
+ }
1267
+ let method = '';
1268
+ let path = '';
1269
+ if (params.index != null && params.metric != null) {
1270
+ method = 'GET';
1271
+ path = `/${encodeURIComponent(params.index.toString())}/_stats/${encodeURIComponent(params.metric.toString())}`;
1272
+ }
1273
+ else if (params.metric != null) {
1274
+ method = 'GET';
1275
+ path = `/_stats/${encodeURIComponent(params.metric.toString())}`;
1276
+ }
1277
+ else if (params.index != null) {
1278
+ method = 'GET';
1279
+ path = `/${encodeURIComponent(params.index.toString())}/_stats`;
1280
+ }
1281
+ else {
1282
+ method = 'GET';
1283
+ path = '/_stats';
1284
+ }
1285
+ return await this.transport.request({ path, method, querystring, body }, options);
1286
+ }
1287
+ async unfreeze(params, options) {
1288
+ const acceptedPath = ['index'];
1289
+ const querystring = {};
1290
+ const body = undefined;
1291
+ for (const key in params) {
1292
+ if (acceptedPath.includes(key)) {
1293
+ continue;
1294
+ }
1295
+ else if (key !== 'body') {
1296
+ // @ts-expect-error
1297
+ querystring[key] = params[key];
1298
+ }
1299
+ }
1300
+ const method = 'POST';
1301
+ const path = `/${encodeURIComponent(params.index.toString())}/_unfreeze`;
1302
+ return await this.transport.request({ path, method, querystring, body }, options);
1303
+ }
1304
+ async updateAliases(params, options) {
1305
+ const acceptedPath = [];
1306
+ const acceptedBody = ['actions'];
1307
+ const querystring = {};
1308
+ // @ts-expect-error
1309
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1310
+ let body;
1311
+ if (typeof userBody === 'string') {
1312
+ body = userBody;
1313
+ }
1314
+ else {
1315
+ body = userBody != null ? { ...userBody } : undefined;
1316
+ }
1317
+ params = params !== null && params !== void 0 ? params : {};
1318
+ for (const key in params) {
1319
+ if (acceptedBody.includes(key)) {
1320
+ body = body !== null && body !== void 0 ? body : {};
1321
+ // @ts-expect-error
1322
+ body[key] = params[key];
1323
+ }
1324
+ else if (acceptedPath.includes(key)) {
1325
+ continue;
1326
+ }
1327
+ else if (key !== 'body') {
1328
+ // @ts-expect-error
1329
+ querystring[key] = params[key];
1330
+ }
1331
+ }
1332
+ const method = 'POST';
1333
+ const path = '/_aliases';
1334
+ return await this.transport.request({ path, method, querystring, body }, options);
1335
+ }
1336
+ async validateQuery(params, options) {
1337
+ const acceptedPath = ['index'];
1338
+ const acceptedBody = ['query'];
1339
+ const querystring = {};
1340
+ // @ts-expect-error
1341
+ const userBody = params === null || params === void 0 ? void 0 : params.body;
1342
+ let body;
1343
+ if (typeof userBody === 'string') {
1344
+ body = userBody;
1345
+ }
1346
+ else {
1347
+ body = userBody != null ? { ...userBody } : undefined;
1348
+ }
1349
+ params = params !== null && params !== void 0 ? params : {};
1350
+ for (const key in params) {
1351
+ if (acceptedBody.includes(key)) {
1352
+ body = body !== null && body !== void 0 ? body : {};
1353
+ // @ts-expect-error
1354
+ body[key] = params[key];
1355
+ }
1356
+ else if (acceptedPath.includes(key)) {
1357
+ continue;
1358
+ }
1359
+ else if (key !== 'body') {
1360
+ // @ts-expect-error
1361
+ querystring[key] = params[key];
1362
+ }
1363
+ }
1364
+ let method = '';
1365
+ let path = '';
1366
+ if (params.index != null) {
1367
+ method = body != null ? 'POST' : 'GET';
1368
+ path = `/${encodeURIComponent(params.index.toString())}/_validate/query`;
1369
+ }
1370
+ else {
1371
+ method = body != null ? 'POST' : 'GET';
1372
+ path = '/_validate/query';
1373
+ }
1374
+ return await this.transport.request({ path, method, querystring, body }, options);
1375
+ }
1376
+ }
1377
+ exports.default = Indices;
1378
+ //# sourceMappingURL=indices.js.map