@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.
- package/.dockerignore +5 -0
- package/ADMINS.md +34 -0
- package/DEVELOPER_GUIDE.md +60 -0
- package/LICENSE.txt +201 -0
- package/MAINTAINERS.md +73 -0
- package/Makefile +27 -0
- package/NOTICE.txt +8 -0
- package/README.md +183 -0
- package/RELEASING.md +34 -0
- package/SECURITY.md +3 -0
- package/api/api/bulk.js +81 -0
- package/api/api/cat.js +525 -0
- package/api/api/clear_scroll.js +66 -0
- package/api/api/cluster.js +431 -0
- package/api/api/count.js +75 -0
- package/api/api/create.js +80 -0
- package/api/api/dangling_indices.js +126 -0
- package/api/api/delete.js +76 -0
- package/api/api/delete_by_query.js +82 -0
- package/api/api/delete_by_query_rethrottle.js +71 -0
- package/api/api/delete_script.js +67 -0
- package/api/api/exists.js +76 -0
- package/api/api/exists_source.js +85 -0
- package/api/api/explain.js +76 -0
- package/api/api/features.js +92 -0
- package/api/api/field_caps.js +66 -0
- package/api/api/get.js +76 -0
- package/api/api/get_script.js +67 -0
- package/api/api/get_script_context.js +61 -0
- package/api/api/get_script_languages.js +61 -0
- package/api/api/get_source.js +76 -0
- package/api/api/index.js +82 -0
- package/api/api/indices.js +1516 -0
- package/api/api/info.js +61 -0
- package/api/api/ingest.js +211 -0
- package/api/api/mget.js +81 -0
- package/api/api/msearch.js +81 -0
- package/api/api/msearch_template.js +81 -0
- package/api/api/mtermvectors.js +75 -0
- package/api/api/nodes.js +279 -0
- package/api/api/ping.js +61 -0
- package/api/api/put_script.js +82 -0
- package/api/api/rank_eval.js +72 -0
- package/api/api/reindex.js +67 -0
- package/api/api/reindex_rethrottle.js +71 -0
- package/api/api/render_search_template.js +66 -0
- package/api/api/scripts_painless_execute.js +61 -0
- package/api/api/scroll.js +66 -0
- package/api/api/search.js +75 -0
- package/api/api/search_shards.js +66 -0
- package/api/api/search_template.js +81 -0
- package/api/api/shutdown.js +135 -0
- package/api/api/snapshot.js +450 -0
- package/api/api/tasks.js +119 -0
- package/api/api/terms_enum.js +67 -0
- package/api/api/termvectors.js +78 -0
- package/api/api/update.js +80 -0
- package/api/api/update_by_query.js +78 -0
- package/api/api/update_by_query_rethrottle.js +71 -0
- package/api/index.js +254 -0
- package/api/new.d.ts +716 -0
- package/api/requestParams.d.ts +1583 -0
- package/api/types.d.ts +9481 -0
- package/api/utils.js +69 -0
- package/codecov.yml +14 -0
- package/index.d.ts +1210 -0
- package/index.js +338 -0
- package/index.mjs +40 -0
- package/lib/Connection.d.ts +107 -0
- package/lib/Connection.js +345 -0
- package/lib/Helpers.d.ts +135 -0
- package/lib/Helpers.js +779 -0
- package/lib/Serializer.d.ts +41 -0
- package/lib/Serializer.js +105 -0
- package/lib/Transport.d.ts +173 -0
- package/lib/Transport.js +646 -0
- package/lib/errors.d.ts +101 -0
- package/lib/errors.js +168 -0
- package/lib/pool/BaseConnectionPool.js +269 -0
- package/lib/pool/CloudConnectionPool.js +75 -0
- package/lib/pool/ConnectionPool.js +257 -0
- package/lib/pool/index.d.ts +215 -0
- package/lib/pool/index.js +41 -0
- package/package.json +102 -0
|
@@ -0,0 +1,78 @@
|
|
|
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 = ['term_statistics', 'field_statistics', 'fields', 'offsets', 'positions', 'payloads', 'preference', 'routing', 'realtime', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
38
|
+
const snakeCase = { termStatistics: 'term_statistics', fieldStatistics: 'field_statistics', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
39
|
+
|
|
40
|
+
function termvectorsApi (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
|
+
|
|
49
|
+
let { method, body, index, id, type, ...querystring } = params
|
|
50
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
51
|
+
|
|
52
|
+
let path = ''
|
|
53
|
+
if ((index) != null && (type) != null && (id) != null) {
|
|
54
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
55
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_termvectors'
|
|
56
|
+
} else if ((index) != null && (id) != null) {
|
|
57
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
58
|
+
path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id)
|
|
59
|
+
} else if ((index) != null && (type) != null) {
|
|
60
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
61
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors'
|
|
62
|
+
} else {
|
|
63
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
64
|
+
path = '/' + encodeURIComponent(index) + '/' + '_termvectors'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// build request object
|
|
68
|
+
const request = {
|
|
69
|
+
method,
|
|
70
|
+
path,
|
|
71
|
+
body: body || '',
|
|
72
|
+
querystring
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return this.transport.request(request, options, callback)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = termvectorsApi
|
|
@@ -0,0 +1,80 @@
|
|
|
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', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
38
|
+
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
39
|
+
|
|
40
|
+
function updateApi (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
|
+
if (params.body == null) {
|
|
53
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
54
|
+
return handleError(err, callback)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
let { method, body, id, index, type, ...querystring } = params
|
|
58
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
59
|
+
|
|
60
|
+
let path = ''
|
|
61
|
+
if ((index) != null && (type) != null && (id) != null) {
|
|
62
|
+
if (method == null) method = 'POST'
|
|
63
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + encodeURIComponent(id) + '/' + '_update'
|
|
64
|
+
} else {
|
|
65
|
+
if (method == null) method = 'POST'
|
|
66
|
+
path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// build request object
|
|
70
|
+
const request = {
|
|
71
|
+
method,
|
|
72
|
+
path,
|
|
73
|
+
body: body || '',
|
|
74
|
+
querystring
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return this.transport.request(request, options, callback)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = updateApi
|
|
@@ -0,0 +1,78 @@
|
|
|
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', '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']
|
|
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', 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' }
|
|
39
|
+
|
|
40
|
+
function updateByQueryApi (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
|
+
|
|
49
|
+
// check required url components
|
|
50
|
+
if (params.type != null && (params.index == null)) {
|
|
51
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
52
|
+
return handleError(err, callback)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let { method, body, index, type, ...querystring } = params
|
|
56
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
57
|
+
|
|
58
|
+
let path = ''
|
|
59
|
+
if ((index) != null && (type) != null) {
|
|
60
|
+
if (method == null) method = 'POST'
|
|
61
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query'
|
|
62
|
+
} else {
|
|
63
|
+
if (method == null) method = 'POST'
|
|
64
|
+
path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// build request object
|
|
68
|
+
const request = {
|
|
69
|
+
method,
|
|
70
|
+
path,
|
|
71
|
+
body: body || '',
|
|
72
|
+
querystring
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return this.transport.request(request, options, callback)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
module.exports = updateByQueryApi
|
|
@@ -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 updateByQueryRethrottleApi (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 = '/' + '_update_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 = updateByQueryRethrottleApi
|
package/api/index.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
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
|
+
const bulkApi = require('./api/bulk')
|
|
34
|
+
const CatApi = require('./api/cat')
|
|
35
|
+
const clearScrollApi = require('./api/clear_scroll')
|
|
36
|
+
const ClusterApi = require('./api/cluster')
|
|
37
|
+
const countApi = require('./api/count')
|
|
38
|
+
const createApi = require('./api/create')
|
|
39
|
+
const DanglingIndicesApi = require('./api/dangling_indices')
|
|
40
|
+
const deleteApi = require('./api/delete')
|
|
41
|
+
const deleteByQueryApi = require('./api/delete_by_query')
|
|
42
|
+
const deleteByQueryRethrottleApi = require('./api/delete_by_query_rethrottle')
|
|
43
|
+
const deleteScriptApi = require('./api/delete_script')
|
|
44
|
+
const existsApi = require('./api/exists')
|
|
45
|
+
const existsSourceApi = require('./api/exists_source')
|
|
46
|
+
const explainApi = require('./api/explain')
|
|
47
|
+
const FeaturesApi = require('./api/features')
|
|
48
|
+
const fieldCapsApi = require('./api/field_caps')
|
|
49
|
+
const getApi = require('./api/get')
|
|
50
|
+
const getScriptApi = require('./api/get_script')
|
|
51
|
+
const getScriptContextApi = require('./api/get_script_context')
|
|
52
|
+
const getScriptLanguagesApi = require('./api/get_script_languages')
|
|
53
|
+
const getSourceApi = require('./api/get_source')
|
|
54
|
+
const indexApi = require('./api/index')
|
|
55
|
+
const IndicesApi = require('./api/indices')
|
|
56
|
+
const infoApi = require('./api/info')
|
|
57
|
+
const IngestApi = require('./api/ingest')
|
|
58
|
+
const mgetApi = require('./api/mget')
|
|
59
|
+
const msearchApi = require('./api/msearch')
|
|
60
|
+
const msearchTemplateApi = require('./api/msearch_template')
|
|
61
|
+
const mtermvectorsApi = require('./api/mtermvectors')
|
|
62
|
+
const NodesApi = require('./api/nodes')
|
|
63
|
+
const pingApi = require('./api/ping')
|
|
64
|
+
const putScriptApi = require('./api/put_script')
|
|
65
|
+
const rankEvalApi = require('./api/rank_eval')
|
|
66
|
+
const reindexApi = require('./api/reindex')
|
|
67
|
+
const reindexRethrottleApi = require('./api/reindex_rethrottle')
|
|
68
|
+
const renderSearchTemplateApi = require('./api/render_search_template')
|
|
69
|
+
const scriptsPainlessExecuteApi = require('./api/scripts_painless_execute')
|
|
70
|
+
const scrollApi = require('./api/scroll')
|
|
71
|
+
const searchApi = require('./api/search')
|
|
72
|
+
const searchShardsApi = require('./api/search_shards')
|
|
73
|
+
const searchTemplateApi = require('./api/search_template')
|
|
74
|
+
const ShutdownApi = require('./api/shutdown')
|
|
75
|
+
const SnapshotApi = require('./api/snapshot')
|
|
76
|
+
const TasksApi = require('./api/tasks')
|
|
77
|
+
const termsEnumApi = require('./api/terms_enum')
|
|
78
|
+
const termvectorsApi = require('./api/termvectors')
|
|
79
|
+
const updateApi = require('./api/update')
|
|
80
|
+
const updateByQueryApi = require('./api/update_by_query')
|
|
81
|
+
const updateByQueryRethrottleApi = require('./api/update_by_query_rethrottle')
|
|
82
|
+
|
|
83
|
+
const { kConfigurationError } = require('./utils')
|
|
84
|
+
const kCat = Symbol('Cat')
|
|
85
|
+
const kCluster = Symbol('Cluster')
|
|
86
|
+
const kDanglingIndices = Symbol('DanglingIndices')
|
|
87
|
+
const kFeatures = Symbol('Features')
|
|
88
|
+
const kIndices = Symbol('Indices')
|
|
89
|
+
const kIngest = Symbol('Ingest')
|
|
90
|
+
const kNodes = Symbol('Nodes')
|
|
91
|
+
const kShutdown = Symbol('Shutdown')
|
|
92
|
+
const kSnapshot = Symbol('Snapshot')
|
|
93
|
+
const kTasks = Symbol('Tasks')
|
|
94
|
+
|
|
95
|
+
function OpenSearchAPI (opts) {
|
|
96
|
+
this[kConfigurationError] = opts.ConfigurationError
|
|
97
|
+
this[kCat] = null
|
|
98
|
+
this[kCluster] = null
|
|
99
|
+
this[kDanglingIndices] = null
|
|
100
|
+
this[kFeatures] = null
|
|
101
|
+
this[kIndices] = null
|
|
102
|
+
this[kIngest] = null
|
|
103
|
+
this[kNodes] = null
|
|
104
|
+
this[kShutdown] = null
|
|
105
|
+
this[kSnapshot] = null
|
|
106
|
+
this[kTasks] = null
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
OpenSearchAPI.prototype.bulk = bulkApi
|
|
110
|
+
OpenSearchAPI.prototype.clearScroll = clearScrollApi
|
|
111
|
+
OpenSearchAPI.prototype.count = countApi
|
|
112
|
+
OpenSearchAPI.prototype.create = createApi
|
|
113
|
+
OpenSearchAPI.prototype.delete = deleteApi
|
|
114
|
+
OpenSearchAPI.prototype.deleteByQuery = deleteByQueryApi
|
|
115
|
+
OpenSearchAPI.prototype.deleteByQueryRethrottle = deleteByQueryRethrottleApi
|
|
116
|
+
OpenSearchAPI.prototype.deleteScript = deleteScriptApi
|
|
117
|
+
OpenSearchAPI.prototype.exists = existsApi
|
|
118
|
+
OpenSearchAPI.prototype.existsSource = existsSourceApi
|
|
119
|
+
OpenSearchAPI.prototype.explain = explainApi
|
|
120
|
+
OpenSearchAPI.prototype.fieldCaps = fieldCapsApi
|
|
121
|
+
OpenSearchAPI.prototype.get = getApi
|
|
122
|
+
OpenSearchAPI.prototype.getScript = getScriptApi
|
|
123
|
+
OpenSearchAPI.prototype.getScriptContext = getScriptContextApi
|
|
124
|
+
OpenSearchAPI.prototype.getScriptLanguages = getScriptLanguagesApi
|
|
125
|
+
OpenSearchAPI.prototype.getSource = getSourceApi
|
|
126
|
+
OpenSearchAPI.prototype.index = indexApi
|
|
127
|
+
OpenSearchAPI.prototype.info = infoApi
|
|
128
|
+
OpenSearchAPI.prototype.mget = mgetApi
|
|
129
|
+
OpenSearchAPI.prototype.msearch = msearchApi
|
|
130
|
+
OpenSearchAPI.prototype.msearchTemplate = msearchTemplateApi
|
|
131
|
+
OpenSearchAPI.prototype.mtermvectors = mtermvectorsApi
|
|
132
|
+
OpenSearchAPI.prototype.ping = pingApi
|
|
133
|
+
OpenSearchAPI.prototype.putScript = putScriptApi
|
|
134
|
+
OpenSearchAPI.prototype.rankEval = rankEvalApi
|
|
135
|
+
OpenSearchAPI.prototype.reindex = reindexApi
|
|
136
|
+
OpenSearchAPI.prototype.reindexRethrottle = reindexRethrottleApi
|
|
137
|
+
OpenSearchAPI.prototype.renderSearchTemplate = renderSearchTemplateApi
|
|
138
|
+
OpenSearchAPI.prototype.scriptsPainlessExecute = scriptsPainlessExecuteApi
|
|
139
|
+
OpenSearchAPI.prototype.scroll = scrollApi
|
|
140
|
+
OpenSearchAPI.prototype.search = searchApi
|
|
141
|
+
OpenSearchAPI.prototype.searchShards = searchShardsApi
|
|
142
|
+
OpenSearchAPI.prototype.searchTemplate = searchTemplateApi
|
|
143
|
+
OpenSearchAPI.prototype.termsEnum = termsEnumApi
|
|
144
|
+
OpenSearchAPI.prototype.termvectors = termvectorsApi
|
|
145
|
+
OpenSearchAPI.prototype.update = updateApi
|
|
146
|
+
OpenSearchAPI.prototype.updateByQuery = updateByQueryApi
|
|
147
|
+
OpenSearchAPI.prototype.updateByQueryRethrottle = updateByQueryRethrottleApi
|
|
148
|
+
|
|
149
|
+
Object.defineProperties(OpenSearchAPI.prototype, {
|
|
150
|
+
cat: {
|
|
151
|
+
get () {
|
|
152
|
+
if (this[kCat] === null) {
|
|
153
|
+
this[kCat] = new CatApi(this.transport, this[kConfigurationError])
|
|
154
|
+
}
|
|
155
|
+
return this[kCat]
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
clear_scroll: { get () { return this.clearScroll } },
|
|
159
|
+
cluster: {
|
|
160
|
+
get () {
|
|
161
|
+
if (this[kCluster] === null) {
|
|
162
|
+
this[kCluster] = new ClusterApi(this.transport, this[kConfigurationError])
|
|
163
|
+
}
|
|
164
|
+
return this[kCluster]
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
danglingIndices: {
|
|
168
|
+
get () {
|
|
169
|
+
if (this[kDanglingIndices] === null) {
|
|
170
|
+
this[kDanglingIndices] = new DanglingIndicesApi(this.transport, this[kConfigurationError])
|
|
171
|
+
}
|
|
172
|
+
return this[kDanglingIndices]
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
dangling_indices: { get () { return this.danglingIndices } },
|
|
176
|
+
delete_by_query: { get () { return this.deleteByQuery } },
|
|
177
|
+
delete_by_query_rethrottle: { get () { return this.deleteByQueryRethrottle } },
|
|
178
|
+
delete_script: { get () { return this.deleteScript } },
|
|
179
|
+
exists_source: { get () { return this.existsSource } },
|
|
180
|
+
features: {
|
|
181
|
+
get () {
|
|
182
|
+
if (this[kFeatures] === null) {
|
|
183
|
+
this[kFeatures] = new FeaturesApi(this.transport, this[kConfigurationError])
|
|
184
|
+
}
|
|
185
|
+
return this[kFeatures]
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
field_caps: { get () { return this.fieldCaps } },
|
|
189
|
+
get_script: { get () { return this.getScript } },
|
|
190
|
+
get_script_context: { get () { return this.getScriptContext } },
|
|
191
|
+
get_script_languages: { get () { return this.getScriptLanguages } },
|
|
192
|
+
get_source: { get () { return this.getSource } },
|
|
193
|
+
indices: {
|
|
194
|
+
get () {
|
|
195
|
+
if (this[kIndices] === null) {
|
|
196
|
+
this[kIndices] = new IndicesApi(this.transport, this[kConfigurationError])
|
|
197
|
+
}
|
|
198
|
+
return this[kIndices]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
ingest: {
|
|
202
|
+
get () {
|
|
203
|
+
if (this[kIngest] === null) {
|
|
204
|
+
this[kIngest] = new IngestApi(this.transport, this[kConfigurationError])
|
|
205
|
+
}
|
|
206
|
+
return this[kIngest]
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
msearch_template: { get () { return this.msearchTemplate } },
|
|
210
|
+
nodes: {
|
|
211
|
+
get () {
|
|
212
|
+
if (this[kNodes] === null) {
|
|
213
|
+
this[kNodes] = new NodesApi(this.transport, this[kConfigurationError])
|
|
214
|
+
}
|
|
215
|
+
return this[kNodes]
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
put_script: { get () { return this.putScript } },
|
|
219
|
+
rank_eval: { get () { return this.rankEval } },
|
|
220
|
+
reindex_rethrottle: { get () { return this.reindexRethrottle } },
|
|
221
|
+
render_search_template: { get () { return this.renderSearchTemplate } },
|
|
222
|
+
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } },
|
|
223
|
+
search_shards: { get () { return this.searchShards } },
|
|
224
|
+
search_template: { get () { return this.searchTemplate } },
|
|
225
|
+
shutdown: {
|
|
226
|
+
get () {
|
|
227
|
+
if (this[kShutdown] === null) {
|
|
228
|
+
this[kShutdown] = new ShutdownApi(this.transport, this[kConfigurationError])
|
|
229
|
+
}
|
|
230
|
+
return this[kShutdown]
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
snapshot: {
|
|
234
|
+
get () {
|
|
235
|
+
if (this[kSnapshot] === null) {
|
|
236
|
+
this[kSnapshot] = new SnapshotApi(this.transport, this[kConfigurationError])
|
|
237
|
+
}
|
|
238
|
+
return this[kSnapshot]
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
tasks: {
|
|
242
|
+
get () {
|
|
243
|
+
if (this[kTasks] === null) {
|
|
244
|
+
this[kTasks] = new TasksApi(this.transport, this[kConfigurationError])
|
|
245
|
+
}
|
|
246
|
+
return this[kTasks]
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
terms_enum: { get () { return this.termsEnum } },
|
|
250
|
+
update_by_query: { get () { return this.updateByQuery } },
|
|
251
|
+
update_by_query_rethrottle: { get () { return this.updateByQueryRethrottle } }
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
module.exports = OpenSearchAPI
|