@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,71 @@
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 = ['timeout', 'master_timeout', 'context', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function putScriptApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required parameters
33
+ if (params.id == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: id')
35
+ return handleError(err, callback)
36
+ }
37
+ if (params.body == null) {
38
+ const err = new this[kConfigurationError]('Missing required parameter: body')
39
+ return handleError(err, callback)
40
+ }
41
+
42
+ // check required url components
43
+ if (params.context != null && (params.id == null)) {
44
+ const err = new this[kConfigurationError]('Missing required parameter of the url: id')
45
+ return handleError(err, callback)
46
+ }
47
+
48
+ let { method, body, id, context, ...querystring } = params
49
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
50
+
51
+ let path = ''
52
+ if ((id) != null && (context) != null) {
53
+ if (method == null) method = 'PUT'
54
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id) + '/' + encodeURIComponent(context)
55
+ } else {
56
+ if (method == null) method = 'PUT'
57
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id)
58
+ }
59
+
60
+ // build request object
61
+ const request = {
62
+ method,
63
+ path,
64
+ body: body || '',
65
+ querystring
66
+ }
67
+
68
+ return this.transport.request(request, options, callback)
69
+ }
70
+
71
+ module.exports = putScriptApi
@@ -0,0 +1,61 @@
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 = ['ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'search_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function rankEvalApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required parameters
33
+ if (params.body == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: body')
35
+ return handleError(err, callback)
36
+ }
37
+
38
+ let { method, body, index, ...querystring } = params
39
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
40
+
41
+ let path = ''
42
+ if ((index) != null) {
43
+ if (method == null) method = body == null ? 'GET' : 'POST'
44
+ path = '/' + encodeURIComponent(index) + '/' + '_rank_eval'
45
+ } else {
46
+ if (method == null) method = body == null ? 'GET' : 'POST'
47
+ path = '/' + '_rank_eval'
48
+ }
49
+
50
+ // build request object
51
+ const request = {
52
+ method,
53
+ path,
54
+ body: body || '',
55
+ querystring
56
+ }
57
+
58
+ return this.transport.request(request, options, callback)
59
+ }
60
+
61
+ module.exports = rankEvalApi
@@ -0,0 +1,56 @@
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 = ['refresh', 'timeout', 'wait_for_active_shards', 'wait_for_completion', 'requests_per_second', 'scroll', 'slices', 'max_docs', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
27
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', maxDocs: 'max_docs', errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function reindexApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ // check required parameters
33
+ if (params.body == null) {
34
+ const err = new this[kConfigurationError]('Missing required parameter: body')
35
+ return handleError(err, callback)
36
+ }
37
+
38
+ let { method, body, ...querystring } = params
39
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
40
+
41
+ let path = ''
42
+ if (method == null) method = 'POST'
43
+ path = '/' + '_reindex'
44
+
45
+ // build request object
46
+ const request = {
47
+ method,
48
+ path,
49
+ body: body || '',
50
+ querystring
51
+ }
52
+
53
+ return this.transport.request(request, options, callback)
54
+ }
55
+
56
+ module.exports = reindexApi
@@ -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 reindexRethrottleApi (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 = '/' + '_reindex' + '/' + 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 = reindexRethrottleApi
@@ -0,0 +1,55 @@
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']
27
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function renderSearchTemplateApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ let { method, body, id, ...querystring } = params
33
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
34
+
35
+ let path = ''
36
+ if ((id) != null) {
37
+ if (method == null) method = body == null ? 'GET' : 'POST'
38
+ path = '/' + '_render' + '/' + 'template' + '/' + encodeURIComponent(id)
39
+ } else {
40
+ if (method == null) method = body == null ? 'GET' : 'POST'
41
+ path = '/' + '_render' + '/' + 'template'
42
+ }
43
+
44
+ // build request object
45
+ const request = {
46
+ method,
47
+ path,
48
+ body: body || '',
49
+ querystring
50
+ }
51
+
52
+ return this.transport.request(request, options, callback)
53
+ }
54
+
55
+ module.exports = renderSearchTemplateApi
@@ -0,0 +1,319 @@
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', 'typed_keys', 'rest_total_hits_as_int', 'wait_for_completion', 'timeout']
27
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', typedKeys: 'typed_keys', restTotalHitsAsInt: 'rest_total_hits_as_int', waitForCompletion: 'wait_for_completion' }
28
+
29
+ function RollupApi (transport, ConfigurationError) {
30
+ this.transport = transport
31
+ this[kConfigurationError] = ConfigurationError
32
+ }
33
+
34
+ RollupApi.prototype.deleteJob = function rollupDeleteJobApi (params, options, callback) {
35
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
36
+
37
+ // check required parameters
38
+ if (params.id == null) {
39
+ const err = new this[kConfigurationError]('Missing required parameter: id')
40
+ return handleError(err, callback)
41
+ }
42
+
43
+ let { method, body, id, ...querystring } = params
44
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
45
+
46
+ let path = ''
47
+ if (method == null) method = 'DELETE'
48
+ path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id)
49
+
50
+ // build request object
51
+ const request = {
52
+ method,
53
+ path,
54
+ body: body || '',
55
+ querystring
56
+ }
57
+
58
+ return this.transport.request(request, options, callback)
59
+ }
60
+
61
+ RollupApi.prototype.getJobs = function rollupGetJobsApi (params, options, callback) {
62
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+
64
+ let { method, body, id, ...querystring } = params
65
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+
67
+ let path = ''
68
+ if ((id) != null) {
69
+ if (method == null) method = 'GET'
70
+ path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id)
71
+ } else {
72
+ if (method == null) method = 'GET'
73
+ path = '/' + '_rollup' + '/' + 'job'
74
+ }
75
+
76
+ // build request object
77
+ const request = {
78
+ method,
79
+ path,
80
+ body: null,
81
+ querystring
82
+ }
83
+
84
+ return this.transport.request(request, options, callback)
85
+ }
86
+
87
+ RollupApi.prototype.getRollupCaps = function rollupGetRollupCapsApi (params, options, callback) {
88
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
89
+
90
+ let { method, body, id, ...querystring } = params
91
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
92
+
93
+ let path = ''
94
+ if ((id) != null) {
95
+ if (method == null) method = 'GET'
96
+ path = '/' + '_rollup' + '/' + 'data' + '/' + encodeURIComponent(id)
97
+ } else {
98
+ if (method == null) method = 'GET'
99
+ path = '/' + '_rollup' + '/' + 'data'
100
+ }
101
+
102
+ // build request object
103
+ const request = {
104
+ method,
105
+ path,
106
+ body: null,
107
+ querystring
108
+ }
109
+
110
+ return this.transport.request(request, options, callback)
111
+ }
112
+
113
+ RollupApi.prototype.getRollupIndexCaps = function rollupGetRollupIndexCapsApi (params, options, callback) {
114
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
115
+
116
+ // check required parameters
117
+ if (params.index == null) {
118
+ const err = new this[kConfigurationError]('Missing required parameter: index')
119
+ return handleError(err, callback)
120
+ }
121
+
122
+ let { method, body, index, ...querystring } = params
123
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
124
+
125
+ let path = ''
126
+ if (method == null) method = 'GET'
127
+ path = '/' + encodeURIComponent(index) + '/' + '_rollup' + '/' + 'data'
128
+
129
+ // build request object
130
+ const request = {
131
+ method,
132
+ path,
133
+ body: null,
134
+ querystring
135
+ }
136
+
137
+ return this.transport.request(request, options, callback)
138
+ }
139
+
140
+ RollupApi.prototype.putJob = function rollupPutJobApi (params, options, callback) {
141
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
142
+
143
+ // check required parameters
144
+ if (params.id == null) {
145
+ const err = new this[kConfigurationError]('Missing required parameter: id')
146
+ return handleError(err, callback)
147
+ }
148
+ if (params.body == null) {
149
+ const err = new this[kConfigurationError]('Missing required parameter: body')
150
+ return handleError(err, callback)
151
+ }
152
+
153
+ let { method, body, id, ...querystring } = params
154
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
155
+
156
+ let path = ''
157
+ if (method == null) method = 'PUT'
158
+ path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id)
159
+
160
+ // build request object
161
+ const request = {
162
+ method,
163
+ path,
164
+ body: body || '',
165
+ querystring
166
+ }
167
+
168
+ return this.transport.request(request, options, callback)
169
+ }
170
+
171
+ RollupApi.prototype.rollup = function rollupRollupApi (params, options, callback) {
172
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
173
+
174
+ // check required parameters
175
+ if (params.index == null) {
176
+ const err = new this[kConfigurationError]('Missing required parameter: index')
177
+ return handleError(err, callback)
178
+ }
179
+ if (params.rollup_index == null && params.rollupIndex == null) {
180
+ const err = new this[kConfigurationError]('Missing required parameter: rollup_index or rollupIndex')
181
+ return handleError(err, callback)
182
+ }
183
+ if (params.body == null) {
184
+ const err = new this[kConfigurationError]('Missing required parameter: body')
185
+ return handleError(err, callback)
186
+ }
187
+
188
+ // check required url components
189
+ if ((params.rollup_index != null || params.rollupIndex != null) && (params.index == null)) {
190
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
191
+ return handleError(err, callback)
192
+ }
193
+
194
+ let { method, body, index, rollupIndex, rollup_index, ...querystring } = params
195
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
196
+
197
+ let path = ''
198
+ if (method == null) method = 'POST'
199
+ path = '/' + encodeURIComponent(index) + '/' + '_rollup' + '/' + encodeURIComponent(rollup_index || rollupIndex)
200
+
201
+ // build request object
202
+ const request = {
203
+ method,
204
+ path,
205
+ body: body || '',
206
+ querystring
207
+ }
208
+
209
+ return this.transport.request(request, options, callback)
210
+ }
211
+
212
+ RollupApi.prototype.rollupSearch = function rollupRollupSearchApi (params, options, callback) {
213
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
214
+
215
+ // check required parameters
216
+ if (params.index == null) {
217
+ const err = new this[kConfigurationError]('Missing required parameter: index')
218
+ return handleError(err, callback)
219
+ }
220
+ if (params.body == null) {
221
+ const err = new this[kConfigurationError]('Missing required parameter: body')
222
+ return handleError(err, callback)
223
+ }
224
+
225
+ // check required url components
226
+ if (params.type != null && (params.index == null)) {
227
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
228
+ return handleError(err, callback)
229
+ }
230
+
231
+ let { method, body, index, type, ...querystring } = params
232
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
233
+
234
+ let path = ''
235
+ if ((index) != null && (type) != null) {
236
+ if (method == null) method = body == null ? 'GET' : 'POST'
237
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_rollup_search'
238
+ } else {
239
+ if (method == null) method = body == null ? 'GET' : 'POST'
240
+ path = '/' + encodeURIComponent(index) + '/' + '_rollup_search'
241
+ }
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
+ RollupApi.prototype.startJob = function rollupStartJobApi (params, options, callback) {
255
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
256
+
257
+ // check required parameters
258
+ if (params.id == null) {
259
+ const err = new this[kConfigurationError]('Missing required parameter: id')
260
+ return handleError(err, callback)
261
+ }
262
+
263
+ let { method, body, id, ...querystring } = params
264
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
265
+
266
+ let path = ''
267
+ if (method == null) method = 'POST'
268
+ path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_start'
269
+
270
+ // build request object
271
+ const request = {
272
+ method,
273
+ path,
274
+ body: body || '',
275
+ querystring
276
+ }
277
+
278
+ return this.transport.request(request, options, callback)
279
+ }
280
+
281
+ RollupApi.prototype.stopJob = function rollupStopJobApi (params, options, callback) {
282
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
283
+
284
+ // check required parameters
285
+ if (params.id == null) {
286
+ const err = new this[kConfigurationError]('Missing required parameter: id')
287
+ return handleError(err, callback)
288
+ }
289
+
290
+ let { method, body, id, ...querystring } = params
291
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
292
+
293
+ let path = ''
294
+ if (method == null) method = 'POST'
295
+ path = '/' + '_rollup' + '/' + 'job' + '/' + encodeURIComponent(id) + '/' + '_stop'
296
+
297
+ // build request object
298
+ const request = {
299
+ method,
300
+ path,
301
+ body: body || '',
302
+ querystring
303
+ }
304
+
305
+ return this.transport.request(request, options, callback)
306
+ }
307
+
308
+ Object.defineProperties(RollupApi.prototype, {
309
+ delete_job: { get () { return this.deleteJob } },
310
+ get_jobs: { get () { return this.getJobs } },
311
+ get_rollup_caps: { get () { return this.getRollupCaps } },
312
+ get_rollup_index_caps: { get () { return this.getRollupIndexCaps } },
313
+ put_job: { get () { return this.putJob } },
314
+ rollup_search: { get () { return this.rollupSearch } },
315
+ start_job: { get () { return this.startJob } },
316
+ stop_job: { get () { return this.stopJob } }
317
+ })
318
+
319
+ module.exports = RollupApi
@@ -0,0 +1,50 @@
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']
27
+ const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
28
+
29
+ function scriptsPainlessExecuteApi (params, options, callback) {
30
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
31
+
32
+ let { method, body, ...querystring } = params
33
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
34
+
35
+ let path = ''
36
+ if (method == null) method = body == null ? 'GET' : 'POST'
37
+ path = '/' + '_scripts' + '/' + 'painless' + '/' + '_execute'
38
+
39
+ // build request object
40
+ const request = {
41
+ method,
42
+ path,
43
+ body: body || '',
44
+ querystring
45
+ }
46
+
47
+ return this.transport.request(request, options, callback)
48
+ }
49
+
50
+ module.exports = scriptsPainlessExecuteApi