@opensearch-project/opensearch 1.1.0 → 2.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/.eslintignore +2 -0
- package/.eslintrc.json +26 -0
- package/.prettierrc.json +5 -0
- package/.whitesource +15 -0
- package/ADMINS.md +18 -11
- package/COMPATIBILITY.md +24 -0
- package/DEVELOPER_GUIDE.md +22 -5
- package/MAINTAINERS.md +23 -18
- package/README.md +100 -101
- package/RELEASING.md +3 -3
- package/SECURITY.md +1 -1
- package/api/api/bulk.js +53 -26
- package/api/api/cat.js +354 -264
- package/api/api/clear_scroll.js +17 -17
- package/api/api/cluster.js +366 -219
- package/api/api/count.js +55 -24
- package/api/api/create.js +50 -24
- package/api/api/dangling_indices.js +95 -51
- package/api/api/delete.js +49 -22
- package/api/api/delete_by_query.js +88 -25
- package/api/api/delete_by_query_rethrottle.js +33 -19
- package/api/api/delete_script.js +31 -17
- package/api/api/exists.js +55 -22
- package/api/api/exists_source.js +60 -27
- package/api/api/explain.js +60 -22
- package/api/api/features.js +56 -35
- package/api/api/field_caps.js +36 -18
- package/api/api/get.js +55 -22
- package/api/api/get_script.js +30 -17
- package/api/api/get_script_context.js +15 -15
- package/api/api/get_script_languages.js +15 -15
- package/api/api/get_source.js +55 -22
- package/api/api/index.js +60 -28
- package/api/api/indices.js +1068 -857
- package/api/api/info.js +15 -15
- package/api/api/ingest.js +132 -96
- package/api/api/mget.js +50 -26
- package/api/api/msearch.js +49 -26
- package/api/api/msearch_template.js +53 -26
- package/api/api/mtermvectors.js +48 -24
- package/api/api/nodes.js +281 -154
- package/api/api/ping.js +15 -15
- package/api/api/put_script.js +40 -25
- package/api/api/rank_eval.js +37 -20
- package/api/api/reindex.js +38 -17
- package/api/api/reindex_rethrottle.js +32 -19
- package/api/api/render_search_template.js +18 -18
- package/api/api/scripts_painless_execute.js +15 -15
- package/api/api/scroll.js +31 -17
- package/api/api/search.js +108 -24
- package/api/api/search_shards.js +36 -18
- package/api/api/search_template.js +64 -26
- package/api/api/shutdown.js +66 -54
- package/api/api/snapshot.js +347 -224
- package/api/api/tasks.js +65 -46
- package/api/api/terms_enum.js +17 -17
- package/api/api/termvectors.js +57 -26
- package/api/api/update.js +64 -24
- package/api/api/update_by_query.js +89 -23
- package/api/api/update_by_query_rethrottle.js +33 -19
- package/api/index.js +267 -179
- package/api/new.d.ts +2042 -529
- package/api/opensearch_dashboards.d.ts +239 -236
- package/api/requestParams.d.ts +301 -69
- package/api/types.d.ts +6204 -5719
- package/api/utils.js +22 -22
- package/codecov.yml +2 -2
- package/index.d.ts +4776 -935
- package/index.js +152 -140
- package/index.mjs +9 -9
- package/lib/Connection.d.ts +37 -26
- package/lib/Connection.js +163 -168
- package/lib/Helpers.d.ts +103 -64
- package/lib/Helpers.js +398 -371
- package/lib/Serializer.d.ts +2 -2
- package/lib/Serializer.js +39 -39
- package/lib/Transport.d.ts +30 -12
- package/lib/Transport.js +375 -336
- package/lib/errors.d.ts +25 -7
- package/lib/errors.js +75 -71
- package/lib/pool/BaseConnectionPool.js +100 -97
- package/lib/pool/CloudConnectionPool.js +16 -16
- package/lib/pool/ConnectionPool.js +105 -105
- package/lib/pool/index.d.ts +8 -6
- package/lib/pool/index.js +6 -6
- package/package.json +13 -8
package/api/api/field_caps.js
CHANGED
|
@@ -28,28 +28,46 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'fields',
|
|
39
|
+
'ignore_unavailable',
|
|
40
|
+
'allow_no_indices',
|
|
41
|
+
'expand_wildcards',
|
|
42
|
+
'include_unmapped',
|
|
43
|
+
'pretty',
|
|
44
|
+
'human',
|
|
45
|
+
'error_trace',
|
|
46
|
+
'source',
|
|
47
|
+
'filter_path',
|
|
48
|
+
];
|
|
49
|
+
const snakeCase = {
|
|
50
|
+
ignoreUnavailable: 'ignore_unavailable',
|
|
51
|
+
allowNoIndices: 'allow_no_indices',
|
|
52
|
+
expandWildcards: 'expand_wildcards',
|
|
53
|
+
includeUnmapped: 'include_unmapped',
|
|
54
|
+
errorTrace: 'error_trace',
|
|
55
|
+
filterPath: 'filter_path',
|
|
56
|
+
};
|
|
39
57
|
|
|
40
|
-
function fieldCapsApi
|
|
41
|
-
|
|
58
|
+
function fieldCapsApi(params, options, callback) {
|
|
59
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
60
|
|
|
43
|
-
let { method, body, index, ...querystring } = params
|
|
44
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
61
|
+
let { method, body, index, ...querystring } = params;
|
|
62
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
45
63
|
|
|
46
|
-
let path = ''
|
|
47
|
-
if (
|
|
48
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
49
|
-
path = '/' + encodeURIComponent(index) + '/' + '_field_caps'
|
|
64
|
+
let path = '';
|
|
65
|
+
if (index != null) {
|
|
66
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
67
|
+
path = '/' + encodeURIComponent(index) + '/' + '_field_caps';
|
|
50
68
|
} else {
|
|
51
|
-
if (method == null) method = body == null ? 'GET' : 'POST'
|
|
52
|
-
path = '/' + '_field_caps'
|
|
69
|
+
if (method == null) method = body == null ? 'GET' : 'POST';
|
|
70
|
+
path = '/' + '_field_caps';
|
|
53
71
|
}
|
|
54
72
|
|
|
55
73
|
// build request object
|
|
@@ -57,10 +75,10 @@ function fieldCapsApi (params, options, callback) {
|
|
|
57
75
|
method,
|
|
58
76
|
path,
|
|
59
77
|
body: body || '',
|
|
60
|
-
querystring
|
|
61
|
-
}
|
|
78
|
+
querystring,
|
|
79
|
+
};
|
|
62
80
|
|
|
63
|
-
return this.transport.request(request, options, callback)
|
|
81
|
+
return this.transport.request(request, options, callback);
|
|
64
82
|
}
|
|
65
83
|
|
|
66
|
-
module.exports = fieldCapsApi
|
|
84
|
+
module.exports = fieldCapsApi;
|
package/api/api/get.js
CHANGED
|
@@ -28,38 +28,71 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'stored_fields',
|
|
39
|
+
'preference',
|
|
40
|
+
'realtime',
|
|
41
|
+
'refresh',
|
|
42
|
+
'routing',
|
|
43
|
+
'_source',
|
|
44
|
+
'_source_excludes',
|
|
45
|
+
'_source_exclude',
|
|
46
|
+
'_source_includes',
|
|
47
|
+
'_source_include',
|
|
48
|
+
'version',
|
|
49
|
+
'version_type',
|
|
50
|
+
'pretty',
|
|
51
|
+
'human',
|
|
52
|
+
'error_trace',
|
|
53
|
+
'source',
|
|
54
|
+
'filter_path',
|
|
55
|
+
];
|
|
56
|
+
const snakeCase = {
|
|
57
|
+
storedFields: 'stored_fields',
|
|
58
|
+
_sourceExcludes: '_source_excludes',
|
|
59
|
+
_sourceExclude: '_source_exclude',
|
|
60
|
+
_sourceIncludes: '_source_includes',
|
|
61
|
+
_sourceInclude: '_source_include',
|
|
62
|
+
versionType: 'version_type',
|
|
63
|
+
errorTrace: 'error_trace',
|
|
64
|
+
filterPath: 'filter_path',
|
|
65
|
+
};
|
|
39
66
|
|
|
40
|
-
function getApi
|
|
41
|
-
|
|
67
|
+
function getApi(params, options, callback) {
|
|
68
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
69
|
|
|
43
70
|
// check required parameters
|
|
44
71
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
72
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
73
|
+
return handleError(err, callback);
|
|
47
74
|
}
|
|
48
75
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
76
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
77
|
+
return handleError(err, callback);
|
|
51
78
|
}
|
|
52
79
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
80
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
81
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
82
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'GET'
|
|
59
|
-
path =
|
|
83
|
+
let path = '';
|
|
84
|
+
if (index != null && type != null && id != null) {
|
|
85
|
+
if (method == null) method = 'GET';
|
|
86
|
+
path =
|
|
87
|
+
'/' +
|
|
88
|
+
encodeURIComponent(index) +
|
|
89
|
+
'/' +
|
|
90
|
+
encodeURIComponent(type) +
|
|
91
|
+
'/' +
|
|
92
|
+
encodeURIComponent(id);
|
|
60
93
|
} else {
|
|
61
|
-
if (method == null) method = 'GET'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id)
|
|
94
|
+
if (method == null) method = 'GET';
|
|
95
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
63
96
|
}
|
|
64
97
|
|
|
65
98
|
// build request object
|
|
@@ -67,10 +100,10 @@ function getApi (params, options, callback) {
|
|
|
67
100
|
method,
|
|
68
101
|
path,
|
|
69
102
|
body: null,
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
103
|
+
querystring,
|
|
104
|
+
};
|
|
72
105
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
106
|
+
return this.transport.request(request, options, callback);
|
|
74
107
|
}
|
|
75
108
|
|
|
76
|
-
module.exports = getApi
|
|
109
|
+
module.exports = getApi;
|
package/api/api/get_script.js
CHANGED
|
@@ -28,40 +28,53 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'cluster_manager_timeout',
|
|
39
|
+
'master_timeout',
|
|
40
|
+
'pretty',
|
|
41
|
+
'human',
|
|
42
|
+
'error_trace',
|
|
43
|
+
'source',
|
|
44
|
+
'filter_path',
|
|
45
|
+
];
|
|
46
|
+
const snakeCase = {
|
|
47
|
+
clusterManagerTimeout: 'cluster_manager_timeout',
|
|
48
|
+
masterTimeout: 'master_timeout',
|
|
49
|
+
errorTrace: 'error_trace',
|
|
50
|
+
filterPath: 'filter_path',
|
|
51
|
+
};
|
|
39
52
|
|
|
40
|
-
function getScriptApi
|
|
41
|
-
|
|
53
|
+
function getScriptApi(params, options, callback) {
|
|
54
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
55
|
|
|
43
56
|
// check required parameters
|
|
44
57
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
58
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
59
|
+
return handleError(err, callback);
|
|
47
60
|
}
|
|
48
61
|
|
|
49
|
-
let { method, body, id, ...querystring } = params
|
|
50
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
62
|
+
let { method, body, id, ...querystring } = params;
|
|
63
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
51
64
|
|
|
52
|
-
let path = ''
|
|
53
|
-
if (method == null) method = 'GET'
|
|
54
|
-
path = '/' + '_scripts' + '/' + encodeURIComponent(id)
|
|
65
|
+
let path = '';
|
|
66
|
+
if (method == null) method = 'GET';
|
|
67
|
+
path = '/' + '_scripts' + '/' + encodeURIComponent(id);
|
|
55
68
|
|
|
56
69
|
// build request object
|
|
57
70
|
const request = {
|
|
58
71
|
method,
|
|
59
72
|
path,
|
|
60
73
|
body: null,
|
|
61
|
-
querystring
|
|
62
|
-
}
|
|
74
|
+
querystring,
|
|
75
|
+
};
|
|
63
76
|
|
|
64
|
-
return this.transport.request(request, options, callback)
|
|
77
|
+
return this.transport.request(request, options, callback);
|
|
65
78
|
}
|
|
66
79
|
|
|
67
|
-
module.exports = getScriptApi
|
|
80
|
+
module.exports = getScriptApi;
|
|
@@ -28,34 +28,34 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
38
|
-
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
|
|
38
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
|
|
39
39
|
|
|
40
|
-
function getScriptContextApi
|
|
41
|
-
|
|
40
|
+
function getScriptContextApi(params, options, callback) {
|
|
41
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
42
|
|
|
43
|
-
let { method, body, ...querystring } = params
|
|
44
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
43
|
+
let { method, body, ...querystring } = params;
|
|
44
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
45
45
|
|
|
46
|
-
let path = ''
|
|
47
|
-
if (method == null) method = 'GET'
|
|
48
|
-
path = '/' + '_script_context'
|
|
46
|
+
let path = '';
|
|
47
|
+
if (method == null) method = 'GET';
|
|
48
|
+
path = '/' + '_script_context';
|
|
49
49
|
|
|
50
50
|
// build request object
|
|
51
51
|
const request = {
|
|
52
52
|
method,
|
|
53
53
|
path,
|
|
54
54
|
body: null,
|
|
55
|
-
querystring
|
|
56
|
-
}
|
|
55
|
+
querystring,
|
|
56
|
+
};
|
|
57
57
|
|
|
58
|
-
return this.transport.request(request, options, callback)
|
|
58
|
+
return this.transport.request(request, options, callback);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
module.exports = getScriptContextApi
|
|
61
|
+
module.exports = getScriptContextApi;
|
|
@@ -28,34 +28,34 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']
|
|
38
|
-
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path'];
|
|
38
|
+
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' };
|
|
39
39
|
|
|
40
|
-
function getScriptLanguagesApi
|
|
41
|
-
|
|
40
|
+
function getScriptLanguagesApi(params, options, callback) {
|
|
41
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
42
|
|
|
43
|
-
let { method, body, ...querystring } = params
|
|
44
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
43
|
+
let { method, body, ...querystring } = params;
|
|
44
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
45
45
|
|
|
46
|
-
let path = ''
|
|
47
|
-
if (method == null) method = 'GET'
|
|
48
|
-
path = '/' + '_script_language'
|
|
46
|
+
let path = '';
|
|
47
|
+
if (method == null) method = 'GET';
|
|
48
|
+
path = '/' + '_script_language';
|
|
49
49
|
|
|
50
50
|
// build request object
|
|
51
51
|
const request = {
|
|
52
52
|
method,
|
|
53
53
|
path,
|
|
54
54
|
body: null,
|
|
55
|
-
querystring
|
|
56
|
-
}
|
|
55
|
+
querystring,
|
|
56
|
+
};
|
|
57
57
|
|
|
58
|
-
return this.transport.request(request, options, callback)
|
|
58
|
+
return this.transport.request(request, options, callback);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
module.exports = getScriptLanguagesApi
|
|
61
|
+
module.exports = getScriptLanguagesApi;
|
package/api/api/get_source.js
CHANGED
|
@@ -28,38 +28,71 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'preference',
|
|
39
|
+
'realtime',
|
|
40
|
+
'refresh',
|
|
41
|
+
'routing',
|
|
42
|
+
'_source',
|
|
43
|
+
'_source_excludes',
|
|
44
|
+
'_source_exclude',
|
|
45
|
+
'_source_includes',
|
|
46
|
+
'_source_include',
|
|
47
|
+
'version',
|
|
48
|
+
'version_type',
|
|
49
|
+
'pretty',
|
|
50
|
+
'human',
|
|
51
|
+
'error_trace',
|
|
52
|
+
'source',
|
|
53
|
+
'filter_path',
|
|
54
|
+
];
|
|
55
|
+
const snakeCase = {
|
|
56
|
+
_sourceExcludes: '_source_excludes',
|
|
57
|
+
_sourceExclude: '_source_exclude',
|
|
58
|
+
_sourceIncludes: '_source_includes',
|
|
59
|
+
_sourceInclude: '_source_include',
|
|
60
|
+
versionType: 'version_type',
|
|
61
|
+
errorTrace: 'error_trace',
|
|
62
|
+
filterPath: 'filter_path',
|
|
63
|
+
};
|
|
39
64
|
|
|
40
|
-
function getSourceApi
|
|
41
|
-
|
|
65
|
+
function getSourceApi(params, options, callback) {
|
|
66
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
67
|
|
|
43
68
|
// check required parameters
|
|
44
69
|
if (params.id == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: id')
|
|
46
|
-
return handleError(err, callback)
|
|
70
|
+
const err = new this[kConfigurationError]('Missing required parameter: id');
|
|
71
|
+
return handleError(err, callback);
|
|
47
72
|
}
|
|
48
73
|
if (params.index == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
50
|
-
return handleError(err, callback)
|
|
74
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
75
|
+
return handleError(err, callback);
|
|
51
76
|
}
|
|
52
77
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
78
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
79
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
80
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'GET'
|
|
59
|
-
path =
|
|
81
|
+
let path = '';
|
|
82
|
+
if (index != null && type != null && id != null) {
|
|
83
|
+
if (method == null) method = 'GET';
|
|
84
|
+
path =
|
|
85
|
+
'/' +
|
|
86
|
+
encodeURIComponent(index) +
|
|
87
|
+
'/' +
|
|
88
|
+
encodeURIComponent(type) +
|
|
89
|
+
'/' +
|
|
90
|
+
encodeURIComponent(id) +
|
|
91
|
+
'/' +
|
|
92
|
+
'_source';
|
|
60
93
|
} else {
|
|
61
|
-
if (method == null) method = 'GET'
|
|
62
|
-
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id)
|
|
94
|
+
if (method == null) method = 'GET';
|
|
95
|
+
path = '/' + encodeURIComponent(index) + '/' + '_source' + '/' + encodeURIComponent(id);
|
|
63
96
|
}
|
|
64
97
|
|
|
65
98
|
// build request object
|
|
@@ -67,10 +100,10 @@ function getSourceApi (params, options, callback) {
|
|
|
67
100
|
method,
|
|
68
101
|
path,
|
|
69
102
|
body: null,
|
|
70
|
-
querystring
|
|
71
|
-
}
|
|
103
|
+
querystring,
|
|
104
|
+
};
|
|
72
105
|
|
|
73
|
-
return this.transport.request(request, options, callback)
|
|
106
|
+
return this.transport.request(request, options, callback);
|
|
74
107
|
}
|
|
75
108
|
|
|
76
|
-
module.exports = getSourceApi
|
|
109
|
+
module.exports = getSourceApi;
|
package/api/api/index.js
CHANGED
|
@@ -28,44 +28,76 @@
|
|
|
28
28
|
* under the License.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
'use strict'
|
|
31
|
+
'use strict';
|
|
32
32
|
|
|
33
33
|
/* eslint camelcase: 0 */
|
|
34
34
|
/* eslint no-unused-vars: 0 */
|
|
35
35
|
|
|
36
|
-
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
|
37
|
-
const acceptedQuerystring = [
|
|
38
|
-
|
|
36
|
+
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
|
|
37
|
+
const acceptedQuerystring = [
|
|
38
|
+
'wait_for_active_shards',
|
|
39
|
+
'op_type',
|
|
40
|
+
'refresh',
|
|
41
|
+
'routing',
|
|
42
|
+
'timeout',
|
|
43
|
+
'version',
|
|
44
|
+
'version_type',
|
|
45
|
+
'if_seq_no',
|
|
46
|
+
'if_primary_term',
|
|
47
|
+
'pipeline',
|
|
48
|
+
'require_alias',
|
|
49
|
+
'pretty',
|
|
50
|
+
'human',
|
|
51
|
+
'error_trace',
|
|
52
|
+
'source',
|
|
53
|
+
'filter_path',
|
|
54
|
+
];
|
|
55
|
+
const snakeCase = {
|
|
56
|
+
waitForActiveShards: 'wait_for_active_shards',
|
|
57
|
+
opType: 'op_type',
|
|
58
|
+
versionType: 'version_type',
|
|
59
|
+
ifSeqNo: 'if_seq_no',
|
|
60
|
+
ifPrimaryTerm: 'if_primary_term',
|
|
61
|
+
requireAlias: 'require_alias',
|
|
62
|
+
errorTrace: 'error_trace',
|
|
63
|
+
filterPath: 'filter_path',
|
|
64
|
+
};
|
|
39
65
|
|
|
40
|
-
function indexApi
|
|
41
|
-
|
|
66
|
+
function indexApi(params, options, callback) {
|
|
67
|
+
[params, options, callback] = normalizeArguments(params, options, callback);
|
|
42
68
|
|
|
43
69
|
// check required parameters
|
|
44
70
|
if (params.index == null) {
|
|
45
|
-
const err = new this[kConfigurationError]('Missing required parameter: index')
|
|
46
|
-
return handleError(err, callback)
|
|
71
|
+
const err = new this[kConfigurationError]('Missing required parameter: index');
|
|
72
|
+
return handleError(err, callback);
|
|
47
73
|
}
|
|
48
74
|
if (params.body == null) {
|
|
49
|
-
const err = new this[kConfigurationError]('Missing required parameter: body')
|
|
50
|
-
return handleError(err, callback)
|
|
75
|
+
const err = new this[kConfigurationError]('Missing required parameter: body');
|
|
76
|
+
return handleError(err, callback);
|
|
51
77
|
}
|
|
52
78
|
|
|
53
|
-
let { method, body, id, index, type, ...querystring } = params
|
|
54
|
-
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
|
79
|
+
let { method, body, id, index, type, ...querystring } = params;
|
|
80
|
+
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
|
|
55
81
|
|
|
56
|
-
let path = ''
|
|
57
|
-
if (
|
|
58
|
-
if (method == null) method = 'PUT'
|
|
59
|
-
path =
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
let path = '';
|
|
83
|
+
if (index != null && type != null && id != null) {
|
|
84
|
+
if (method == null) method = 'PUT';
|
|
85
|
+
path =
|
|
86
|
+
'/' +
|
|
87
|
+
encodeURIComponent(index) +
|
|
88
|
+
'/' +
|
|
89
|
+
encodeURIComponent(type) +
|
|
90
|
+
'/' +
|
|
91
|
+
encodeURIComponent(id);
|
|
92
|
+
} else if (index != null && id != null) {
|
|
93
|
+
if (method == null) method = 'PUT';
|
|
94
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc' + '/' + encodeURIComponent(id);
|
|
95
|
+
} else if (index != null && type != null) {
|
|
96
|
+
if (method == null) method = 'POST';
|
|
97
|
+
path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type);
|
|
66
98
|
} else {
|
|
67
|
-
if (method == null) method = 'POST'
|
|
68
|
-
path = '/' + encodeURIComponent(index) + '/' + '_doc'
|
|
99
|
+
if (method == null) method = 'POST';
|
|
100
|
+
path = '/' + encodeURIComponent(index) + '/' + '_doc';
|
|
69
101
|
}
|
|
70
102
|
|
|
71
103
|
// build request object
|
|
@@ -73,10 +105,10 @@ function indexApi (params, options, callback) {
|
|
|
73
105
|
method,
|
|
74
106
|
path,
|
|
75
107
|
body: body || '',
|
|
76
|
-
querystring
|
|
77
|
-
}
|
|
108
|
+
querystring,
|
|
109
|
+
};
|
|
78
110
|
|
|
79
|
-
return this.transport.request(request, options, callback)
|
|
111
|
+
return this.transport.request(request, options, callback);
|
|
80
112
|
}
|
|
81
113
|
|
|
82
|
-
module.exports = indexApi
|
|
114
|
+
module.exports = indexApi;
|