@elastic/elasticsearch 7.15.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 (103) hide show
  1. package/.dockerignore +5 -0
  2. package/LICENSE +202 -0
  3. package/README.md +232 -0
  4. package/api/api/async_search.js +141 -0
  5. package/api/api/autoscaling.js +147 -0
  6. package/api/api/bulk.js +70 -0
  7. package/api/api/cat.js +648 -0
  8. package/api/api/ccr.js +403 -0
  9. package/api/api/clear_scroll.js +55 -0
  10. package/api/api/close_point_in_time.js +50 -0
  11. package/api/api/cluster.js +420 -0
  12. package/api/api/count.js +64 -0
  13. package/api/api/create.js +69 -0
  14. package/api/api/dangling_indices.js +115 -0
  15. package/api/api/delete.js +65 -0
  16. package/api/api/delete_by_query.js +71 -0
  17. package/api/api/delete_by_query_rethrottle.js +60 -0
  18. package/api/api/delete_script.js +56 -0
  19. package/api/api/enrich.js +173 -0
  20. package/api/api/eql.js +150 -0
  21. package/api/api/exists.js +65 -0
  22. package/api/api/exists_source.js +74 -0
  23. package/api/api/explain.js +65 -0
  24. package/api/api/features.js +81 -0
  25. package/api/api/field_caps.js +55 -0
  26. package/api/api/fleet.js +65 -0
  27. package/api/api/get.js +65 -0
  28. package/api/api/get_script.js +56 -0
  29. package/api/api/get_script_context.js +50 -0
  30. package/api/api/get_script_languages.js +50 -0
  31. package/api/api/get_source.js +65 -0
  32. package/api/api/graph.js +72 -0
  33. package/api/api/ilm.js +317 -0
  34. package/api/api/index.js +71 -0
  35. package/api/api/indices.js +1753 -0
  36. package/api/api/info.js +50 -0
  37. package/api/api/ingest.js +200 -0
  38. package/api/api/license.js +188 -0
  39. package/api/api/logstash.js +125 -0
  40. package/api/api/mget.js +70 -0
  41. package/api/api/migration.js +60 -0
  42. package/api/api/ml.js +2010 -0
  43. package/api/api/monitoring.js +66 -0
  44. package/api/api/msearch.js +70 -0
  45. package/api/api/msearch_template.js +70 -0
  46. package/api/api/mtermvectors.js +64 -0
  47. package/api/api/nodes.js +268 -0
  48. package/api/api/open_point_in_time.js +56 -0
  49. package/api/api/ping.js +50 -0
  50. package/api/api/put_script.js +71 -0
  51. package/api/api/rank_eval.js +61 -0
  52. package/api/api/reindex.js +56 -0
  53. package/api/api/reindex_rethrottle.js +60 -0
  54. package/api/api/render_search_template.js +55 -0
  55. package/api/api/rollup.js +319 -0
  56. package/api/api/scripts_painless_execute.js +50 -0
  57. package/api/api/scroll.js +55 -0
  58. package/api/api/search.js +64 -0
  59. package/api/api/search_mvt.js +87 -0
  60. package/api/api/search_shards.js +55 -0
  61. package/api/api/search_template.js +70 -0
  62. package/api/api/searchable_snapshots.js +186 -0
  63. package/api/api/security.js +1261 -0
  64. package/api/api/shutdown.js +124 -0
  65. package/api/api/slm.js +256 -0
  66. package/api/api/snapshot.js +439 -0
  67. package/api/api/sql.js +203 -0
  68. package/api/api/ssl.js +55 -0
  69. package/api/api/tasks.js +108 -0
  70. package/api/api/terms_enum.js +56 -0
  71. package/api/api/termvectors.js +67 -0
  72. package/api/api/text_structure.js +65 -0
  73. package/api/api/transform.js +268 -0
  74. package/api/api/update.js +69 -0
  75. package/api/api/update_by_query.js +67 -0
  76. package/api/api/update_by_query_rethrottle.js +60 -0
  77. package/api/api/watcher.js +333 -0
  78. package/api/api/xpack.js +76 -0
  79. package/api/index.js +508 -0
  80. package/api/new.d.ts +1585 -0
  81. package/api/requestParams.d.ts +2920 -0
  82. package/api/types.d.ts +15420 -0
  83. package/api/utils.js +58 -0
  84. package/codecov.yml +14 -0
  85. package/index.d.ts +2991 -0
  86. package/index.js +349 -0
  87. package/index.mjs +29 -0
  88. package/lib/Connection.d.ts +99 -0
  89. package/lib/Connection.js +392 -0
  90. package/lib/Helpers.d.ts +124 -0
  91. package/lib/Helpers.js +770 -0
  92. package/lib/Serializer.d.ts +30 -0
  93. package/lib/Serializer.js +94 -0
  94. package/lib/Transport.d.ts +162 -0
  95. package/lib/Transport.js +689 -0
  96. package/lib/errors.d.ts +90 -0
  97. package/lib/errors.js +159 -0
  98. package/lib/pool/BaseConnectionPool.js +262 -0
  99. package/lib/pool/CloudConnectionPool.js +64 -0
  100. package/lib/pool/ConnectionPool.js +246 -0
  101. package/lib/pool/index.d.ts +220 -0
  102. package/lib/pool/index.js +30 -0
  103. package/package.json +106 -0
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ 'use strict'
21
+
22
+ /* eslint camelcase: 0 */
23
+ /* eslint no-unused-vars: 0 */
24
+
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'pipeline', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'size', 'max_docs', 'sort', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'terminate_after', 'stats', 'version', 'version_type', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', terminateAfter: 'terminate_after', versionType: 'version_type', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', scrollSize: 'scroll_size', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function updateByQueryApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required parameters
33
+ if (params.index == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: index')
35
+ return handleError(err, callback)
36
+ }
37
+
38
+ // check required url components
39
+ if (params.type != null && (params.index == null)) {
40
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
41
+ return handleError(err, callback)
42
+ }
43
+
44
+ let { method, body, index, type, ...querystring } = params
45
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
46
+
47
+ let path = ''
48
+ if ((index) != null && (type) != null) {
49
+ if (method == null) method = 'POST'
50
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query'
51
+ } else {
52
+ if (method == null) method = 'POST'
53
+ path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
54
+ }
55
+
56
+ // build request object
57
+ const request = {
58
+ method,
59
+ path,
60
+ body: body || '',
61
+ querystring
62
+ }
63
+
64
+ return this.transport.request(request, options, callback)
65
+ }
66
+
67
+ module.exports = updateByQueryApi
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ 'use strict'
21
+
22
+ /* eslint camelcase: 0 */
23
+ /* eslint no-unused-vars: 0 */
24
+
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function updateByQueryRethrottleApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required parameters
33
+ if (params.task_id == null && params.taskId == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
35
+ return handleError(err, callback)
36
+ }
37
+ if (params.requests_per_second == null && params.requestsPerSecond == null) {
38
+ const err = new this[kConfigurationError]('Missing required parameter: requests_per_second or requestsPerSecond')
39
+ return handleError(err, callback)
40
+ }
41
+
42
+ let { method, body, taskId, task_id, ...querystring } = params
43
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
44
+
45
+ let path = ''
46
+ if (method == null) method = 'POST'
47
+ path = '/' + '_update_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
48
+
49
+ // build request object
50
+ const request = {
51
+ method,
52
+ path,
53
+ body: body || '',
54
+ querystring
55
+ }
56
+
57
+ return this.transport.request(request, options, callback)
58
+ }
59
+
60
+ module.exports = updateByQueryRethrottleApi
@@ -0,0 +1,333 @@
1
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ 'use strict'
21
+
22
+ /* eslint camelcase: 0 */
23
+ /* eslint no-unused-vars: 0 */
24
+
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'debug', 'active', 'version', 'if_seq_no', 'if_primary_term', 'metric', 'emit_stacktraces']
27
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', emitStacktraces: 'emit_stacktraces' }
28
+
29
+ function WatcherApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ WatcherApi.prototype.ackWatch = function watcherAckWatchApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ // check required parameters
38
+ if (params.watch_id == null && params.watchId == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: watch_id or watchId')
40
+ return handleError(err, callback)
41
+ }
42
+
43
+ // check required url components
44
+ if ((params.action_id != null || params.actionId != null) && ((params.watch_id == null && params.watchId == null))) {
45
+ const err = new this[kConfigurationError]('Missing required parameter of the url: watch_id')
46
+ return handleError(err, callback)
47
+ }
48
+
49
+ let { method, body, watchId, watch_id, actionId, action_id, ...querystring } = params
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
51
+
52
+ let path = ''
53
+ if ((watch_id || watchId) != null && (action_id || actionId) != null) {
54
+ if (method == null) method = 'PUT'
55
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack' + '/' + encodeURIComponent(action_id || actionId)
56
+ } else {
57
+ if (method == null) method = 'PUT'
58
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_ack'
59
+ }
60
+
61
+ // build request object
62
+ const request = {
63
+ method,
64
+ path,
65
+ body: body || '',
66
+ querystring
67
+ }
68
+
69
+ return this.transport.request(request, options, callback)
70
+ }
71
+
72
+ WatcherApi.prototype.activateWatch = function watcherActivateWatchApi (params, options, callback) {
73
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
74
+
75
+ // check required parameters
76
+ if (params.watch_id == null && params.watchId == null) {
77
+ const err = new this[kConfigurationError]('Missing required parameter: watch_id or watchId')
78
+ return handleError(err, callback)
79
+ }
80
+
81
+ let { method, body, watchId, watch_id, ...querystring } = params
82
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
83
+
84
+ let path = ''
85
+ if (method == null) method = 'PUT'
86
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_activate'
87
+
88
+ // build request object
89
+ const request = {
90
+ method,
91
+ path,
92
+ body: body || '',
93
+ querystring
94
+ }
95
+
96
+ return this.transport.request(request, options, callback)
97
+ }
98
+
99
+ WatcherApi.prototype.deactivateWatch = function watcherDeactivateWatchApi (params, options, callback) {
100
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
101
+
102
+ // check required parameters
103
+ if (params.watch_id == null && params.watchId == null) {
104
+ const err = new this[kConfigurationError]('Missing required parameter: watch_id or watchId')
105
+ return handleError(err, callback)
106
+ }
107
+
108
+ let { method, body, watchId, watch_id, ...querystring } = params
109
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
110
+
111
+ let path = ''
112
+ if (method == null) method = 'PUT'
113
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(watch_id || watchId) + '/' + '_deactivate'
114
+
115
+ // build request object
116
+ const request = {
117
+ method,
118
+ path,
119
+ body: body || '',
120
+ querystring
121
+ }
122
+
123
+ return this.transport.request(request, options, callback)
124
+ }
125
+
126
+ WatcherApi.prototype.deleteWatch = function watcherDeleteWatchApi (params, options, callback) {
127
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
128
+
129
+ // check required parameters
130
+ if (params.id == null) {
131
+ const err = new this[kConfigurationError]('Missing required parameter: id')
132
+ return handleError(err, callback)
133
+ }
134
+
135
+ let { method, body, id, ...querystring } = params
136
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
137
+
138
+ let path = ''
139
+ if (method == null) method = 'DELETE'
140
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id)
141
+
142
+ // build request object
143
+ const request = {
144
+ method,
145
+ path,
146
+ body: body || '',
147
+ querystring
148
+ }
149
+
150
+ return this.transport.request(request, options, callback)
151
+ }
152
+
153
+ WatcherApi.prototype.executeWatch = function watcherExecuteWatchApi (params, options, callback) {
154
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
155
+
156
+ let { method, body, id, ...querystring } = params
157
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
158
+
159
+ let path = ''
160
+ if ((id) != null) {
161
+ if (method == null) method = 'PUT'
162
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id) + '/' + '_execute'
163
+ } else {
164
+ if (method == null) method = 'PUT'
165
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + '_execute'
166
+ }
167
+
168
+ // build request object
169
+ const request = {
170
+ method,
171
+ path,
172
+ body: body || '',
173
+ querystring
174
+ }
175
+
176
+ return this.transport.request(request, options, callback)
177
+ }
178
+
179
+ WatcherApi.prototype.getWatch = function watcherGetWatchApi (params, options, callback) {
180
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
181
+
182
+ // check required parameters
183
+ if (params.id == null) {
184
+ const err = new this[kConfigurationError]('Missing required parameter: id')
185
+ return handleError(err, callback)
186
+ }
187
+
188
+ let { method, body, id, ...querystring } = params
189
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
190
+
191
+ let path = ''
192
+ if (method == null) method = 'GET'
193
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id)
194
+
195
+ // build request object
196
+ const request = {
197
+ method,
198
+ path,
199
+ body: null,
200
+ querystring
201
+ }
202
+
203
+ return this.transport.request(request, options, callback)
204
+ }
205
+
206
+ WatcherApi.prototype.putWatch = function watcherPutWatchApi (params, options, callback) {
207
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
208
+
209
+ // check required parameters
210
+ if (params.id == null) {
211
+ const err = new this[kConfigurationError]('Missing required parameter: id')
212
+ return handleError(err, callback)
213
+ }
214
+
215
+ let { method, body, id, ...querystring } = params
216
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
217
+
218
+ let path = ''
219
+ if (method == null) method = 'PUT'
220
+ path = '/' + '_watcher' + '/' + 'watch' + '/' + encodeURIComponent(id)
221
+
222
+ // build request object
223
+ const request = {
224
+ method,
225
+ path,
226
+ body: body || '',
227
+ querystring
228
+ }
229
+
230
+ return this.transport.request(request, options, callback)
231
+ }
232
+
233
+ WatcherApi.prototype.queryWatches = function watcherQueryWatchesApi (params, options, callback) {
234
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
235
+
236
+ let { method, body, ...querystring } = params
237
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
238
+
239
+ let path = ''
240
+ if (method == null) method = body == null ? 'GET' : 'POST'
241
+ path = '/' + '_watcher' + '/' + '_query' + '/' + 'watches'
242
+
243
+ // build request object
244
+ const request = {
245
+ method,
246
+ path,
247
+ body: body || '',
248
+ querystring
249
+ }
250
+
251
+ return this.transport.request(request, options, callback)
252
+ }
253
+
254
+ WatcherApi.prototype.start = function watcherStartApi (params, options, callback) {
255
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
256
+
257
+ let { method, body, ...querystring } = params
258
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
259
+
260
+ let path = ''
261
+ if (method == null) method = 'POST'
262
+ path = '/' + '_watcher' + '/' + '_start'
263
+
264
+ // build request object
265
+ const request = {
266
+ method,
267
+ path,
268
+ body: body || '',
269
+ querystring
270
+ }
271
+
272
+ return this.transport.request(request, options, callback)
273
+ }
274
+
275
+ WatcherApi.prototype.stats = function watcherStatsApi (params, options, callback) {
276
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
277
+
278
+ let { method, body, metric, ...querystring } = params
279
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
280
+
281
+ let path = ''
282
+ if ((metric) != null) {
283
+ if (method == null) method = 'GET'
284
+ path = '/' + '_watcher' + '/' + 'stats' + '/' + encodeURIComponent(metric)
285
+ } else {
286
+ if (method == null) method = 'GET'
287
+ path = '/' + '_watcher' + '/' + 'stats'
288
+ }
289
+
290
+ // build request object
291
+ const request = {
292
+ method,
293
+ path,
294
+ body: null,
295
+ querystring
296
+ }
297
+
298
+ return this.transport.request(request, options, callback)
299
+ }
300
+
301
+ WatcherApi.prototype.stop = function watcherStopApi (params, options, callback) {
302
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
303
+
304
+ let { method, body, ...querystring } = params
305
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
306
+
307
+ let path = ''
308
+ if (method == null) method = 'POST'
309
+ path = '/' + '_watcher' + '/' + '_stop'
310
+
311
+ // build request object
312
+ const request = {
313
+ method,
314
+ path,
315
+ body: body || '',
316
+ querystring
317
+ }
318
+
319
+ return this.transport.request(request, options, callback)
320
+ }
321
+
322
+ Object.defineProperties(WatcherApi.prototype, {
323
+ ack_watch: { get () { return this.ackWatch } },
324
+ activate_watch: { get () { return this.activateWatch } },
325
+ deactivate_watch: { get () { return this.deactivateWatch } },
326
+ delete_watch: { get () { return this.deleteWatch } },
327
+ execute_watch: { get () { return this.executeWatch } },
328
+ get_watch: { get () { return this.getWatch } },
329
+ put_watch: { get () { return this.putWatch } },
330
+ query_watches: { get () { return this.queryWatches } }
331
+ })
332
+
333
+ module.exports = WatcherApi
@@ -0,0 +1,76 @@
1
+ /*
2
+ * Licensed to Elasticsearch B.V. under one or more contributor
3
+ * license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright
5
+ * ownership. Elasticsearch B.V. licenses this file to you under
6
+ * the Apache License, Version 2.0 (the "License"); you may
7
+ * not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing,
13
+ * software distributed under the License is distributed on an
14
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
+ * KIND, either express or implied. See the License for the
16
+ * specific language governing permissions and limitations
17
+ * under the License.
18
+ */
19
+
20
+ 'use strict'
21
+
22
+ /* eslint camelcase: 0 */
23
+ /* eslint no-unused-vars: 0 */
24
+
25
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
26
+ const acceptedQuerystring = ['categories', 'accept_enterprise', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'master_timeout']
27
+ const snakeCase = { acceptEnterprise: 'accept_enterprise', errorTrace: 'error_trace', filterPath: 'filter_path', masterTimeout: 'master_timeout' }
28
+
29
+ function XpackApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ XpackApi.prototype.info = function xpackInfoApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ let { method, body, ...querystring } = params
38
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
39
+
40
+ let path = ''
41
+ if (method == null) method = 'GET'
42
+ path = '/' + '_xpack'
43
+
44
+ // build request object
45
+ const request = {
46
+ method,
47
+ path,
48
+ body: null,
49
+ querystring
50
+ }
51
+
52
+ return this.transport.request(request, options, callback)
53
+ }
54
+
55
+ XpackApi.prototype.usage = function xpackUsageApi (params, options, callback) {
56
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
57
+
58
+ let { method, body, ...querystring } = params
59
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
60
+
61
+ let path = ''
62
+ if (method == null) method = 'GET'
63
+ path = '/' + '_xpack' + '/' + 'usage'
64
+
65
+ // build request object
66
+ const request = {
67
+ method,
68
+ path,
69
+ body: null,
70
+ querystring
71
+ }
72
+
73
+ return this.transport.request(request, options, callback)
74
+ }
75
+
76
+ module.exports = XpackApi