@opensearch-project/opensearch 1.0.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.
Files changed (86) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.json +26 -0
  3. package/.prettierrc.json +5 -0
  4. package/.whitesource +15 -0
  5. package/ADMINS.md +18 -11
  6. package/COMPATIBILITY.md +24 -0
  7. package/DEVELOPER_GUIDE.md +22 -5
  8. package/MAINTAINERS.md +23 -18
  9. package/README.md +102 -106
  10. package/RELEASING.md +3 -3
  11. package/SECURITY.md +1 -1
  12. package/api/api/bulk.js +53 -26
  13. package/api/api/cat.js +354 -264
  14. package/api/api/clear_scroll.js +17 -17
  15. package/api/api/cluster.js +366 -219
  16. package/api/api/count.js +55 -24
  17. package/api/api/create.js +50 -24
  18. package/api/api/dangling_indices.js +95 -51
  19. package/api/api/delete.js +49 -22
  20. package/api/api/delete_by_query.js +88 -25
  21. package/api/api/delete_by_query_rethrottle.js +33 -19
  22. package/api/api/delete_script.js +31 -17
  23. package/api/api/exists.js +55 -22
  24. package/api/api/exists_source.js +60 -27
  25. package/api/api/explain.js +60 -22
  26. package/api/api/features.js +56 -35
  27. package/api/api/field_caps.js +36 -18
  28. package/api/api/get.js +55 -22
  29. package/api/api/get_script.js +30 -17
  30. package/api/api/get_script_context.js +15 -15
  31. package/api/api/get_script_languages.js +15 -15
  32. package/api/api/get_source.js +55 -22
  33. package/api/api/index.js +60 -28
  34. package/api/api/indices.js +1068 -857
  35. package/api/api/info.js +15 -15
  36. package/api/api/ingest.js +132 -96
  37. package/api/api/mget.js +50 -26
  38. package/api/api/msearch.js +49 -26
  39. package/api/api/msearch_template.js +53 -26
  40. package/api/api/mtermvectors.js +48 -24
  41. package/api/api/nodes.js +281 -154
  42. package/api/api/ping.js +15 -15
  43. package/api/api/put_script.js +40 -25
  44. package/api/api/rank_eval.js +37 -20
  45. package/api/api/reindex.js +38 -17
  46. package/api/api/reindex_rethrottle.js +32 -19
  47. package/api/api/render_search_template.js +18 -18
  48. package/api/api/scripts_painless_execute.js +15 -15
  49. package/api/api/scroll.js +31 -17
  50. package/api/api/search.js +108 -24
  51. package/api/api/search_shards.js +36 -18
  52. package/api/api/search_template.js +64 -26
  53. package/api/api/shutdown.js +66 -54
  54. package/api/api/snapshot.js +347 -224
  55. package/api/api/tasks.js +65 -46
  56. package/api/api/terms_enum.js +17 -17
  57. package/api/api/termvectors.js +57 -26
  58. package/api/api/update.js +64 -24
  59. package/api/api/update_by_query.js +89 -23
  60. package/api/api/update_by_query_rethrottle.js +33 -19
  61. package/api/index.js +267 -179
  62. package/api/new.d.ts +2042 -529
  63. package/api/opensearch_dashboards.d.ts +275 -0
  64. package/api/requestParams.d.ts +301 -69
  65. package/api/types.d.ts +6204 -5719
  66. package/api/utils.js +22 -22
  67. package/codecov.yml +2 -2
  68. package/index.d.ts +4779 -934
  69. package/index.js +153 -140
  70. package/index.mjs +9 -9
  71. package/lib/Connection.d.ts +37 -26
  72. package/lib/Connection.js +163 -168
  73. package/lib/Helpers.d.ts +103 -63
  74. package/lib/Helpers.js +398 -371
  75. package/lib/Serializer.d.ts +2 -2
  76. package/lib/Serializer.js +39 -39
  77. package/lib/Transport.d.ts +30 -12
  78. package/lib/Transport.js +383 -324
  79. package/lib/errors.d.ts +25 -7
  80. package/lib/errors.js +75 -71
  81. package/lib/pool/BaseConnectionPool.js +100 -97
  82. package/lib/pool/CloudConnectionPool.js +16 -16
  83. package/lib/pool/ConnectionPool.js +105 -105
  84. package/lib/pool/index.d.ts +8 -6
  85. package/lib/pool/index.js +6 -6
  86. package/package.json +13 -8
package/api/api/tasks.js CHANGED
@@ -28,33 +28,52 @@
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 = ['nodes', 'actions', 'parent_task_id', 'wait_for_completion', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'timeout', 'detailed', 'group_by']
38
- const snakeCase = { parentTaskId: 'parent_task_id', waitForCompletion: 'wait_for_completion', errorTrace: 'error_trace', filterPath: 'filter_path', groupBy: 'group_by' }
39
-
40
- function TasksApi (transport, ConfigurationError) {
41
- this.transport = transport
42
- this[kConfigurationError] = ConfigurationError
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'nodes',
39
+ 'actions',
40
+ 'parent_task_id',
41
+ 'wait_for_completion',
42
+ 'pretty',
43
+ 'human',
44
+ 'error_trace',
45
+ 'source',
46
+ 'filter_path',
47
+ 'timeout',
48
+ 'detailed',
49
+ 'group_by',
50
+ ];
51
+ const snakeCase = {
52
+ parentTaskId: 'parent_task_id',
53
+ waitForCompletion: 'wait_for_completion',
54
+ errorTrace: 'error_trace',
55
+ filterPath: 'filter_path',
56
+ groupBy: 'group_by',
57
+ };
58
+
59
+ function TasksApi(transport, ConfigurationError) {
60
+ this.transport = transport;
61
+ this[kConfigurationError] = ConfigurationError;
43
62
  }
44
63
 
45
- TasksApi.prototype.cancel = function tasksCancelApi (params, options, callback) {
46
- ;[params, options, callback] = normalizeArguments(params, options, callback)
64
+ TasksApi.prototype.cancel = function tasksCancelApi(params, options, callback) {
65
+ [params, options, callback] = normalizeArguments(params, options, callback);
47
66
 
48
- let { method, body, taskId, task_id, ...querystring } = params
49
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
67
+ let { method, body, taskId, task_id, ...querystring } = params;
68
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
50
69
 
51
- let path = ''
70
+ let path = '';
52
71
  if ((task_id || taskId) != null) {
53
- if (method == null) method = 'POST'
54
- path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_cancel'
72
+ if (method == null) method = 'POST';
73
+ path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_cancel';
55
74
  } else {
56
- if (method == null) method = 'POST'
57
- path = '/' + '_tasks' + '/' + '_cancel'
75
+ if (method == null) method = 'POST';
76
+ path = '/' + '_tasks' + '/' + '_cancel';
58
77
  }
59
78
 
60
79
  // build request object
@@ -62,58 +81,58 @@ TasksApi.prototype.cancel = function tasksCancelApi (params, options, callback)
62
81
  method,
63
82
  path,
64
83
  body: body || '',
65
- querystring
66
- }
84
+ querystring,
85
+ };
67
86
 
68
- return this.transport.request(request, options, callback)
69
- }
87
+ return this.transport.request(request, options, callback);
88
+ };
70
89
 
71
- TasksApi.prototype.get = function tasksGetApi (params, options, callback) {
72
- ;[params, options, callback] = normalizeArguments(params, options, callback)
90
+ TasksApi.prototype.get = function tasksGetApi(params, options, callback) {
91
+ [params, options, callback] = normalizeArguments(params, options, callback);
73
92
 
74
93
  // check required parameters
75
94
  if (params.task_id == null && params.taskId == null) {
76
- const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId')
77
- return handleError(err, callback)
95
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId');
96
+ return handleError(err, callback);
78
97
  }
79
98
 
80
- let { method, body, taskId, task_id, ...querystring } = params
81
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
99
+ let { method, body, taskId, task_id, ...querystring } = params;
100
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
82
101
 
83
- let path = ''
84
- if (method == null) method = 'GET'
85
- path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId)
102
+ let path = '';
103
+ if (method == null) method = 'GET';
104
+ path = '/' + '_tasks' + '/' + encodeURIComponent(task_id || taskId);
86
105
 
87
106
  // build request object
88
107
  const request = {
89
108
  method,
90
109
  path,
91
110
  body: null,
92
- querystring
93
- }
111
+ querystring,
112
+ };
94
113
 
95
- return this.transport.request(request, options, callback)
96
- }
114
+ return this.transport.request(request, options, callback);
115
+ };
97
116
 
98
- TasksApi.prototype.list = function tasksListApi (params, options, callback) {
99
- ;[params, options, callback] = normalizeArguments(params, options, callback)
117
+ TasksApi.prototype.list = function tasksListApi(params, options, callback) {
118
+ [params, options, callback] = normalizeArguments(params, options, callback);
100
119
 
101
- let { method, body, ...querystring } = params
102
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
120
+ let { method, body, ...querystring } = params;
121
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
103
122
 
104
- let path = ''
105
- if (method == null) method = 'GET'
106
- path = '/' + '_tasks'
123
+ let path = '';
124
+ if (method == null) method = 'GET';
125
+ path = '/' + '_tasks';
107
126
 
108
127
  // build request object
109
128
  const request = {
110
129
  method,
111
130
  path,
112
131
  body: null,
113
- querystring
114
- }
132
+ querystring,
133
+ };
115
134
 
116
- return this.transport.request(request, options, callback)
117
- }
135
+ return this.transport.request(request, options, callback);
136
+ };
118
137
 
119
- module.exports = TasksApi
138
+ module.exports = TasksApi;
@@ -28,40 +28,40 @@
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 termsEnumApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
40
+ function termsEnumApi(params, options, callback) {
41
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
42
 
43
43
  // check required parameters
44
44
  if (params.index == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: index')
46
- return handleError(err, callback)
45
+ const err = new this[kConfigurationError]('Missing required parameter: index');
46
+ return handleError(err, callback);
47
47
  }
48
48
 
49
- let { method, body, index, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
49
+ let { method, body, index, ...querystring } = params;
50
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
51
 
52
- let path = ''
53
- if (method == null) method = body == null ? 'GET' : 'POST'
54
- path = '/' + encodeURIComponent(index) + '/' + '_terms_enum'
52
+ let path = '';
53
+ if (method == null) method = body == null ? 'GET' : 'POST';
54
+ path = '/' + encodeURIComponent(index) + '/' + '_terms_enum';
55
55
 
56
56
  // build request object
57
57
  const request = {
58
58
  method,
59
59
  path,
60
60
  body: body || '',
61
- querystring
62
- }
61
+ querystring,
62
+ };
63
63
 
64
- return this.transport.request(request, options, callback)
64
+ return this.transport.request(request, options, callback);
65
65
  }
66
66
 
67
- module.exports = termsEnumApi
67
+ module.exports = termsEnumApi;
@@ -28,40 +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 = ['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' }
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'term_statistics',
39
+ 'field_statistics',
40
+ 'fields',
41
+ 'offsets',
42
+ 'positions',
43
+ 'payloads',
44
+ 'preference',
45
+ 'routing',
46
+ 'realtime',
47
+ 'version',
48
+ 'version_type',
49
+ 'pretty',
50
+ 'human',
51
+ 'error_trace',
52
+ 'source',
53
+ 'filter_path',
54
+ ];
55
+ const snakeCase = {
56
+ termStatistics: 'term_statistics',
57
+ fieldStatistics: 'field_statistics',
58
+ versionType: 'version_type',
59
+ errorTrace: 'error_trace',
60
+ filterPath: 'filter_path',
61
+ };
39
62
 
40
- function termvectorsApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
63
+ function termvectorsApi(params, options, callback) {
64
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
65
 
43
66
  // check required parameters
44
67
  if (params.index == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: index')
46
- return handleError(err, callback)
68
+ const err = new this[kConfigurationError]('Missing required parameter: index');
69
+ return handleError(err, callback);
47
70
  }
48
71
 
49
- let { method, body, index, id, type, ...querystring } = params
50
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
72
+ let { method, body, index, id, type, ...querystring } = params;
73
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
51
74
 
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'
75
+ let path = '';
76
+ if (index != null && type != null && id != null) {
77
+ if (method == null) method = body == null ? 'GET' : 'POST';
78
+ path =
79
+ '/' +
80
+ encodeURIComponent(index) +
81
+ '/' +
82
+ encodeURIComponent(type) +
83
+ '/' +
84
+ encodeURIComponent(id) +
85
+ '/' +
86
+ '_termvectors';
87
+ } else if (index != null && id != null) {
88
+ if (method == null) method = body == null ? 'GET' : 'POST';
89
+ path = '/' + encodeURIComponent(index) + '/' + '_termvectors' + '/' + encodeURIComponent(id);
90
+ } else if (index != null && type != null) {
91
+ if (method == null) method = body == null ? 'GET' : 'POST';
92
+ path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_termvectors';
62
93
  } else {
63
- if (method == null) method = body == null ? 'GET' : 'POST'
64
- path = '/' + encodeURIComponent(index) + '/' + '_termvectors'
94
+ if (method == null) method = body == null ? 'GET' : 'POST';
95
+ path = '/' + encodeURIComponent(index) + '/' + '_termvectors';
65
96
  }
66
97
 
67
98
  // build request object
@@ -69,10 +100,10 @@ function termvectorsApi (params, options, callback) {
69
100
  method,
70
101
  path,
71
102
  body: body || '',
72
- querystring
73
- }
103
+ querystring,
104
+ };
74
105
 
75
- return this.transport.request(request, options, callback)
106
+ return this.transport.request(request, options, callback);
76
107
  }
77
108
 
78
- module.exports = termvectorsApi
109
+ module.exports = termvectorsApi;
package/api/api/update.js CHANGED
@@ -28,42 +28,82 @@
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 = ['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' }
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'wait_for_active_shards',
39
+ '_source',
40
+ '_source_excludes',
41
+ '_source_exclude',
42
+ '_source_includes',
43
+ '_source_include',
44
+ 'lang',
45
+ 'refresh',
46
+ 'retry_on_conflict',
47
+ 'routing',
48
+ 'timeout',
49
+ 'if_seq_no',
50
+ 'if_primary_term',
51
+ 'require_alias',
52
+ 'pretty',
53
+ 'human',
54
+ 'error_trace',
55
+ 'source',
56
+ 'filter_path',
57
+ ];
58
+ const snakeCase = {
59
+ waitForActiveShards: 'wait_for_active_shards',
60
+ _sourceExcludes: '_source_excludes',
61
+ _sourceExclude: '_source_exclude',
62
+ _sourceIncludes: '_source_includes',
63
+ _sourceInclude: '_source_include',
64
+ retryOnConflict: 'retry_on_conflict',
65
+ ifSeqNo: 'if_seq_no',
66
+ ifPrimaryTerm: 'if_primary_term',
67
+ requireAlias: 'require_alias',
68
+ errorTrace: 'error_trace',
69
+ filterPath: 'filter_path',
70
+ };
39
71
 
40
- function updateApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
72
+ function updateApi(params, options, callback) {
73
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
74
 
43
75
  // check required parameters
44
76
  if (params.id == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: id')
46
- return handleError(err, callback)
77
+ const err = new this[kConfigurationError]('Missing required parameter: id');
78
+ return handleError(err, callback);
47
79
  }
48
80
  if (params.index == null) {
49
- const err = new this[kConfigurationError]('Missing required parameter: index')
50
- return handleError(err, callback)
81
+ const err = new this[kConfigurationError]('Missing required parameter: index');
82
+ return handleError(err, callback);
51
83
  }
52
84
  if (params.body == null) {
53
- const err = new this[kConfigurationError]('Missing required parameter: body')
54
- return handleError(err, callback)
85
+ const err = new this[kConfigurationError]('Missing required parameter: body');
86
+ return handleError(err, callback);
55
87
  }
56
88
 
57
- let { method, body, id, index, type, ...querystring } = params
58
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
89
+ let { method, body, id, index, type, ...querystring } = params;
90
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
59
91
 
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'
92
+ let path = '';
93
+ if (index != null && type != null && id != null) {
94
+ if (method == null) method = 'POST';
95
+ path =
96
+ '/' +
97
+ encodeURIComponent(index) +
98
+ '/' +
99
+ encodeURIComponent(type) +
100
+ '/' +
101
+ encodeURIComponent(id) +
102
+ '/' +
103
+ '_update';
64
104
  } else {
65
- if (method == null) method = 'POST'
66
- path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id)
105
+ if (method == null) method = 'POST';
106
+ path = '/' + encodeURIComponent(index) + '/' + '_update' + '/' + encodeURIComponent(id);
67
107
  }
68
108
 
69
109
  // build request object
@@ -71,10 +111,10 @@ function updateApi (params, options, callback) {
71
111
  method,
72
112
  path,
73
113
  body: body || '',
74
- querystring
75
- }
114
+ querystring,
115
+ };
76
116
 
77
- return this.transport.request(request, options, callback)
117
+ return this.transport.request(request, options, callback);
78
118
  }
79
119
 
80
- module.exports = updateApi
120
+ module.exports = updateApi;
@@ -28,40 +28,106 @@
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 = ['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' }
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'analyzer',
39
+ 'analyze_wildcard',
40
+ 'default_operator',
41
+ 'df',
42
+ 'from',
43
+ 'ignore_unavailable',
44
+ 'allow_no_indices',
45
+ 'conflicts',
46
+ 'expand_wildcards',
47
+ 'lenient',
48
+ 'pipeline',
49
+ 'preference',
50
+ 'q',
51
+ 'routing',
52
+ 'scroll',
53
+ 'search_type',
54
+ 'search_timeout',
55
+ 'size',
56
+ 'max_docs',
57
+ 'sort',
58
+ '_source',
59
+ '_source_excludes',
60
+ '_source_exclude',
61
+ '_source_includes',
62
+ '_source_include',
63
+ 'terminate_after',
64
+ 'stats',
65
+ 'version',
66
+ 'version_type',
67
+ 'request_cache',
68
+ 'refresh',
69
+ 'timeout',
70
+ 'wait_for_active_shards',
71
+ 'scroll_size',
72
+ 'wait_for_completion',
73
+ 'requests_per_second',
74
+ 'slices',
75
+ 'pretty',
76
+ 'human',
77
+ 'error_trace',
78
+ 'source',
79
+ 'filter_path',
80
+ ];
81
+ const snakeCase = {
82
+ analyzeWildcard: 'analyze_wildcard',
83
+ defaultOperator: 'default_operator',
84
+ ignoreUnavailable: 'ignore_unavailable',
85
+ allowNoIndices: 'allow_no_indices',
86
+ expandWildcards: 'expand_wildcards',
87
+ searchType: 'search_type',
88
+ searchTimeout: 'search_timeout',
89
+ maxDocs: 'max_docs',
90
+ _sourceExcludes: '_source_excludes',
91
+ _sourceExclude: '_source_exclude',
92
+ _sourceIncludes: '_source_includes',
93
+ _sourceInclude: '_source_include',
94
+ terminateAfter: 'terminate_after',
95
+ versionType: 'version_type',
96
+ requestCache: 'request_cache',
97
+ waitForActiveShards: 'wait_for_active_shards',
98
+ scrollSize: 'scroll_size',
99
+ waitForCompletion: 'wait_for_completion',
100
+ requestsPerSecond: 'requests_per_second',
101
+ errorTrace: 'error_trace',
102
+ filterPath: 'filter_path',
103
+ };
39
104
 
40
- function updateByQueryApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
105
+ function updateByQueryApi(params, options, callback) {
106
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
107
 
43
108
  // check required parameters
44
109
  if (params.index == null) {
45
- const err = new this[kConfigurationError]('Missing required parameter: index')
46
- return handleError(err, callback)
110
+ const err = new this[kConfigurationError]('Missing required parameter: index');
111
+ return handleError(err, callback);
47
112
  }
48
113
 
49
114
  // 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)
115
+ if (params.type != null && params.index == null) {
116
+ const err = new this[kConfigurationError]('Missing required parameter of the url: index');
117
+ return handleError(err, callback);
53
118
  }
54
119
 
55
- let { method, body, index, type, ...querystring } = params
56
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
120
+ let { method, body, index, type, ...querystring } = params;
121
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
57
122
 
58
- let path = ''
59
- if ((index) != null && (type) != null) {
60
- if (method == null) method = 'POST'
61
- path = '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query'
123
+ let path = '';
124
+ if (index != null && type != null) {
125
+ if (method == null) method = 'POST';
126
+ path =
127
+ '/' + encodeURIComponent(index) + '/' + encodeURIComponent(type) + '/' + '_update_by_query';
62
128
  } else {
63
- if (method == null) method = 'POST'
64
- path = '/' + encodeURIComponent(index) + '/' + '_update_by_query'
129
+ if (method == null) method = 'POST';
130
+ path = '/' + encodeURIComponent(index) + '/' + '_update_by_query';
65
131
  }
66
132
 
67
133
  // build request object
@@ -69,10 +135,10 @@ function updateByQueryApi (params, options, callback) {
69
135
  method,
70
136
  path,
71
137
  body: body || '',
72
- querystring
73
- }
138
+ querystring,
139
+ };
74
140
 
75
- return this.transport.request(request, options, callback)
141
+ return this.transport.request(request, options, callback);
76
142
  }
77
143
 
78
- module.exports = updateByQueryApi
144
+ module.exports = updateByQueryApi;
@@ -28,44 +28,58 @@
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 = ['requests_per_second', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
38
- const snakeCase = { requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' }
36
+ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils');
37
+ const acceptedQuerystring = [
38
+ 'requests_per_second',
39
+ 'pretty',
40
+ 'human',
41
+ 'error_trace',
42
+ 'source',
43
+ 'filter_path',
44
+ ];
45
+ const snakeCase = {
46
+ requestsPerSecond: 'requests_per_second',
47
+ errorTrace: 'error_trace',
48
+ filterPath: 'filter_path',
49
+ };
39
50
 
40
- function updateByQueryRethrottleApi (params, options, callback) {
41
- ;[params, options, callback] = normalizeArguments(params, options, callback)
51
+ function updateByQueryRethrottleApi(params, options, callback) {
52
+ [params, options, callback] = normalizeArguments(params, options, callback);
42
53
 
43
54
  // check required parameters
44
55
  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)
56
+ const err = new this[kConfigurationError]('Missing required parameter: task_id or taskId');
57
+ return handleError(err, callback);
47
58
  }
48
59
  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)
60
+ const err = new this[kConfigurationError](
61
+ 'Missing required parameter: requests_per_second or requestsPerSecond'
62
+ );
63
+ return handleError(err, callback);
51
64
  }
52
65
 
53
- let { method, body, taskId, task_id, ...querystring } = params
54
- querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
66
+ let { method, body, taskId, task_id, ...querystring } = params;
67
+ querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring);
55
68
 
56
- let path = ''
57
- if (method == null) method = 'POST'
58
- path = '/' + '_update_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle'
69
+ let path = '';
70
+ if (method == null) method = 'POST';
71
+ path =
72
+ '/' + '_update_by_query' + '/' + encodeURIComponent(task_id || taskId) + '/' + '_rethrottle';
59
73
 
60
74
  // build request object
61
75
  const request = {
62
76
  method,
63
77
  path,
64
78
  body: body || '',
65
- querystring
66
- }
79
+ querystring,
80
+ };
67
81
 
68
- return this.transport.request(request, options, callback)
82
+ return this.transport.request(request, options, callback);
69
83
  }
70
84
 
71
- module.exports = updateByQueryRethrottleApi
85
+ module.exports = updateByQueryRethrottleApi;