@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.
- package/.dockerignore +5 -0
- package/LICENSE +202 -0
- package/README.md +232 -0
- package/api/api/async_search.js +141 -0
- package/api/api/autoscaling.js +147 -0
- package/api/api/bulk.js +70 -0
- package/api/api/cat.js +648 -0
- package/api/api/ccr.js +403 -0
- package/api/api/clear_scroll.js +55 -0
- package/api/api/close_point_in_time.js +50 -0
- package/api/api/cluster.js +420 -0
- package/api/api/count.js +64 -0
- package/api/api/create.js +69 -0
- package/api/api/dangling_indices.js +115 -0
- package/api/api/delete.js +65 -0
- package/api/api/delete_by_query.js +71 -0
- package/api/api/delete_by_query_rethrottle.js +60 -0
- package/api/api/delete_script.js +56 -0
- package/api/api/enrich.js +173 -0
- package/api/api/eql.js +150 -0
- package/api/api/exists.js +65 -0
- package/api/api/exists_source.js +74 -0
- package/api/api/explain.js +65 -0
- package/api/api/features.js +81 -0
- package/api/api/field_caps.js +55 -0
- package/api/api/fleet.js +65 -0
- package/api/api/get.js +65 -0
- package/api/api/get_script.js +56 -0
- package/api/api/get_script_context.js +50 -0
- package/api/api/get_script_languages.js +50 -0
- package/api/api/get_source.js +65 -0
- package/api/api/graph.js +72 -0
- package/api/api/ilm.js +317 -0
- package/api/api/index.js +71 -0
- package/api/api/indices.js +1753 -0
- package/api/api/info.js +50 -0
- package/api/api/ingest.js +200 -0
- package/api/api/license.js +188 -0
- package/api/api/logstash.js +125 -0
- package/api/api/mget.js +70 -0
- package/api/api/migration.js +60 -0
- package/api/api/ml.js +2010 -0
- package/api/api/monitoring.js +66 -0
- package/api/api/msearch.js +70 -0
- package/api/api/msearch_template.js +70 -0
- package/api/api/mtermvectors.js +64 -0
- package/api/api/nodes.js +268 -0
- package/api/api/open_point_in_time.js +56 -0
- package/api/api/ping.js +50 -0
- package/api/api/put_script.js +71 -0
- package/api/api/rank_eval.js +61 -0
- package/api/api/reindex.js +56 -0
- package/api/api/reindex_rethrottle.js +60 -0
- package/api/api/render_search_template.js +55 -0
- package/api/api/rollup.js +319 -0
- package/api/api/scripts_painless_execute.js +50 -0
- package/api/api/scroll.js +55 -0
- package/api/api/search.js +64 -0
- package/api/api/search_mvt.js +87 -0
- package/api/api/search_shards.js +55 -0
- package/api/api/search_template.js +70 -0
- package/api/api/searchable_snapshots.js +186 -0
- package/api/api/security.js +1261 -0
- package/api/api/shutdown.js +124 -0
- package/api/api/slm.js +256 -0
- package/api/api/snapshot.js +439 -0
- package/api/api/sql.js +203 -0
- package/api/api/ssl.js +55 -0
- package/api/api/tasks.js +108 -0
- package/api/api/terms_enum.js +56 -0
- package/api/api/termvectors.js +67 -0
- package/api/api/text_structure.js +65 -0
- package/api/api/transform.js +268 -0
- package/api/api/update.js +69 -0
- package/api/api/update_by_query.js +67 -0
- package/api/api/update_by_query_rethrottle.js +60 -0
- package/api/api/watcher.js +333 -0
- package/api/api/xpack.js +76 -0
- package/api/index.js +508 -0
- package/api/new.d.ts +1585 -0
- package/api/requestParams.d.ts +2920 -0
- package/api/types.d.ts +15420 -0
- package/api/utils.js +58 -0
- package/codecov.yml +14 -0
- package/index.d.ts +2991 -0
- package/index.js +349 -0
- package/index.mjs +29 -0
- package/lib/Connection.d.ts +99 -0
- package/lib/Connection.js +392 -0
- package/lib/Helpers.d.ts +124 -0
- package/lib/Helpers.js +770 -0
- package/lib/Serializer.d.ts +30 -0
- package/lib/Serializer.js +94 -0
- package/lib/Transport.d.ts +162 -0
- package/lib/Transport.js +689 -0
- package/lib/errors.d.ts +90 -0
- package/lib/errors.js +159 -0
- package/lib/pool/BaseConnectionPool.js +262 -0
- package/lib/pool/CloudConnectionPool.js +64 -0
- package/lib/pool/ConnectionPool.js +246 -0
- package/lib/pool/index.d.ts +220 -0
- package/lib/pool/index.js +30 -0
- package/package.json +106 -0
|
@@ -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 = ['scroll', 'scroll_id', 'rest_total_hits_as_int', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { scrollId: 'scroll_id', restTotalHitsAsInt: 'rest_total_hits_as_int', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function scrollApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
let { method, body, scrollId, scroll_id, ...querystring } = params
|
|
33
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
34
|
+
|
|
35
|
+
let path = ''
|
|
36
|
+
if ((scroll_id || scrollId) != null) {
|
|
37
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
38
|
+
path = '/' + '_search' + '/' + 'scroll' + '/' + encodeURIComponent(scroll_id || scrollId)
|
|
39
|
+
} else {
|
|
40
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
41
|
+
path = '/' + '_search' + '/' + 'scroll'
|
|
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 = scrollApi
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Licensed to Elasticsearch B.V. under one or more contributor
|
|
3
|
+
* license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright
|
|
5
|
+
* ownership. Elasticsearch B.V. licenses this file to you under
|
|
6
|
+
* the Apache License, Version 2.0 (the "License"); you may
|
|
7
|
+
* not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing,
|
|
13
|
+
* software distributed under the License is distributed on an
|
|
14
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
* KIND, either express or implied. See the License for the
|
|
16
|
+
* specific language governing permissions and limitations
|
|
17
|
+
* under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
'use strict'
|
|
21
|
+
|
|
22
|
+
/* eslint camelcase: 0 */
|
|
23
|
+
/* eslint no-unused-vars: 0 */
|
|
24
|
+
|
|
25
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
26
|
+
const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'ccs_minimize_roundtrips', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'typed_keys', 'version', 'seq_no_primary_term', 'request_cache', 'batched_reduce_size', 'max_concurrent_shard_requests', 'pre_filter_shard_size', 'rest_total_hits_as_int', 'min_compatible_shard_node', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { analyzeWildcard: 'analyze_wildcard', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', defaultOperator: 'default_operator', storedFields: 'stored_fields', docvalueFields: 'docvalue_fields', ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', terminateAfter: 'terminate_after', suggestField: 'suggest_field', suggestMode: 'suggest_mode', suggestSize: 'suggest_size', suggestText: 'suggest_text', trackScores: 'track_scores', trackTotalHits: 'track_total_hits', allowPartialSearchResults: 'allow_partial_search_results', typedKeys: 'typed_keys', seqNoPrimaryTerm: 'seq_no_primary_term', requestCache: 'request_cache', batchedReduceSize: 'batched_reduce_size', maxConcurrentShardRequests: 'max_concurrent_shard_requests', preFilterShardSize: 'pre_filter_shard_size', restTotalHitsAsInt: 'rest_total_hits_as_int', minCompatibleShardNode: 'min_compatible_shard_node', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function searchApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
// check required url components
|
|
33
|
+
if (params.type != null && (params.index == null)) {
|
|
34
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
35
|
+
return handleError(err, callback)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let { method, body, index, type, ...querystring } = params
|
|
39
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
40
|
+
|
|
41
|
+
let path = ''
|
|
42
|
+
if ((index) != null && (type) != null) {
|
|
43
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
44
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search'
|
|
45
|
+
} else if ((index) != null) {
|
|
46
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
47
|
+
path = '/' + encodeURIComponent(index) + '/' + '_search'
|
|
48
|
+
} else {
|
|
49
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
50
|
+
path = '/' + '_search'
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// build request object
|
|
54
|
+
const request = {
|
|
55
|
+
method,
|
|
56
|
+
path,
|
|
57
|
+
body: body || '',
|
|
58
|
+
querystring
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return this.transport.request(request, options, callback)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = searchApi
|
|
@@ -0,0 +1,87 @@
|
|
|
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 = ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { exactBounds: 'exact_bounds', gridPrecision: 'grid_precision', gridType: 'grid_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function searchMvtApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
// check required parameters
|
|
33
|
+
if (params.index == null) {
|
|
34
|
+
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
35
|
+
return handleError(err, callback)
|
|
36
|
+
}
|
|
37
|
+
if (params.field == null) {
|
|
38
|
+
const err = new this[kConfigurationError]('Missing required parameter: field')
|
|
39
|
+
return handleError(err, callback)
|
|
40
|
+
}
|
|
41
|
+
if (params.zoom == null) {
|
|
42
|
+
const err = new this[kConfigurationError]('Missing required parameter: zoom')
|
|
43
|
+
return handleError(err, callback)
|
|
44
|
+
}
|
|
45
|
+
if (params.x == null) {
|
|
46
|
+
const err = new this[kConfigurationError]('Missing required parameter: x')
|
|
47
|
+
return handleError(err, callback)
|
|
48
|
+
}
|
|
49
|
+
if (params.y == null) {
|
|
50
|
+
const err = new this[kConfigurationError]('Missing required parameter: y')
|
|
51
|
+
return handleError(err, callback)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// check required url components
|
|
55
|
+
if (params.y != null && (params.x == null || params.zoom == null || params.field == null || params.index == null)) {
|
|
56
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: x, zoom, field, index')
|
|
57
|
+
return handleError(err, callback)
|
|
58
|
+
} else if (params.x != null && (params.zoom == null || params.field == null || params.index == null)) {
|
|
59
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: zoom, field, index')
|
|
60
|
+
return handleError(err, callback)
|
|
61
|
+
} else if (params.zoom != null && (params.field == null || params.index == null)) {
|
|
62
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: field, index')
|
|
63
|
+
return handleError(err, callback)
|
|
64
|
+
} else if (params.field != null && (params.index == null)) {
|
|
65
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
66
|
+
return handleError(err, callback)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let { method, body, index, field, zoom, x, y, ...querystring } = params
|
|
70
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
71
|
+
|
|
72
|
+
let path = ''
|
|
73
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
74
|
+
path = '/' + encodeURIComponent(index) + '/' + '_mvt' + '/' + encodeURIComponent(field) + '/' + encodeURIComponent(zoom) + '/' + encodeURIComponent(x) + '/' + encodeURIComponent(y)
|
|
75
|
+
|
|
76
|
+
// build request object
|
|
77
|
+
const request = {
|
|
78
|
+
method,
|
|
79
|
+
path,
|
|
80
|
+
body: body || '',
|
|
81
|
+
querystring
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return this.transport.request(request, options, callback)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = searchMvtApi
|
|
@@ -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 = ['preference', 'routing', 'local', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function searchShardsApi (params, options, callback) {
|
|
30
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
31
|
+
|
|
32
|
+
let { method, body, index, ...querystring } = params
|
|
33
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
34
|
+
|
|
35
|
+
let path = ''
|
|
36
|
+
if ((index) != null) {
|
|
37
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
38
|
+
path = '/' + encodeURIComponent(index) + '/' + '_search_shards'
|
|
39
|
+
} else {
|
|
40
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
41
|
+
path = '/' + '_search_shards'
|
|
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 = searchShardsApi
|
|
@@ -0,0 +1,70 @@
|
|
|
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', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'preference', 'routing', 'scroll', 'search_type', 'explain', 'profile', 'typed_keys', 'rest_total_hits_as_int', 'ccs_minimize_roundtrips', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
27
|
+
const snakeCase = { ignoreUnavailable: 'ignore_unavailable', ignoreThrottled: 'ignore_throttled', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', typedKeys: 'typed_keys', restTotalHitsAsInt: 'rest_total_hits_as_int', ccsMinimizeRoundtrips: 'ccs_minimize_roundtrips', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
28
|
+
|
|
29
|
+
function searchTemplateApi (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
|
+
// check required url components
|
|
39
|
+
if (params.type != null && (params.index == null)) {
|
|
40
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
|
41
|
+
return handleError(err, callback)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let { method, body, index, type, ...querystring } = params
|
|
45
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
46
|
+
|
|
47
|
+
let path = ''
|
|
48
|
+
if ((index) != null && (type) != null) {
|
|
49
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
50
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_search' + '/' + 'template'
|
|
51
|
+
} else if ((index) != null) {
|
|
52
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
53
|
+
path = '/' + encodeURIComponent(index) + '/' + '_search' + '/' + 'template'
|
|
54
|
+
} else {
|
|
55
|
+
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
56
|
+
path = '/' + '_search' + '/' + 'template'
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// build request object
|
|
60
|
+
const request = {
|
|
61
|
+
method,
|
|
62
|
+
path,
|
|
63
|
+
body: body || '',
|
|
64
|
+
querystring
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return this.transport.request(request, options, callback)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
module.exports = searchTemplateApi
|
|
@@ -0,0 +1,186 @@
|
|
|
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', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'index', 'master_timeout', 'wait_for_completion', 'storage', 'level']
|
|
27
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', masterTimeout: 'master_timeout', waitForCompletion: 'wait_for_completion' }
|
|
28
|
+
|
|
29
|
+
function SearchableSnapshotsApi (transport, ConfigurationError) {
|
|
30
|
+
this.transport = transport
|
|
31
|
+
this[kConfigurationError] = ConfigurationError
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
SearchableSnapshotsApi.prototype.cacheStats = function searchableSnapshotsCacheStatsApi (params, options, callback) {
|
|
35
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
36
|
+
|
|
37
|
+
let { method, body, nodeId, node_id, ...querystring } = params
|
|
38
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
39
|
+
|
|
40
|
+
let path = ''
|
|
41
|
+
if ((node_id || nodeId) != null) {
|
|
42
|
+
if (method == null) method = 'GET'
|
|
43
|
+
path = '/' + '_searchable_snapshots' + '/' + encodeURIComponent(node_id || nodeId) + '/' + 'cache' + '/' + 'stats'
|
|
44
|
+
} else {
|
|
45
|
+
if (method == null) method = 'GET'
|
|
46
|
+
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'stats'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// build request object
|
|
50
|
+
const request = {
|
|
51
|
+
method,
|
|
52
|
+
path,
|
|
53
|
+
body: null,
|
|
54
|
+
querystring
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return this.transport.request(request, options, callback)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
SearchableSnapshotsApi.prototype.clearCache = function searchableSnapshotsClearCacheApi (params, options, callback) {
|
|
61
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
62
|
+
|
|
63
|
+
let { method, body, index, ...querystring } = params
|
|
64
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
65
|
+
|
|
66
|
+
let path = ''
|
|
67
|
+
if ((index) != null) {
|
|
68
|
+
if (method == null) method = 'POST'
|
|
69
|
+
path = '/' + encodeURIComponent(index) + '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
|
|
70
|
+
} else {
|
|
71
|
+
if (method == null) method = 'POST'
|
|
72
|
+
path = '/' + '_searchable_snapshots' + '/' + 'cache' + '/' + 'clear'
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// build request object
|
|
76
|
+
const request = {
|
|
77
|
+
method,
|
|
78
|
+
path,
|
|
79
|
+
body: body || '',
|
|
80
|
+
querystring
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return this.transport.request(request, options, callback)
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
SearchableSnapshotsApi.prototype.mount = function searchableSnapshotsMountApi (params, options, callback) {
|
|
87
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
88
|
+
|
|
89
|
+
// check required parameters
|
|
90
|
+
if (params.repository == null) {
|
|
91
|
+
const err = new this[kConfigurationError]('Missing required parameter: repository')
|
|
92
|
+
return handleError(err, callback)
|
|
93
|
+
}
|
|
94
|
+
if (params.snapshot == null) {
|
|
95
|
+
const err = new this[kConfigurationError]('Missing required parameter: snapshot')
|
|
96
|
+
return handleError(err, callback)
|
|
97
|
+
}
|
|
98
|
+
if (params.body == null) {
|
|
99
|
+
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
100
|
+
return handleError(err, callback)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// check required url components
|
|
104
|
+
if (params.snapshot != null && (params.repository == null)) {
|
|
105
|
+
const err = new this[kConfigurationError]('Missing required parameter of the url: repository')
|
|
106
|
+
return handleError(err, callback)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let { method, body, repository, snapshot, ...querystring } = params
|
|
110
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
111
|
+
|
|
112
|
+
let path = ''
|
|
113
|
+
if (method == null) method = 'POST'
|
|
114
|
+
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_mount'
|
|
115
|
+
|
|
116
|
+
// build request object
|
|
117
|
+
const request = {
|
|
118
|
+
method,
|
|
119
|
+
path,
|
|
120
|
+
body: body || '',
|
|
121
|
+
querystring
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return this.transport.request(request, options, callback)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
SearchableSnapshotsApi.prototype.repositoryStats = function searchableSnapshotsRepositoryStatsApi (params, options, callback) {
|
|
128
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
129
|
+
|
|
130
|
+
// check required parameters
|
|
131
|
+
if (params.repository == null) {
|
|
132
|
+
const err = new this[kConfigurationError]('Missing required parameter: repository')
|
|
133
|
+
return handleError(err, callback)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let { method, body, repository, ...querystring } = params
|
|
137
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
138
|
+
|
|
139
|
+
let path = ''
|
|
140
|
+
if (method == null) method = 'GET'
|
|
141
|
+
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_stats'
|
|
142
|
+
|
|
143
|
+
// build request object
|
|
144
|
+
const request = {
|
|
145
|
+
method,
|
|
146
|
+
path,
|
|
147
|
+
body: null,
|
|
148
|
+
querystring
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return this.transport.request(request, options, callback)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
SearchableSnapshotsApi.prototype.stats = function searchableSnapshotsStatsApi (params, options, callback) {
|
|
155
|
+
;[params, options, callback] = normalizeArguments(params, options, callback)
|
|
156
|
+
|
|
157
|
+
let { method, body, index, ...querystring } = params
|
|
158
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
159
|
+
|
|
160
|
+
let path = ''
|
|
161
|
+
if ((index) != null) {
|
|
162
|
+
if (method == null) method = 'GET'
|
|
163
|
+
path = '/' + encodeURIComponent(index) + '/' + '_searchable_snapshots' + '/' + 'stats'
|
|
164
|
+
} else {
|
|
165
|
+
if (method == null) method = 'GET'
|
|
166
|
+
path = '/' + '_searchable_snapshots' + '/' + 'stats'
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// build request object
|
|
170
|
+
const request = {
|
|
171
|
+
method,
|
|
172
|
+
path,
|
|
173
|
+
body: null,
|
|
174
|
+
querystring
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return this.transport.request(request, options, callback)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
Object.defineProperties(SearchableSnapshotsApi.prototype, {
|
|
181
|
+
cache_stats: { get () { return this.cacheStats } },
|
|
182
|
+
clear_cache: { get () { return this.clearCache } },
|
|
183
|
+
repository_stats: { get () { return this.repositoryStats } }
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
module.exports = SearchableSnapshotsApi
|