@elastic/elasticsearch
Advanced tools
Comparing version 7.10.0-rc.1 to 7.10.0
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'keep_on_completion', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'search_type', 'size', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'suggest_field', 'suggest_mode', 'suggest_size', 'suggest_text', 'timeout', 'track_scores', 'track_total_hits', 'allow_partial_search_results', 'version', 'seq_no_primary_term', 'max_concurrent_shard_requests'] | ||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletionTimeout: 'wait_for_completion_timeout', keepAlive: 'keep_alive', typedKeys: 'typed_keys', keepOnCompletion: 'keep_on_completion', batchedReduceSize: 'batched_reduce_size', requestCache: 'request_cache', analyzeWildcard: 'analyze_wildcard', 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', _sourceIncludes: '_source_includes', 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', seqNoPrimaryTerm: 'seq_no_primary_term', maxConcurrentShardRequests: 'max_concurrent_shard_requests' } | ||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion_timeout', 'keep_alive', 'typed_keys', 'keep_on_completion', 'batched_reduce_size', 'request_cache', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'explain', 'stored_fields', 'docvalue_fields', 'from', 'ignore_unavailable', 'ignore_throttled', 'allow_no_indices', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', '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', 'version', 'seq_no_primary_term', 'max_concurrent_shard_requests'] | ||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletionTimeout: 'wait_for_completion_timeout', keepAlive: 'keep_alive', typedKeys: 'typed_keys', keepOnCompletion: 'keep_on_completion', batchedReduceSize: 'batched_reduce_size', requestCache: 'request_cache', analyzeWildcard: 'analyze_wildcard', 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', seqNoPrimaryTerm: 'seq_no_primary_term', maxConcurrentShardRequests: 'max_concurrent_shard_requests' } | ||
@@ -30,0 +30,0 @@ function AsyncSearchApi (transport, ConfigurationError) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_includes', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['wait_for_active_shards', 'refresh', 'routing', 'timeout', 'type', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pipeline', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function bulkApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'size', 'max_docs', 'sort', '_source', '_source_excludes', '_source_includes', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
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', _sourceIncludes: '_source_includes', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', scrollSize: 'scroll_size', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['analyzer', 'analyze_wildcard', 'default_operator', 'df', 'from', 'ignore_unavailable', 'allow_no_indices', 'conflicts', 'expand_wildcards', 'lenient', 'preference', 'q', 'routing', 'scroll', 'search_type', 'search_timeout', 'size', 'max_docs', 'sort', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'terminate_after', 'stats', 'version', 'request_cache', 'refresh', 'timeout', 'wait_for_active_shards', 'scroll_size', 'wait_for_completion', 'requests_per_second', 'slices', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', searchType: 'search_type', searchTimeout: 'search_timeout', maxDocs: 'max_docs', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', terminateAfter: 'terminate_after', requestCache: 'request_cache', waitForActiveShards: 'wait_for_active_shards', scrollSize: 'scroll_size', waitForCompletion: 'wait_for_completion', requestsPerSecond: 'requests_per_second', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function deleteByQueryApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function existsSourceApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function existsApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['analyze_wildcard', 'analyzer', 'default_operator', 'df', 'stored_fields', 'lenient', 'preference', 'q', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function explainApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function getSourceApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'version', 'version_type', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', versionType: 'version_type', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function getApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_includes', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
const acceptedQuerystring = ['stored_fields', 'preference', 'realtime', 'refresh', 'routing', '_source', '_source_excludes', '_source_exclude', '_source_includes', '_source_include', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { storedFields: 'stored_fields', _sourceExcludes: '_source_excludes', _sourceExclude: '_source_exclude', _sourceIncludes: '_source_includes', _sourceInclude: '_source_include', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function mgetApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
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_includes', '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', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
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', _sourceIncludes: '_source_includes', 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', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
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', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
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', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
@@ -30,0 +30,0 @@ function searchApi (params, options, callback) { |
@@ -597,2 +597,29 @@ /* | ||
SecurityApi.prototype.grantApiKey = function securityGrantApiKeyApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params['body'] == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: body') | ||
return handleError(err, callback) | ||
} | ||
var { method, body, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
var path = '' | ||
if (method == null) method = 'POST' | ||
path = '/' + '_security' + '/' + 'api_key' + '/' + 'grant' | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SecurityApi.prototype.hasPrivileges = function securityHasPrivilegesApi (params, options, callback) { | ||
@@ -825,2 +852,3 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) | ||
get_user_privileges: { get () { return this.getUserPrivileges } }, | ||
grant_api_key: { get () { return this.grantApiKey } }, | ||
has_privileges: { get () { return this.hasPrivileges } }, | ||
@@ -827,0 +855,0 @@ invalidate_api_key: { get () { return this.invalidateApiKey } }, |
@@ -61,2 +61,50 @@ /* | ||
SnapshotApi.prototype.clone = function snapshotCloneApi (params, options, callback) { | ||
;[params, options, callback] = normalizeArguments(params, options, callback) | ||
// check required parameters | ||
if (params['repository'] == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: repository') | ||
return handleError(err, callback) | ||
} | ||
if (params['snapshot'] == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: snapshot') | ||
return handleError(err, callback) | ||
} | ||
if (params['target_snapshot'] == null && params['targetSnapshot'] == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: target_snapshot or targetSnapshot') | ||
return handleError(err, callback) | ||
} | ||
if (params['body'] == null) { | ||
const err = new this[kConfigurationError]('Missing required parameter: body') | ||
return handleError(err, callback) | ||
} | ||
// check required url components | ||
if ((params['target_snapshot'] != null || params['targetSnapshot'] != null) && (params['snapshot'] == null || params['repository'] == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: snapshot, repository') | ||
return handleError(err, callback) | ||
} else if (params['snapshot'] != null && (params['repository'] == null)) { | ||
const err = new this[kConfigurationError]('Missing required parameter of the url: repository') | ||
return handleError(err, callback) | ||
} | ||
var { method, body, repository, snapshot, targetSnapshot, target_snapshot, ...querystring } = params | ||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring) | ||
var path = '' | ||
if (method == null) method = 'PUT' | ||
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + encodeURIComponent(snapshot) + '/' + '_clone' + '/' + encodeURIComponent(target_snapshot || targetSnapshot) | ||
// build request object | ||
const request = { | ||
method, | ||
path, | ||
body: body || '', | ||
querystring | ||
} | ||
return this.transport.request(request, options, callback) | ||
} | ||
SnapshotApi.prototype.create = function snapshotCreateApi (params, options, callback) { | ||
@@ -63,0 +111,0 @@ ;[params, options, callback] = normalizeArguments(params, options, callback) |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
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_includes', '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'] | ||
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', _sourceIncludes: '_source_includes', 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' } | ||
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'] | ||
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' } | ||
@@ -30,0 +30,0 @@ function updateByQueryApi (params, options, callback) { |
@@ -26,4 +26,4 @@ /* | ||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils') | ||
const acceptedQuerystring = ['wait_for_active_shards', '_source', '_source_excludes', '_source_includes', 'lang', 'refresh', 'retry_on_conflict', 'routing', 'timeout', 'if_seq_no', 'if_primary_term', 'require_alias', 'pretty', 'human', 'error_trace', 'source', 'filter_path'] | ||
const snakeCase = { waitForActiveShards: 'wait_for_active_shards', _sourceExcludes: '_source_excludes', _sourceIncludes: '_source_includes', retryOnConflict: 'retry_on_conflict', ifSeqNo: 'if_seq_no', ifPrimaryTerm: 'if_primary_term', requireAlias: 'require_alias', errorTrace: 'error_trace', filterPath: 'filter_path' } | ||
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'] | ||
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' } | ||
@@ -30,0 +30,0 @@ function updateApi (params, options, callback) { |
@@ -44,2 +44,4 @@ /* | ||
index?: string | string[]; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
wait_for_completion_timeout?: string; | ||
@@ -108,2 +110,4 @@ keep_on_completion?: boolean; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
wait_for_active_shards?: string; | ||
@@ -648,2 +652,4 @@ refresh?: 'wait_for' | boolean; | ||
type?: string | string[]; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
analyzer?: string; | ||
@@ -739,2 +745,4 @@ analyze_wildcard?: boolean; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
stored_fields?: string | string[]; | ||
@@ -756,2 +764,4 @@ preference?: string; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
preference?: string; | ||
@@ -772,2 +782,4 @@ realtime?: boolean; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
analyze_wildcard?: boolean; | ||
@@ -802,2 +814,4 @@ analyzer?: string; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
stored_fields?: string | string[]; | ||
@@ -830,2 +844,4 @@ preference?: string; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
preference?: string; | ||
@@ -1430,2 +1446,4 @@ realtime?: boolean; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
stored_fields?: string | string[]; | ||
@@ -2056,2 +2074,4 @@ preference?: string; | ||
type?: string | string[]; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
analyzer?: string; | ||
@@ -2233,7 +2253,7 @@ analyze_wildcard?: boolean; | ||
export interface SecurityGetRole extends Generic { | ||
name?: string; | ||
name?: string | string[]; | ||
} | ||
export interface SecurityGetRoleMapping extends Generic { | ||
name?: string; | ||
name?: string | string[]; | ||
} | ||
@@ -2252,2 +2272,7 @@ | ||
export interface SecurityGrantApiKey<T = RequestBody> extends Generic { | ||
refresh?: 'wait_for' | boolean; | ||
body: T; | ||
} | ||
export interface SecurityHasPrivileges<T = RequestBody> extends Generic { | ||
@@ -2327,2 +2352,10 @@ user?: string; | ||
export interface SnapshotClone<T = RequestBody> extends Generic { | ||
repository: string; | ||
snapshot: string; | ||
target_snapshot: string; | ||
master_timeout?: string; | ||
body: T; | ||
} | ||
export interface SnapshotCreate<T = RequestBody> extends Generic { | ||
@@ -2502,2 +2535,4 @@ repository: string; | ||
type?: string; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
wait_for_active_shards?: string; | ||
@@ -2521,2 +2556,4 @@ _source?: string | string[]; | ||
type?: string | string[]; | ||
_source_exclude?: string | string[]; | ||
_source_include?: string | string[]; | ||
analyzer?: string; | ||
@@ -2523,0 +2560,0 @@ analyze_wildcard?: boolean; |
18
index.js
@@ -44,2 +44,20 @@ /* | ||
/* istanbul ignore next */ | ||
if (nodeMajor < 10) { | ||
process.emitWarning('You are using a version of Node.js that is currently in EOL. ' + | ||
'The support for this version will be dropped in 7.12. ' + | ||
'Please refer to https://ela.st/nodejs-support for additional information.', | ||
'DeprecationWarning' | ||
) | ||
} | ||
/* istanbul ignore next */ | ||
if (nodeMajor >= 10 && nodeMajor < 12) { | ||
process.emitWarning('You are using a version of Node.js that will reach EOL in April 2021. ' + | ||
'The support for this version will be dropped in 7.13. ' + | ||
'Please refer to https://ela.st/nodejs-support for additional information.', | ||
'DeprecationWarning' | ||
) | ||
} | ||
class Client extends ESAPI { | ||
@@ -46,0 +64,0 @@ constructor (opts = {}) { |
@@ -28,3 +28,2 @@ /* | ||
const debug = require('debug')('elasticsearch') | ||
const decompressResponse = require('decompress-response') | ||
const pump = require('pump') | ||
@@ -87,3 +86,2 @@ const INVALID_PATH_REGEX = /[^\u0021-\u00ff]/ | ||
this._openRequests++ | ||
var ended = false | ||
@@ -101,50 +99,35 @@ const requestParams = this.buildRequestObject(params) | ||
// listen for the response event | ||
// TODO: handle redirects? | ||
request.on('response', response => { | ||
/* istanbul ignore else */ | ||
if (ended === false) { | ||
ended = true | ||
this._openRequests-- | ||
const onResponse = response => { | ||
cleanListeners() | ||
this._openRequests-- | ||
callback(null, response) | ||
} | ||
if (params.asStream === true) { | ||
callback(null, response) | ||
} else { | ||
callback(null, decompressResponse(response)) | ||
} | ||
} | ||
}) | ||
const onTimeout = () => { | ||
cleanListeners() | ||
this._openRequests-- | ||
request.once('error', () => {}) // we need to catch the request aborted error | ||
request.abort() | ||
callback(new TimeoutError('Request timed out', params), null) | ||
} | ||
// handles request timeout | ||
request.on('timeout', () => { | ||
/* istanbul ignore else */ | ||
if (ended === false) { | ||
ended = true | ||
this._openRequests-- | ||
request.abort() | ||
callback(new TimeoutError('Request timed out', params), null) | ||
} | ||
}) | ||
const onError = err => { | ||
cleanListeners() | ||
this._openRequests-- | ||
callback(new ConnectionError(err.message), null) | ||
} | ||
// handles request error | ||
request.on('error', err => { | ||
/* istanbul ignore else */ | ||
if (ended === false) { | ||
ended = true | ||
this._openRequests-- | ||
callback(new ConnectionError(err.message), null) | ||
} | ||
}) | ||
// updates the ended state | ||
request.on('abort', () => { | ||
const onAbort = () => { | ||
cleanListeners() | ||
request.once('error', () => {}) // we need to catch the request aborted error | ||
debug('Request aborted', params) | ||
/* istanbul ignore else */ | ||
if (ended === false) { | ||
ended = true | ||
this._openRequests-- | ||
callback(new RequestAbortedError(), null) | ||
} | ||
}) | ||
this._openRequests-- | ||
callback(new RequestAbortedError(), null) | ||
} | ||
request.on('response', onResponse) | ||
request.on('timeout', onTimeout) | ||
request.on('error', onError) | ||
request.on('abort', onAbort) | ||
// Disables the Nagle algorithm | ||
@@ -157,4 +140,4 @@ request.setNoDelay(true) | ||
/* istanbul ignore if */ | ||
if (err != null && /* istanbul ignore next */ ended === false) { | ||
ended = true | ||
if (err != null) { | ||
cleanListeners() | ||
this._openRequests-- | ||
@@ -169,2 +152,9 @@ callback(err, null) | ||
return request | ||
function cleanListeners () { | ||
request.removeListener('response', onResponse) | ||
request.removeListener('timeout', onTimeout) | ||
request.removeListener('error', onError) | ||
request.removeListener('abort', onAbort) | ||
} | ||
} | ||
@@ -171,0 +161,0 @@ |
@@ -24,3 +24,3 @@ /* | ||
const os = require('os') | ||
const { gzip, createGzip } = require('zlib') | ||
const { gzip, unzip, createGzip } = require('zlib') | ||
const ms = require('ms') | ||
@@ -178,33 +178,36 @@ const { | ||
const onResponse = (err, response) => { | ||
if (err !== null) { | ||
if (err.name !== 'RequestAbortedError') { | ||
// if there is an error in the connection | ||
// let's mark the connection as dead | ||
this.connectionPool.markDead(meta.connection) | ||
const onConnectionError = (err) => { | ||
if (err.name !== 'RequestAbortedError') { | ||
// if there is an error in the connection | ||
// let's mark the connection as dead | ||
this.connectionPool.markDead(meta.connection) | ||
if (this.sniffOnConnectionFault === true) { | ||
this.sniff({ | ||
reason: Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT, | ||
requestId: meta.request.id | ||
}) | ||
} | ||
if (this.sniffOnConnectionFault === true) { | ||
this.sniff({ | ||
reason: Transport.sniffReasons.SNIFF_ON_CONNECTION_FAULT, | ||
requestId: meta.request.id | ||
}) | ||
} | ||
// retry logic | ||
if (meta.attempts < maxRetries) { | ||
meta.attempts++ | ||
debug(`Retrying request, there are still ${maxRetries - meta.attempts} attempts`, params) | ||
makeRequest() | ||
return | ||
} | ||
// retry logic | ||
if (meta.attempts < maxRetries) { | ||
meta.attempts++ | ||
debug(`Retrying request, there are still ${maxRetries - meta.attempts} attempts`, params) | ||
makeRequest() | ||
return | ||
} | ||
} | ||
err.meta = result | ||
this.emit('response', err, result) | ||
return callback(err, result) | ||
err.meta = result | ||
this.emit('response', err, result) | ||
return callback(err, result) | ||
} | ||
const onResponse = (err, response) => { | ||
if (err !== null) { | ||
return onConnectionError(err) | ||
} | ||
const { statusCode, headers } = response | ||
result.statusCode = statusCode | ||
result.headers = headers | ||
result.statusCode = response.statusCode | ||
result.headers = response.headers | ||
@@ -218,70 +221,105 @@ if (options.asStream === true) { | ||
var payload = '' | ||
// collect the payload | ||
response.setEncoding('utf8') | ||
response.on('data', chunk => { payload += chunk }) | ||
/* istanbul ignore next */ | ||
response.on('error', err => { | ||
const error = new ConnectionError(err.message, result) | ||
this.emit('response', error, result) | ||
callback(error, result) | ||
}) | ||
response.on('end', () => { | ||
const isHead = params.method === 'HEAD' | ||
// we should attempt the payload deserialization only if: | ||
// - a `content-type` is defined and is equal to `application/json` | ||
// - the request is not a HEAD request | ||
// - the payload is not an empty string | ||
if (headers['content-type'] !== undefined && | ||
headers['content-type'].indexOf('application/json') > -1 && | ||
isHead === false && | ||
payload !== '' | ||
) { | ||
try { | ||
result.body = this.serializer.deserialize(payload) | ||
} catch (err) { | ||
this.emit('response', err, result) | ||
return callback(err, result) | ||
} | ||
const contentEncoding = (result.headers['content-encoding'] || '').toLowerCase() | ||
const isCompressed = contentEncoding.indexOf('gzip') > -1 || contentEncoding.indexOf('deflate') > -1 | ||
// if the response is compressed, we must handle it | ||
// as buffer for allowing decompression later | ||
let payload = isCompressed ? [] : '' | ||
const onData = isCompressed | ||
? chunk => { payload.push(chunk) } | ||
: chunk => { payload += chunk } | ||
const onEnd = err => { | ||
response.removeListener('data', onData) | ||
response.removeListener('end', onEnd) | ||
response.removeListener('error', onEnd) | ||
response.removeListener('aborted', onAbort) | ||
if (err) { | ||
return onConnectionError(new ConnectionError(err.message)) | ||
} | ||
if (isCompressed) { | ||
unzip(Buffer.concat(payload), onBody) | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
result.body = isHead === true ? true : payload | ||
onBody(null, payload) | ||
} | ||
} | ||
// we should ignore the statusCode if the user has configured the `ignore` field with | ||
// the statusCode we just got or if the request method is HEAD and the statusCode is 404 | ||
const ignoreStatusCode = (Array.isArray(options.ignore) && options.ignore.indexOf(statusCode) > -1) || | ||
(isHead === true && statusCode === 404) | ||
const onAbort = () => { | ||
response.destroy() | ||
onEnd(new Error('Response aborted while reading the body')) | ||
} | ||
if (ignoreStatusCode === false && | ||
(statusCode === 502 || statusCode === 503 || statusCode === 504)) { | ||
// if the statusCode is 502/3/4 we should run our retry strategy | ||
// and mark the connection as dead | ||
this.connectionPool.markDead(meta.connection) | ||
// retry logic (we shoukd not retry on "429 - Too Many Requests") | ||
if (meta.attempts < maxRetries && statusCode !== 429) { | ||
meta.attempts++ | ||
debug(`Retrying request, there are still ${maxRetries - meta.attempts} attempts`, params) | ||
makeRequest() | ||
return | ||
} | ||
} else { | ||
// everything has worked as expected, let's mark | ||
// the connection as alive (or confirm it) | ||
this.connectionPool.markAlive(meta.connection) | ||
if (!isCompressed) { | ||
response.setEncoding('utf8') | ||
} | ||
response.on('data', onData) | ||
response.on('error', onEnd) | ||
response.on('end', onEnd) | ||
response.on('aborted', onAbort) | ||
} | ||
const onBody = (err, payload) => { | ||
if (err) { | ||
this.emit('response', err, result) | ||
return callback(err, result) | ||
} | ||
if (Buffer.isBuffer(payload)) { | ||
payload = payload.toString() | ||
} | ||
const isHead = params.method === 'HEAD' | ||
// we should attempt the payload deserialization only if: | ||
// - a `content-type` is defined and is equal to `application/json` | ||
// - the request is not a HEAD request | ||
// - the payload is not an empty string | ||
if (result.headers['content-type'] !== undefined && | ||
result.headers['content-type'].indexOf('application/json') > -1 && | ||
isHead === false && | ||
payload !== '' | ||
) { | ||
try { | ||
result.body = this.serializer.deserialize(payload) | ||
} catch (err) { | ||
this.emit('response', err, result) | ||
return callback(err, result) | ||
} | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
result.body = isHead === true ? true : payload | ||
} | ||
if (ignoreStatusCode === false && statusCode >= 400) { | ||
const error = new ResponseError(result) | ||
this.emit('response', error, result) | ||
callback(error, result) | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
if (isHead === true && statusCode === 404) { | ||
result.body = false | ||
} | ||
this.emit('response', null, result) | ||
callback(null, result) | ||
// we should ignore the statusCode if the user has configured the `ignore` field with | ||
// the statusCode we just got or if the request method is HEAD and the statusCode is 404 | ||
const ignoreStatusCode = (Array.isArray(options.ignore) && options.ignore.indexOf(result.statusCode) > -1) || | ||
(isHead === true && result.statusCode === 404) | ||
if (ignoreStatusCode === false && | ||
(result.statusCode === 502 || result.statusCode === 503 || result.statusCode === 504)) { | ||
// if the statusCode is 502/3/4 we should run our retry strategy | ||
// and mark the connection as dead | ||
this.connectionPool.markDead(meta.connection) | ||
// retry logic (we shoukd not retry on "429 - Too Many Requests") | ||
if (meta.attempts < maxRetries && result.statusCode !== 429) { | ||
meta.attempts++ | ||
debug(`Retrying request, there are still ${maxRetries - meta.attempts} attempts`, params) | ||
makeRequest() | ||
return | ||
} | ||
}) | ||
} else { | ||
// everything has worked as expected, let's mark | ||
// the connection as alive (or confirm it) | ||
this.connectionPool.markAlive(meta.connection) | ||
} | ||
if (ignoreStatusCode === false && result.statusCode >= 400) { | ||
const error = new ResponseError(result) | ||
this.emit('response', error, result) | ||
callback(error, result) | ||
} else { | ||
// cast to boolean if the request method was HEAD | ||
if (isHead === true && result.statusCode === 404) { | ||
result.body = false | ||
} | ||
this.emit('response', null, result) | ||
callback(null, result) | ||
} | ||
} | ||
@@ -288,0 +326,0 @@ |
@@ -14,3 +14,3 @@ { | ||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html", | ||
"version": "7.10.0-rc.1", | ||
"version": "7.10.0", | ||
"keywords": [ | ||
@@ -79,3 +79,2 @@ "elasticsearch", | ||
"debug": "^4.1.1", | ||
"decompress-response": "^4.2.0", | ||
"hpagent": "^0.1.1", | ||
@@ -82,0 +81,0 @@ "ms": "^2.1.1", |
@@ -29,6 +29,30 @@ <img align="right" width="auto" height="auto" src="https://www.elastic.co/static-res/images/elastic-logo-200.png"> | ||
### Node.js support | ||
NOTE: The minimum supported version of Node.js is `v8`. | ||
The client versioning follows the Elastc Stack versioning, this means that | ||
major, minor, and patch releases are done following a precise schedule that | ||
often does not coincide with the [Node.js release](https://nodejs.org/en/about/releases/) times. | ||
To avoid support insecure and unsupported versions of Node.js, the | ||
client **will drop the support of EOL versions of Node.js between minor releases**. | ||
Typically, as soon as a Node.js version goes into EOL, the client will continue | ||
to support that version for at least another minor release. If you are using the client | ||
with a version of Node.js that will be unsupported soon, you will see a warning | ||
in your logs (the client will start logging the warning with two minors in advance). | ||
Unless you are **always** using a supported version of Node.js, | ||
we recommend defining the client dependency in your | ||
`package.json` with the `~` instead of `^`. In this way, you will lock the | ||
dependency on the minor release and not the major. (for example, `~7.10.0` instead | ||
of `^7.10.0`). | ||
| Node.js Version | Node.js EOL date | End of support | | ||
| --------------- |------------------| ---------------------- | | ||
| `8.x` | `December 2019` | `7.11` (early 2021) | | ||
| `10.x` | `Apri 2021` | `7.12` (mid 2021) | | ||
### Compatibility | ||
The minimum supported version of Node.js is `v8`. | ||
The library is compatible with all Elasticsearch versions since 5.x, and you should use the same major version of the Elasticsearch instance that you are using. | ||
@@ -35,0 +59,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1214936
5
19083
0
232
95
- Removeddecompress-response@^4.2.0
- Removeddecompress-response@4.2.1(transitive)
- Removedmimic-response@2.1.0(transitive)