@opensearch-project/opensearch 1.0.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 (84) hide show
  1. package/.dockerignore +5 -0
  2. package/ADMINS.md +34 -0
  3. package/DEVELOPER_GUIDE.md +60 -0
  4. package/LICENSE.txt +201 -0
  5. package/MAINTAINERS.md +73 -0
  6. package/Makefile +27 -0
  7. package/NOTICE.txt +8 -0
  8. package/README.md +183 -0
  9. package/RELEASING.md +34 -0
  10. package/SECURITY.md +3 -0
  11. package/api/api/bulk.js +81 -0
  12. package/api/api/cat.js +525 -0
  13. package/api/api/clear_scroll.js +66 -0
  14. package/api/api/cluster.js +431 -0
  15. package/api/api/count.js +75 -0
  16. package/api/api/create.js +80 -0
  17. package/api/api/dangling_indices.js +126 -0
  18. package/api/api/delete.js +76 -0
  19. package/api/api/delete_by_query.js +82 -0
  20. package/api/api/delete_by_query_rethrottle.js +71 -0
  21. package/api/api/delete_script.js +67 -0
  22. package/api/api/exists.js +76 -0
  23. package/api/api/exists_source.js +85 -0
  24. package/api/api/explain.js +76 -0
  25. package/api/api/features.js +92 -0
  26. package/api/api/field_caps.js +66 -0
  27. package/api/api/get.js +76 -0
  28. package/api/api/get_script.js +67 -0
  29. package/api/api/get_script_context.js +61 -0
  30. package/api/api/get_script_languages.js +61 -0
  31. package/api/api/get_source.js +76 -0
  32. package/api/api/index.js +82 -0
  33. package/api/api/indices.js +1516 -0
  34. package/api/api/info.js +61 -0
  35. package/api/api/ingest.js +211 -0
  36. package/api/api/mget.js +81 -0
  37. package/api/api/msearch.js +81 -0
  38. package/api/api/msearch_template.js +81 -0
  39. package/api/api/mtermvectors.js +75 -0
  40. package/api/api/nodes.js +279 -0
  41. package/api/api/ping.js +61 -0
  42. package/api/api/put_script.js +82 -0
  43. package/api/api/rank_eval.js +72 -0
  44. package/api/api/reindex.js +67 -0
  45. package/api/api/reindex_rethrottle.js +71 -0
  46. package/api/api/render_search_template.js +66 -0
  47. package/api/api/scripts_painless_execute.js +61 -0
  48. package/api/api/scroll.js +66 -0
  49. package/api/api/search.js +75 -0
  50. package/api/api/search_shards.js +66 -0
  51. package/api/api/search_template.js +81 -0
  52. package/api/api/shutdown.js +135 -0
  53. package/api/api/snapshot.js +450 -0
  54. package/api/api/tasks.js +119 -0
  55. package/api/api/terms_enum.js +67 -0
  56. package/api/api/termvectors.js +78 -0
  57. package/api/api/update.js +80 -0
  58. package/api/api/update_by_query.js +78 -0
  59. package/api/api/update_by_query_rethrottle.js +71 -0
  60. package/api/index.js +254 -0
  61. package/api/new.d.ts +716 -0
  62. package/api/requestParams.d.ts +1583 -0
  63. package/api/types.d.ts +9481 -0
  64. package/api/utils.js +69 -0
  65. package/codecov.yml +14 -0
  66. package/index.d.ts +1210 -0
  67. package/index.js +338 -0
  68. package/index.mjs +40 -0
  69. package/lib/Connection.d.ts +107 -0
  70. package/lib/Connection.js +345 -0
  71. package/lib/Helpers.d.ts +135 -0
  72. package/lib/Helpers.js +779 -0
  73. package/lib/Serializer.d.ts +41 -0
  74. package/lib/Serializer.js +105 -0
  75. package/lib/Transport.d.ts +173 -0
  76. package/lib/Transport.js +646 -0
  77. package/lib/errors.d.ts +101 -0
  78. package/lib/errors.js +168 -0
  79. package/lib/pool/BaseConnectionPool.js +269 -0
  80. package/lib/pool/CloudConnectionPool.js +75 -0
  81. package/lib/pool/ConnectionPool.js +257 -0
  82. package/lib/pool/index.d.ts +215 -0
  83. package/lib/pool/index.js +41 -0
  84. package/package.json +102 -0
@@ -0,0 +1,126 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['accept_data_loss', 'timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { acceptDataLoss: 'accept_data_loss', masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function DanglingIndicesApi (transport, ConfigurationError) {
41
+ this.transport = transport
42
+ this[kConfigurationError] = ConfigurationError
43
+ }
44
+
45
+ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi (params, options, callback) {
46
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
47
+
48
+ // check required parameters
49
+ if (params.index_uuid == null && params.indexUuid == null) {
50
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
51
+ return handleError(err, callback)
52
+ }
53
+
54
+ let { method, body, indexUuid, index_uuid, ...querystring } = params
55
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
56
+
57
+ let path = ''
58
+ if (method == null) method = 'DELETE'
59
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
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
+ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi (params, options, callback) {
73
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
74
+
75
+ // check required parameters
76
+ if (params.index_uuid == null && params.indexUuid == null) {
77
+ const err = new this[kConfigurationError]('Missing required parameter: index_uuid or indexUuid')
78
+ return handleError(err, callback)
79
+ }
80
+
81
+ let { method, body, indexUuid, index_uuid, ...querystring } = params
82
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
83
+
84
+ let path = ''
85
+ if (method == null) method = 'POST'
86
+ path = '/' + '_dangling' + '/' + encodeURIComponent(index_uuid || indexUuid)
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
+ DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi (params, options, callback) {
100
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
101
+
102
+ let { method, body, ...querystring } = params
103
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
104
+
105
+ let path = ''
106
+ if (method == null) method = 'GET'
107
+ path = '/' + '_dangling'
108
+
109
+ // build request object
110
+ const request = {
111
+ method,
112
+ path,
113
+ body: null,
114
+ querystring
115
+ }
116
+
117
+ return this.transport.request(request, options, callback)
118
+ }
119
+
120
+ Object.defineProperties(DanglingIndicesApi.prototype, {
121
+ delete_dangling_index: { get () { return this.deleteDanglingIndex } },
122
+ import_dangling_index: { get () { return this.importDanglingIndex } },
123
+ list_dangling_indices: { get () { return this.listDanglingIndices } }
124
+ })
125
+
126
+ module.exports = DanglingIndicesApi
@@ -0,0 +1,76 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { waitForActiveShards: 'wait_for_active_shards', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function deleteApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.index == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: index')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ let { method, body, id, index, type, ...querystring } = params
54
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
55
+
56
+ let path = ''
57
+ if ((index) != null && (type) != null && (id) != null) {
58
+ if (method == null) method = 'DELETE'
59
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
60
+ } else {
61
+ if (method == null) method = 'DELETE'
62
+ path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
63
+ }
64
+
65
+ // build request object
66
+ const request = {
67
+ method,
68
+ path,
69
+ body: body || '',
70
+ querystring
71
+ }
72
+
73
+ return this.transport.request(request, options, callback)
74
+ }
75
+
76
+ module.exports = deleteApi
@@ -0,0 +1,82 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', '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', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ 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', 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' }
39
+
40
+ function deleteByQueryApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.index == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: index')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.body == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: body')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ // check required url components
54
+ if (params.type != null && (params.index == null)) {
55
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
56
+ return handleError(err, callback)
57
+ }
58
+
59
+ let { method, body, index, type, ...querystring } = params
60
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
61
+
62
+ let path = ''
63
+ if ((index) != null && (type) != null) {
64
+ if (method == null) method = 'POST'
65
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_delete_by_query'
66
+ } else {
67
+ if (method == null) method = 'POST'
68
+ path = '/' + encodeURIComponent(index) + '/' + '_delete_by_query'
69
+ }
70
+
71
+ // build request object
72
+ const request = {
73
+ method,
74
+ path,
75
+ body: body || '',
76
+ querystring
77
+ }
78
+
79
+ return this.transport.request(request, options, callback)
80
+ }
81
+
82
+ module.exports = deleteByQueryApi
@@ -0,0 +1,71 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function deleteByQueryRethrottleApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.task_id == null && params.taskId == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.requests_per_second == null && params.requestsPerSecond == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: requests_per_second or requestsPerSecond')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ let { method, body, taskId, task_id, ...querystring } = params
54
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
55
+
56
+ let path = ''
57
+ if (method == null) method = 'POST'
58
+ path = '/' + '_delete_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
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 = deleteByQueryRethrottleApi
@@ -0,0 +1,67 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['timeout', 'master_timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function deleteScriptApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+
49
+ let { method, body, id, ...querystring } = params
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
51
+
52
+ let path = ''
53
+ if (method == null) method = 'DELETE'
54
+ path = '/' + '_scripts' + '/' + encodeURIComponent(id)
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 = deleteScriptApi
@@ -0,0 +1,76 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function existsApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.index == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: index')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ let { method, body, id, index, type, ...querystring } = params
54
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
55
+
56
+ let path = ''
57
+ if ((index) != null && (type) != null && (id) != null) {
58
+ if (method == null) method = 'HEAD'
59
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id)
60
+ } else {
61
+ if (method == null) method = 'HEAD'
62
+ path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
63
+ }
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 = existsApi
@@ -0,0 +1,85 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function existsSourceApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.index == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: index')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ // check required url components
54
+ if (params.id != null && (params.type == null || params.index == null)) {
55
+ const err = new this[kConfigurationError]('Missing required parameter of the url: type, index')
56
+ return handleError(err, callback)
57
+ } else if (params.type != null && (params.index == null)) {
58
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index')
59
+ return handleError(err, callback)
60
+ }
61
+
62
+ let { method, body, id, index, type, ...querystring } = params
63
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
64
+
65
+ let path = ''
66
+ if ((index) != null && (type) != null && (id) != null) {
67
+ if (method == null) method = 'HEAD'
68
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_source'
69
+ } else {
70
+ if (method == null) method = 'HEAD'
71
+ path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
72
+ }
73
+
74
+ // build request object
75
+ const request = {
76
+ method,
77
+ path,
78
+ body: null,
79
+ querystring
80
+ }
81
+
82
+ return this.transport.request(request, options, callback)
83
+ }
84
+
85
+ module.exports = existsSourceApi
@@ -0,0 +1,76 @@
1
+ /*
2
+ * SPDX-License-Identifier: Apache-2.0
3
+ *
4
+ * The OpenSearch Contributors require contributions made to
5
+ * this file be licensed under the Apache-2.0 license or a
6
+ * compatible open source license.
7
+ *
8
+ * Modifications Copyright OpenSearch Contributors. See
9
+ * GitHub history for details.
10
+ */
11
+
12
+ /*
13
+ * Licensed to Elasticsearch B.V. under one or more contributor
14
+ * license agreements. See the NOTICE file distributed with
15
+ * this work for additional information regarding copyright
16
+ * ownership. Elasticsearch B.V. licenses this file to you under
17
+ * the Apache License, Version 2.0 (the "License"); you may
18
+ * not use this file except in compliance with the License.
19
+ * You may obtain a copy of the License at
20
+ *
21
+ * http://www.apache.org/licenses/LICENSE-2.0
22
+ *
23
+ * Unless required by applicable law or agreed to in writing,
24
+ * software distributed under the License is distributed on an
25
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
26
+ * KIND, either express or implied. See the License for the
27
+ * specific language governing permissions and limitations
28
+ * under the License.
29
+ */
30
+
31
+ 'use strict'
32
+
33
+ /* eslint camelcase: 0 */
34
+ /* eslint no-unused-vars: 0 */
35
+
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
37
+ const acceptedQuerystring = ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
+ const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' }
39
+
40
+ function explainApi (params, options, callback) {
41
+ ;[params, options, callback] = normalizeArguments(params, options, callback)
42
+
43
+ // check required parameters
44
+ if (params.id == null) {
45
+ const err = new this[kConfigurationError]('Missing required parameter: id')
46
+ return handleError(err, callback)
47
+ }
48
+ if (params.index == null) {
49
+ const err = new this[kConfigurationError]('Missing required parameter: index')
50
+ return handleError(err, callback)
51
+ }
52
+
53
+ let { method, body, id, index, type, ...querystring } = params
54
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
55
+
56
+ let path = ''
57
+ if ((index) != null && (type) != null && (id) != null) {
58
+ if (method == null) method = body == null ? 'GET' : 'POST'
59
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_explain'
60
+ } else {
61
+ if (method == null) method = body == null ? 'GET' : 'POST'
62
+ path = '/' + encodeURIComponent(index) + '/' + '_explain' + '/' + encodeURIComponent(id)
63
+ }
64
+
65
+ // build request object
66
+ const request = {
67
+ method,
68
+ path,
69
+ body: body || '',
70
+ querystring
71
+ }
72
+
73
+ return this.transport.request(request, options, callback)
74
+ }
75
+
76
+ module.exports = explainApi