Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 21f9801fb9 | |||
| 5a88a2f398 | |||
| 3a3530e000 | |||
| ef7e95a939 | |||
| f2a00082f9 | |||
| 8634de2170 | |||
| 68f93feb01 | |||
| 1d5b8fa5c2 | |||
| 649f95afca | |||
| 5e18738921 | |||
| 38b7350f69 | |||
| 1a2665b13b | |||
| 791cfdb186 | |||
| f3a2cbffe9 | |||
| 1777d091bb | |||
| 37c2959e92 | |||
| 6aaba8af07 | |||
| 64f62c91e0 | |||
| 432df0c3db | |||
| 0f35880143 | |||
| 3bd3748feb | |||
| 559acd32be | |||
| a48ebc9442 | |||
| 563b7746cd | |||
| a287c71147 | |||
| db5476ad5d | |||
| e8b4eb8b9b | |||
| 67db0c57bf | |||
| 743c53dfe0 | |||
| adc5c2b146 | |||
| 7358fd0c83 | |||
| 9baa42ac1b | |||
| 28d8ff799e | |||
| ea2c8d2d4d | |||
| 2f0aeec108 |
@ -7,7 +7,7 @@
|
||||
# Export the TEST_SUITE variable, eg. 'free' or 'platinum' defaults to 'free'.
|
||||
# Export the NUMBER_OF_NODES variable to start more than 1 node
|
||||
|
||||
# Version 1.2.0
|
||||
# Version 1.4.0
|
||||
# - Initial version of the run-elasticsearch.sh script
|
||||
# - Deleting the volume should not dependent on the container still running
|
||||
# - Fixed `ES_JAVA_OPTS` config
|
||||
@ -15,6 +15,9 @@
|
||||
# - Refactored into functions and imports
|
||||
# - Support NUMBER_OF_NODES
|
||||
# - Added 5 retries on docker pull for fixing transient network errors
|
||||
# - Added flags to make local CCR configurations work
|
||||
# - Added action.destructive_requires_name=false as the default will be true in v8
|
||||
# - Added ingest.geoip.downloader.enabled=false as it causes false positives in testing
|
||||
|
||||
script_path=$(dirname $(realpath -s $0))
|
||||
source $script_path/functions/imports.sh
|
||||
@ -37,6 +40,8 @@ environment=($(cat <<-END
|
||||
--env node.attr.testattr=test
|
||||
--env path.repo=/tmp
|
||||
--env repositories.url.allowed_urls=http://snapshot.test*
|
||||
--env action.destructive_requires_name=false
|
||||
--env ingest.geoip.downloader.enabled=false
|
||||
END
|
||||
))
|
||||
if [[ "$TEST_SUITE" == "platinum" ]]; then
|
||||
@ -50,6 +55,7 @@ if [[ "$TEST_SUITE" == "platinum" ]]; then
|
||||
--env xpack.security.http.ssl.certificate=certs/testnode.crt
|
||||
--env xpack.security.http.ssl.certificate_authorities=certs/ca.crt
|
||||
--env xpack.security.transport.ssl.enabled=true
|
||||
--env xpack.security.transport.ssl.verification_mode=certificate
|
||||
--env xpack.security.transport.ssl.key=certs/testnode.key
|
||||
--env xpack.security.transport.ssl.certificate=certs/testnode.crt
|
||||
--env xpack.security.transport.ssl.certificate_authorities=certs/ca.crt
|
||||
@ -104,7 +110,7 @@ END
|
||||
docker run \
|
||||
--name "$node_name" \
|
||||
--network "$network_name" \
|
||||
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g" \
|
||||
--env "ES_JAVA_OPTS=-Xms1g -Xmx1g -da:org.elasticsearch.xpack.ccr.index.engine.FollowingEngineAssertions" \
|
||||
"${environment[@]}" \
|
||||
"${volumes[@]}" \
|
||||
--publish "$http_port":9200 \
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
---
|
||||
STACK_VERSION:
|
||||
- 7.x-SNAPSHOT
|
||||
- 7.15.0-SNAPSHOT
|
||||
|
||||
NODE_JS_VERSION:
|
||||
- 16
|
||||
|
||||
8
.github/workflows/nodejs.yml
vendored
8
.github/workflows/nodejs.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
- name: Runs Elasticsearch
|
||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
with:
|
||||
stack-version: 7.x-SNAPSHOT
|
||||
stack-version: 7.15.0-SNAPSHOT
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v1
|
||||
@ -93,7 +93,7 @@ jobs:
|
||||
- name: Runs Elasticsearch
|
||||
uses: elastic/elastic-github-actions/elasticsearch@master
|
||||
with:
|
||||
stack-version: 8.0.0-SNAPSHOT
|
||||
stack-version: 7.15.0-SNAPSHOT
|
||||
|
||||
- name: Use Node.js 14.x
|
||||
uses: actions/setup-node@v1
|
||||
@ -125,7 +125,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
@ -159,7 +159,7 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [12.x]
|
||||
node-version: [14.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@ -54,7 +54,8 @@ of `^7.10.0`).
|
||||
|
||||
### Compatibility
|
||||
|
||||
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.
|
||||
Language clients are forward compatible; meaning that clients support communicating with greater minor versions of Elasticsearch.
|
||||
Elastic language clients are also backwards compatible with lesser supported minor Elasticsearch versions.
|
||||
|
||||
| Elasticsearch Version | Client Version |
|
||||
| --------------------- |----------------|
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'only_managed', 'only_errors']
|
||||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', onlyManaged: 'only_managed', onlyErrors: 'only_errors' }
|
||||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'only_managed', 'only_errors', 'dry_run']
|
||||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', onlyManaged: 'only_managed', onlyErrors: 'only_errors', dryRun: 'dry_run' }
|
||||
|
||||
function IlmApi (transport, ConfigurationError) {
|
||||
this.transport = transport
|
||||
@ -132,6 +132,27 @@ IlmApi.prototype.getStatus = function ilmGetStatusApi (params, options, callback
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IlmApi.prototype.migrateToDataTiers = function ilmMigrateToDataTiersApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_ilm' + '/' + 'migrate_to_data_tiers'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IlmApi.prototype.moveToStep = function ilmMoveToStepApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -287,6 +308,7 @@ Object.defineProperties(IlmApi.prototype, {
|
||||
explain_lifecycle: { get () { return this.explainLifecycle } },
|
||||
get_lifecycle: { get () { return this.getLifecycle } },
|
||||
get_status: { get () { return this.getStatus } },
|
||||
migrate_to_data_tiers: { get () { return this.migrateToDataTiers } },
|
||||
move_to_step: { get () { return this.moveToStep } },
|
||||
put_lifecycle: { get () { return this.putLifecycle } },
|
||||
remove_policy: { get () { return this.removePolicy } }
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'flush', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards']
|
||||
const snakeCase = { masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' }
|
||||
const acceptedQuerystring = ['timeout', 'master_timeout', 'ignore_unavailable', 'allow_no_indices', 'expand_wildcards', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'index', 'fielddata', 'fields', 'query', 'request', 'wait_for_active_shards', 'include_type_name', 'run_expensive_tasks', 'flush', 'local', 'flat_settings', 'include_defaults', 'force', 'wait_if_ongoing', 'max_num_segments', 'only_expunge_deletes', 'create', 'cause', 'write_index_only', 'preserve_existing', 'order', 'detailed', 'active_only', 'dry_run', 'verbose', 'status', 'copy_settings', 'completion_fields', 'fielddata_fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments', 'forbid_closed_indices', 'wait_for_completion', 'only_ancient_segments', 'explain', 'q', 'analyzer', 'analyze_wildcard', 'default_operator', 'df', 'lenient', 'rewrite', 'all_shards']
|
||||
const snakeCase = { masterTimeout: 'master_timeout', ignoreUnavailable: 'ignore_unavailable', allowNoIndices: 'allow_no_indices', expandWildcards: 'expand_wildcards', errorTrace: 'error_trace', filterPath: 'filter_path', waitForActiveShards: 'wait_for_active_shards', includeTypeName: 'include_type_name', runExpensiveTasks: 'run_expensive_tasks', flatSettings: 'flat_settings', includeDefaults: 'include_defaults', waitIfOngoing: 'wait_if_ongoing', maxNumSegments: 'max_num_segments', onlyExpungeDeletes: 'only_expunge_deletes', writeIndexOnly: 'write_index_only', preserveExisting: 'preserve_existing', activeOnly: 'active_only', dryRun: 'dry_run', copySettings: 'copy_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments', forbidClosedIndices: 'forbid_closed_indices', waitForCompletion: 'wait_for_completion', onlyAncientSegments: 'only_ancient_segments', analyzeWildcard: 'analyze_wildcard', defaultOperator: 'default_operator', allShards: 'all_shards' }
|
||||
|
||||
function IndicesApi (transport, ConfigurationError) {
|
||||
this.transport = transport
|
||||
@ -414,6 +414,33 @@ IndicesApi.prototype.deleteTemplate = function indicesDeleteTemplateApi (params,
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IndicesApi.prototype.diskUsage = function indicesDiskUsageApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.index == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_disk_usage'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IndicesApi.prototype.exists = function indicesExistsApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -564,6 +591,33 @@ IndicesApi.prototype.existsType = function indicesExistsTypeApi (params, options
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IndicesApi.prototype.fieldUsageStats = function indicesFieldUsageStatsApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.index == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_field_usage_stats'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
IndicesApi.prototype.flush = function indicesFlushApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -1665,10 +1719,12 @@ Object.defineProperties(IndicesApi.prototype, {
|
||||
delete_data_stream: { get () { return this.deleteDataStream } },
|
||||
delete_index_template: { get () { return this.deleteIndexTemplate } },
|
||||
delete_template: { get () { return this.deleteTemplate } },
|
||||
disk_usage: { get () { return this.diskUsage } },
|
||||
exists_alias: { get () { return this.existsAlias } },
|
||||
exists_index_template: { get () { return this.existsIndexTemplate } },
|
||||
exists_template: { get () { return this.existsTemplate } },
|
||||
exists_type: { get () { return this.existsType } },
|
||||
field_usage_stats: { get () { return this.fieldUsageStats } },
|
||||
flush_synced: { get () { return this.flushSynced } },
|
||||
get_alias: { get () { return this.getAlias } },
|
||||
get_data_stream: { get () { return this.getDataStream } },
|
||||
|
||||
@ -1493,6 +1493,33 @@ MlApi.prototype.putTrainedModelAlias = function mlPutTrainedModelAliasApi (param
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
MlApi.prototype.resetJob = function mlResetJobApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.job_id == null && params.jobId == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: job_id or jobId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, jobId, job_id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_ml' + '/' + 'anomaly_detectors' + '/' + encodeURIComponent(job_id || jobId) + '/' + '_reset'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
MlApi.prototype.revertModelSnapshot = function mlRevertModelSnapshotApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -1964,6 +1991,7 @@ Object.defineProperties(MlApi.prototype, {
|
||||
put_job: { get () { return this.putJob } },
|
||||
put_trained_model: { get () { return this.putTrainedModel } },
|
||||
put_trained_model_alias: { get () { return this.putTrainedModelAlias } },
|
||||
reset_job: { get () { return this.resetJob } },
|
||||
revert_model_snapshot: { get () { return this.revertModelSnapshot } },
|
||||
set_upgrade_mode: { get () { return this.setUpgradeMode } },
|
||||
start_data_frame_analytics: { get () { return this.startDataFrameAnalytics } },
|
||||
|
||||
@ -23,14 +23,78 @@
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments']
|
||||
const snakeCase = { ignoreIdleThreads: 'ignore_idle_threads', errorTrace: 'error_trace', filterPath: 'filter_path', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' }
|
||||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'interval', 'snapshots', 'threads', 'ignore_idle_threads', 'type', 'timeout', 'flat_settings', 'completion_fields', 'fielddata_fields', 'fields', 'groups', 'level', 'types', 'include_segment_file_sizes', 'include_unloaded_segments']
|
||||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', ignoreIdleThreads: 'ignore_idle_threads', flatSettings: 'flat_settings', completionFields: 'completion_fields', fielddataFields: 'fielddata_fields', includeSegmentFileSizes: 'include_segment_file_sizes', includeUnloadedSegments: 'include_unloaded_segments' }
|
||||
|
||||
function NodesApi (transport, ConfigurationError) {
|
||||
this.transport = transport
|
||||
this[kConfigurationError] = ConfigurationError
|
||||
}
|
||||
|
||||
NodesApi.prototype.clearRepositoriesMeteringArchive = function nodesClearRepositoriesMeteringArchiveApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.node_id == null && params.nodeId == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.max_archive_version == null && params.maxArchiveVersion == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: max_archive_version or maxArchiveVersion')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if ((params.max_archive_version != null || params.maxArchiveVersion != null) && ((params.node_id == null && params.nodeId == null))) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter of the url: node_id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, nodeId, node_id, maxArchiveVersion, max_archive_version, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'DELETE'
|
||||
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering' + '/' + encodeURIComponent(max_archive_version || maxArchiveVersion)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
NodesApi.prototype.getRepositoriesMeteringInfo = function nodesGetRepositoriesMeteringInfoApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.node_id == null && params.nodeId == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: node_id or nodeId')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, nodeId, node_id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_nodes' + '/' + encodeURIComponent(node_id || nodeId) + '/' + '_repositories_metering'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
NodesApi.prototype.hotThreads = function nodesHotThreadsApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -195,6 +259,8 @@ NodesApi.prototype.usage = function nodesUsageApi (params, options, callback) {
|
||||
}
|
||||
|
||||
Object.defineProperties(NodesApi.prototype, {
|
||||
clear_repositories_metering_archive: { get () { return this.clearRepositoriesMeteringArchive } },
|
||||
get_repositories_metering_info: { get () { return this.getRepositoriesMeteringInfo } },
|
||||
hot_threads: { get () { return this.hotThreads } },
|
||||
reload_secure_settings: { get () { return this.reloadSecureSettings } }
|
||||
})
|
||||
|
||||
@ -29,17 +29,18 @@ const snakeCase = { ignoreUnavailable: 'ignore_unavailable', expandWildcards: 'e
|
||||
function openPointInTimeApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.index == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, index, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if ((index) != null) {
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_pit'
|
||||
} else {
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_pit'
|
||||
}
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_pit'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
|
||||
87
api/api/search_mvt.js
Normal file
87
api/api/search_mvt.js
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/* eslint camelcase: 0 */
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['exact_bounds', 'extent', 'grid_precision', 'grid_type', 'size', 'pretty', 'human', 'error_trace', 'source', 'filter_path']
|
||||
const snakeCase = { exactBounds: 'exact_bounds', gridPrecision: 'grid_precision', gridType: 'grid_type', errorTrace: 'error_trace', filterPath: 'filter_path' }
|
||||
|
||||
function searchMvtApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.index == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.field == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: field')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.zoom == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: zoom')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.x == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: x')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
if (params.y == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: y')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
// check required url components
|
||||
if (params.y != null && (params.x == null || params.zoom == null || params.field == null || params.index == null)) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter of the url: x, zoom, field, index')
|
||||
return handleError(err, callback)
|
||||
} else if (params.x != null && (params.zoom == null || params.field == null || params.index == null)) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter of the url: zoom, field, index')
|
||||
return handleError(err, callback)
|
||||
} else if (params.zoom != null && (params.field == null || params.index == null)) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter of the url: field, index')
|
||||
return handleError(err, callback)
|
||||
} else if (params.field != null && (params.index == null)) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter of the url: index')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, index, field, zoom, x, y, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = body == null ? 'GET' : 'POST'
|
||||
path = '/' + encodeURIComponent(index) + '/' + '_mvt' + '/' + encodeURIComponent(field) + '/' + encodeURIComponent(zoom) + '/' + encodeURIComponent(x) + '/' + encodeURIComponent(y)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
module.exports = searchMvtApi
|
||||
@ -1032,6 +1032,189 @@ SecurityApi.prototype.putUser = function securityPutUserApi (params, options, ca
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.queryApiKeys = function securityQueryApiKeysApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = body == null ? 'GET' : 'POST'
|
||||
path = '/' + '_security' + '/' + '_query' + '/' + 'api_key'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlAuthenticate = function securitySamlAuthenticateApi (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)
|
||||
}
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'authenticate'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlCompleteLogout = function securitySamlCompleteLogoutApi (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)
|
||||
}
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'complete_logout'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlInvalidate = function securitySamlInvalidateApi (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)
|
||||
}
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'invalidate'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlLogout = function securitySamlLogoutApi (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)
|
||||
}
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'logout'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlPrepareAuthentication = function securitySamlPrepareAuthenticationApi (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)
|
||||
}
|
||||
|
||||
let { method, body, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'prepare'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SecurityApi.prototype.samlServiceProviderMetadata = function securitySamlServiceProviderMetadataApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.realm_name == null && params.realmName == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: realm_name or realmName')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, realmName, realm_name, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_security' + '/' + 'saml' + '/' + 'metadata' + '/' + encodeURIComponent(realm_name || realmName)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
Object.defineProperties(SecurityApi.prototype, {
|
||||
change_password: { get () { return this.changePassword } },
|
||||
clear_api_key_cache: { get () { return this.clearApiKeyCache } },
|
||||
@ -1065,7 +1248,14 @@ Object.defineProperties(SecurityApi.prototype, {
|
||||
put_privileges: { get () { return this.putPrivileges } },
|
||||
put_role: { get () { return this.putRole } },
|
||||
put_role_mapping: { get () { return this.putRoleMapping } },
|
||||
put_user: { get () { return this.putUser } }
|
||||
put_user: { get () { return this.putUser } },
|
||||
query_api_keys: { get () { return this.queryApiKeys } },
|
||||
saml_authenticate: { get () { return this.samlAuthenticate } },
|
||||
saml_complete_logout: { get () { return this.samlCompleteLogout } },
|
||||
saml_invalidate: { get () { return this.samlInvalidate } },
|
||||
saml_logout: { get () { return this.samlLogout } },
|
||||
saml_prepare_authentication: { get () { return this.samlPrepareAuthentication } },
|
||||
saml_service_provider_metadata: { get () { return this.samlServiceProviderMetadata } }
|
||||
})
|
||||
|
||||
module.exports = SecurityApi
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'verbose', 'local']
|
||||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details' }
|
||||
const acceptedQuerystring = ['master_timeout', 'timeout', 'pretty', 'human', 'error_trace', 'source', 'filter_path', 'wait_for_completion', 'verify', 'ignore_unavailable', 'index_details', 'include_repository', 'verbose', 'local', 'blob_count', 'concurrency', 'read_node_count', 'early_read_node_count', 'seed', 'rare_action_probability', 'max_blob_size', 'max_total_data_size', 'detailed', 'rarely_abort_writes']
|
||||
const snakeCase = { masterTimeout: 'master_timeout', errorTrace: 'error_trace', filterPath: 'filter_path', waitForCompletion: 'wait_for_completion', ignoreUnavailable: 'ignore_unavailable', indexDetails: 'index_details', includeRepository: 'include_repository', blobCount: 'blob_count', readNodeCount: 'read_node_count', earlyReadNodeCount: 'early_read_node_count', rareActionProbability: 'rare_action_probability', maxBlobSize: 'max_blob_size', maxTotalDataSize: 'max_total_data_size', rarelyAbortWrites: 'rarely_abort_writes' }
|
||||
|
||||
function SnapshotApi (transport, ConfigurationError) {
|
||||
this.transport = transport
|
||||
@ -301,6 +301,33 @@ SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi (params,
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi (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)
|
||||
}
|
||||
|
||||
let { method, body, repository, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'POST'
|
||||
path = '/' + '_snapshot' + '/' + encodeURIComponent(repository) + '/' + '_analyze'
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SnapshotApi.prototype.restore = function snapshotRestoreApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -405,6 +432,7 @@ Object.defineProperties(SnapshotApi.prototype, {
|
||||
create_repository: { get () { return this.createRepository } },
|
||||
delete_repository: { get () { return this.deleteRepository } },
|
||||
get_repository: { get () { return this.getRepository } },
|
||||
repository_analyze: { get () { return this.repositoryAnalyze } },
|
||||
verify_repository: { get () { return this.verifyRepository } }
|
||||
})
|
||||
|
||||
|
||||
@ -23,8 +23,8 @@
|
||||
/* eslint no-unused-vars: 0 */
|
||||
|
||||
const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils')
|
||||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'format']
|
||||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }
|
||||
const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path', 'delimiter', 'format', 'keep_alive', 'wait_for_completion_timeout']
|
||||
const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path', keepAlive: 'keep_alive', waitForCompletionTimeout: 'wait_for_completion_timeout' }
|
||||
|
||||
function SqlApi (transport, ConfigurationError) {
|
||||
this.transport = transport
|
||||
@ -58,6 +58,87 @@ SqlApi.prototype.clearCursor = function sqlClearCursorApi (params, options, call
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SqlApi.prototype.deleteAsync = function sqlDeleteAsyncApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.id == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'DELETE'
|
||||
path = '/' + '_sql' + '/' + 'async' + '/' + 'delete' + '/' + encodeURIComponent(id)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: body || '',
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SqlApi.prototype.getAsync = function sqlGetAsyncApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.id == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_sql' + '/' + 'async' + '/' + encodeURIComponent(id)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SqlApi.prototype.getAsyncStatus = function sqlGetAsyncStatusApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
// check required parameters
|
||||
if (params.id == null) {
|
||||
const err = new this[kConfigurationError]('Missing required parameter: id')
|
||||
return handleError(err, callback)
|
||||
}
|
||||
|
||||
let { method, body, id, ...querystring } = params
|
||||
querystring = snakeCaseKeys(acceptedQuerystring, snakeCase, querystring)
|
||||
|
||||
let path = ''
|
||||
if (method == null) method = 'GET'
|
||||
path = '/' + '_sql' + '/' + 'async' + '/' + 'status' + '/' + encodeURIComponent(id)
|
||||
|
||||
// build request object
|
||||
const request = {
|
||||
method,
|
||||
path,
|
||||
body: null,
|
||||
querystring
|
||||
}
|
||||
|
||||
return this.transport.request(request, options, callback)
|
||||
}
|
||||
|
||||
SqlApi.prototype.query = function sqlQueryApi (params, options, callback) {
|
||||
;[params, options, callback] = normalizeArguments(params, options, callback)
|
||||
|
||||
@ -113,7 +194,10 @@ SqlApi.prototype.translate = function sqlTranslateApi (params, options, callback
|
||||
}
|
||||
|
||||
Object.defineProperties(SqlApi.prototype, {
|
||||
clear_cursor: { get () { return this.clearCursor } }
|
||||
clear_cursor: { get () { return this.clearCursor } },
|
||||
delete_async: { get () { return this.deleteAsync } },
|
||||
get_async: { get () { return this.getAsync } },
|
||||
get_async_status: { get () { return this.getAsyncStatus } }
|
||||
})
|
||||
|
||||
module.exports = SqlApi
|
||||
|
||||
@ -74,6 +74,7 @@ const RollupApi = require('./api/rollup')
|
||||
const scriptsPainlessExecuteApi = require('./api/scripts_painless_execute')
|
||||
const scrollApi = require('./api/scroll')
|
||||
const searchApi = require('./api/search')
|
||||
const searchMvtApi = require('./api/search_mvt')
|
||||
const searchShardsApi = require('./api/search_shards')
|
||||
const searchTemplateApi = require('./api/search_template')
|
||||
const SearchableSnapshotsApi = require('./api/searchable_snapshots')
|
||||
@ -200,6 +201,7 @@ ESAPI.prototype.renderSearchTemplate = renderSearchTemplateApi
|
||||
ESAPI.prototype.scriptsPainlessExecute = scriptsPainlessExecuteApi
|
||||
ESAPI.prototype.scroll = scrollApi
|
||||
ESAPI.prototype.search = searchApi
|
||||
ESAPI.prototype.searchMvt = searchMvtApi
|
||||
ESAPI.prototype.searchShards = searchShardsApi
|
||||
ESAPI.prototype.searchTemplate = searchTemplateApi
|
||||
ESAPI.prototype.termsEnum = termsEnumApi
|
||||
@ -397,6 +399,7 @@ Object.defineProperties(ESAPI.prototype, {
|
||||
}
|
||||
},
|
||||
scripts_painless_execute: { get () { return this.scriptsPainlessExecute } },
|
||||
search_mvt: { get () { return this.searchMvt } },
|
||||
search_shards: { get () { return this.searchShards } },
|
||||
search_template: { get () { return this.searchTemplate } },
|
||||
searchableSnapshots: {
|
||||
|
||||
14
api/kibana.d.ts
vendored
14
api/kibana.d.ts
vendored
@ -210,6 +210,7 @@ interface KibanaClient {
|
||||
explainLifecycle<TContext = unknown>(params: T.IlmExplainLifecycleRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmExplainLifecycleResponse, TContext>>
|
||||
getLifecycle<TContext = unknown>(params?: T.IlmGetLifecycleRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmGetLifecycleResponse, TContext>>
|
||||
getStatus<TContext = unknown>(params?: T.IlmGetStatusRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmGetStatusResponse, TContext>>
|
||||
migrateToDataTiers<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
moveToStep<TContext = unknown>(params: T.IlmMoveToStepRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmMoveToStepResponse, TContext>>
|
||||
putLifecycle<TContext = unknown>(params?: T.IlmPutLifecycleRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmPutLifecycleResponse, TContext>>
|
||||
removePolicy<TContext = unknown>(params: T.IlmRemovePolicyRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmRemovePolicyResponse, TContext>>
|
||||
@ -232,11 +233,13 @@ interface KibanaClient {
|
||||
deleteDataStream<TContext = unknown>(params: T.IndicesDeleteDataStreamRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesDeleteDataStreamResponse, TContext>>
|
||||
deleteIndexTemplate<TContext = unknown>(params: T.IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesDeleteIndexTemplateResponse, TContext>>
|
||||
deleteTemplate<TContext = unknown>(params: T.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesDeleteTemplateResponse, TContext>>
|
||||
diskUsage<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
exists<TContext = unknown>(params: T.IndicesExistsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsResponse, TContext>>
|
||||
existsAlias<TContext = unknown>(params: T.IndicesExistsAliasRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsAliasResponse, TContext>>
|
||||
existsIndexTemplate<TContext = unknown>(params: T.IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsIndexTemplateResponse, TContext>>
|
||||
existsTemplate<TContext = unknown>(params: T.IndicesExistsTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsTemplateResponse, TContext>>
|
||||
existsType<TContext = unknown>(params: T.IndicesExistsTypeRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsTypeResponse, TContext>>
|
||||
fieldUsageStats<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
flush<TContext = unknown>(params?: T.IndicesFlushRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesFlushResponse, TContext>>
|
||||
flushSynced<TContext = unknown>(params?: T.IndicesFlushSyncedRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesFlushSyncedResponse, TContext>>
|
||||
forcemerge<TContext = unknown>(params?: T.IndicesForcemergeRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesForcemergeResponse, TContext>>
|
||||
@ -353,6 +356,7 @@ interface KibanaClient {
|
||||
putJob<TContext = unknown>(params: T.MlPutJobRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlPutJobResponse, TContext>>
|
||||
putTrainedModel<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
putTrainedModelAlias<TContext = unknown>(params: T.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlPutTrainedModelAliasResponse, TContext>>
|
||||
resetJob<TContext = unknown>(params: T.MlResetJobRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlResetJobResponse, TContext>>
|
||||
revertModelSnapshot<TContext = unknown>(params: T.MlRevertModelSnapshotRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlRevertModelSnapshotResponse, TContext>>
|
||||
setUpgradeMode<TContext = unknown>(params?: T.MlSetUpgradeModeRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlSetUpgradeModeResponse, TContext>>
|
||||
startDataFrameAnalytics<TContext = unknown>(params: T.MlStartDataFrameAnalyticsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlStartDataFrameAnalyticsResponse, TContext>>
|
||||
@ -375,6 +379,8 @@ interface KibanaClient {
|
||||
msearchTemplate<TDocument = unknown, TContext = unknown>(params?: T.MsearchTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MsearchTemplateResponse<TDocument>, TContext>>
|
||||
mtermvectors<TContext = unknown>(params?: T.MtermvectorsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MtermvectorsResponse, TContext>>
|
||||
nodes: {
|
||||
clearMeteringArchive<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getMeteringInfo<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
hotThreads<TContext = unknown>(params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.NodesHotThreadsResponse, TContext>>
|
||||
info<TContext = unknown>(params?: T.NodesInfoRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.NodesInfoResponse, TContext>>
|
||||
reloadSecureSettings<TContext = unknown>(params?: T.NodesReloadSecureSettingsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.NodesReloadSecureSettingsResponse, TContext>>
|
||||
@ -446,7 +452,12 @@ interface KibanaClient {
|
||||
putRole<TContext = unknown>(params: T.SecurityPutRoleRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SecurityPutRoleResponse, TContext>>
|
||||
putRoleMapping<TContext = unknown>(params: T.SecurityPutRoleMappingRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SecurityPutRoleMappingResponse, TContext>>
|
||||
putUser<TContext = unknown>(params: T.SecurityPutUserRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SecurityPutUserResponse, TContext>>
|
||||
samlAuthenticate<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlCompleteLogout<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlInvalidate<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlLogout<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlPrepareAuthentication<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlServiceProviderMetadata<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
}
|
||||
shutdown: {
|
||||
deleteNode<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
@ -480,6 +491,9 @@ interface KibanaClient {
|
||||
}
|
||||
sql: {
|
||||
clearCursor<TContext = unknown>(params?: T.SqlClearCursorRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SqlClearCursorResponse, TContext>>
|
||||
deleteAsync<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getAsync<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getAsyncStatus<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
query<TContext = unknown>(params?: T.SqlQueryRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SqlQueryResponse, TContext>>
|
||||
translate<TContext = unknown>(params?: T.SqlTranslateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SqlTranslateResponse, TContext>>
|
||||
}
|
||||
|
||||
55
api/new.d.ts
vendored
55
api/new.d.ts
vendored
@ -503,6 +503,10 @@ declare class Client {
|
||||
getStatus<TContext = unknown>(callback: callbackFn<T.IlmGetStatusResponse, TContext>): TransportRequestCallback
|
||||
getStatus<TContext = unknown>(params: T.IlmGetStatusRequest, callback: callbackFn<T.IlmGetStatusResponse, TContext>): TransportRequestCallback
|
||||
getStatus<TContext = unknown>(params: T.IlmGetStatusRequest, options: TransportRequestOptions, callback: callbackFn<T.IlmGetStatusResponse, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
migrateToDataTiers<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
moveToStep<TContext = unknown>(params: T.IlmMoveToStepRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IlmMoveToStepResponse, TContext>>
|
||||
moveToStep<TContext = unknown>(params: T.IlmMoveToStepRequest, callback: callbackFn<T.IlmMoveToStepResponse, TContext>): TransportRequestCallback
|
||||
moveToStep<TContext = unknown>(params: T.IlmMoveToStepRequest, options: TransportRequestOptions, callback: callbackFn<T.IlmMoveToStepResponse, TContext>): TransportRequestCallback
|
||||
@ -571,6 +575,10 @@ declare class Client {
|
||||
deleteTemplate<TContext = unknown>(params: T.IndicesDeleteTemplateRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesDeleteTemplateResponse, TContext>>
|
||||
deleteTemplate<TContext = unknown>(params: T.IndicesDeleteTemplateRequest, callback: callbackFn<T.IndicesDeleteTemplateResponse, TContext>): TransportRequestCallback
|
||||
deleteTemplate<TContext = unknown>(params: T.IndicesDeleteTemplateRequest, options: TransportRequestOptions, callback: callbackFn<T.IndicesDeleteTemplateResponse, TContext>): TransportRequestCallback
|
||||
diskUsage<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
diskUsage<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
diskUsage<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
diskUsage<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
exists<TContext = unknown>(params: T.IndicesExistsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsResponse, TContext>>
|
||||
exists<TContext = unknown>(params: T.IndicesExistsRequest, callback: callbackFn<T.IndicesExistsResponse, TContext>): TransportRequestCallback
|
||||
exists<TContext = unknown>(params: T.IndicesExistsRequest, options: TransportRequestOptions, callback: callbackFn<T.IndicesExistsResponse, TContext>): TransportRequestCallback
|
||||
@ -586,6 +594,10 @@ declare class Client {
|
||||
existsType<TContext = unknown>(params: T.IndicesExistsTypeRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesExistsTypeResponse, TContext>>
|
||||
existsType<TContext = unknown>(params: T.IndicesExistsTypeRequest, callback: callbackFn<T.IndicesExistsTypeResponse, TContext>): TransportRequestCallback
|
||||
existsType<TContext = unknown>(params: T.IndicesExistsTypeRequest, options: TransportRequestOptions, callback: callbackFn<T.IndicesExistsTypeResponse, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
fieldUsageStats<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
flush<TContext = unknown>(params?: T.IndicesFlushRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.IndicesFlushResponse, TContext>>
|
||||
flush<TContext = unknown>(callback: callbackFn<T.IndicesFlushResponse, TContext>): TransportRequestCallback
|
||||
flush<TContext = unknown>(params: T.IndicesFlushRequest, callback: callbackFn<T.IndicesFlushResponse, TContext>): TransportRequestCallback
|
||||
@ -974,6 +986,9 @@ declare class Client {
|
||||
putTrainedModelAlias<TContext = unknown>(params: T.MlPutTrainedModelAliasRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlPutTrainedModelAliasResponse, TContext>>
|
||||
putTrainedModelAlias<TContext = unknown>(params: T.MlPutTrainedModelAliasRequest, callback: callbackFn<T.MlPutTrainedModelAliasResponse, TContext>): TransportRequestCallback
|
||||
putTrainedModelAlias<TContext = unknown>(params: T.MlPutTrainedModelAliasRequest, options: TransportRequestOptions, callback: callbackFn<T.MlPutTrainedModelAliasResponse, TContext>): TransportRequestCallback
|
||||
resetJob<TContext = unknown>(params: T.MlResetJobRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlResetJobResponse, TContext>>
|
||||
resetJob<TContext = unknown>(params: T.MlResetJobRequest, callback: callbackFn<T.MlResetJobResponse, TContext>): TransportRequestCallback
|
||||
resetJob<TContext = unknown>(params: T.MlResetJobRequest, options: TransportRequestOptions, callback: callbackFn<T.MlResetJobResponse, TContext>): TransportRequestCallback
|
||||
revertModelSnapshot<TContext = unknown>(params: T.MlRevertModelSnapshotRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.MlRevertModelSnapshotResponse, TContext>>
|
||||
revertModelSnapshot<TContext = unknown>(params: T.MlRevertModelSnapshotRequest, callback: callbackFn<T.MlRevertModelSnapshotResponse, TContext>): TransportRequestCallback
|
||||
revertModelSnapshot<TContext = unknown>(params: T.MlRevertModelSnapshotRequest, options: TransportRequestOptions, callback: callbackFn<T.MlRevertModelSnapshotResponse, TContext>): TransportRequestCallback
|
||||
@ -1041,6 +1056,14 @@ declare class Client {
|
||||
mtermvectors<TContext = unknown>(params: T.MtermvectorsRequest, callback: callbackFn<T.MtermvectorsResponse, TContext>): TransportRequestCallback
|
||||
mtermvectors<TContext = unknown>(params: T.MtermvectorsRequest, options: TransportRequestOptions, callback: callbackFn<T.MtermvectorsResponse, TContext>): TransportRequestCallback
|
||||
nodes: {
|
||||
clearMeteringArchive<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
clearMeteringArchive<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
clearMeteringArchive<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
clearMeteringArchive<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getMeteringInfo<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getMeteringInfo<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getMeteringInfo<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getMeteringInfo<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
hotThreads<TContext = unknown>(params?: T.NodesHotThreadsRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.NodesHotThreadsResponse, TContext>>
|
||||
hotThreads<TContext = unknown>(callback: callbackFn<T.NodesHotThreadsResponse, TContext>): TransportRequestCallback
|
||||
hotThreads<TContext = unknown>(params: T.NodesHotThreadsRequest, callback: callbackFn<T.NodesHotThreadsResponse, TContext>): TransportRequestCallback
|
||||
@ -1280,10 +1303,30 @@ declare class Client {
|
||||
putUser<TContext = unknown>(params: T.SecurityPutUserRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SecurityPutUserResponse, TContext>>
|
||||
putUser<TContext = unknown>(params: T.SecurityPutUserRequest, callback: callbackFn<T.SecurityPutUserResponse, TContext>): TransportRequestCallback
|
||||
putUser<TContext = unknown>(params: T.SecurityPutUserRequest, options: TransportRequestOptions, callback: callbackFn<T.SecurityPutUserResponse, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlAuthenticate<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlCompleteLogout<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlInvalidate<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlLogout<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlLogout<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlLogout<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlLogout<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlPrepareAuthentication<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
samlServiceProviderMetadata<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
}
|
||||
shutdown: {
|
||||
deleteNode<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
@ -1380,6 +1423,18 @@ declare class Client {
|
||||
clearCursor<TContext = unknown>(callback: callbackFn<T.SqlClearCursorResponse, TContext>): TransportRequestCallback
|
||||
clearCursor<TContext = unknown>(params: T.SqlClearCursorRequest, callback: callbackFn<T.SqlClearCursorResponse, TContext>): TransportRequestCallback
|
||||
clearCursor<TContext = unknown>(params: T.SqlClearCursorRequest, options: TransportRequestOptions, callback: callbackFn<T.SqlClearCursorResponse, TContext>): TransportRequestCallback
|
||||
deleteAsync<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
deleteAsync<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
deleteAsync<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
deleteAsync<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsync<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getAsync<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsync<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsync<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TContext = unknown>(params?: TODO, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TODO, TContext>>
|
||||
getAsyncStatus<TContext = unknown>(callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TContext = unknown>(params: TODO, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TContext = unknown>(params: TODO, options: TransportRequestOptions, callback: callbackFn<TODO, TContext>): TransportRequestCallback
|
||||
query<TContext = unknown>(params?: T.SqlQueryRequest, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<T.SqlQueryResponse, TContext>>
|
||||
query<TContext = unknown>(callback: callbackFn<T.SqlQueryResponse, TContext>): TransportRequestCallback
|
||||
query<TContext = unknown>(params: T.SqlQueryRequest, callback: callbackFn<T.SqlQueryResponse, TContext>): TransportRequestCallback
|
||||
|
||||
116
api/requestParams.d.ts
vendored
116
api/requestParams.d.ts
vendored
@ -897,6 +897,11 @@ export interface IlmGetLifecycle extends Generic {
|
||||
export interface IlmGetStatus extends Generic {
|
||||
}
|
||||
|
||||
export interface IlmMigrateToDataTiers<T = RequestBody> extends Generic {
|
||||
dry_run?: boolean;
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface IlmMoveToStep<T = RequestBody> extends Generic {
|
||||
index: string;
|
||||
body?: T;
|
||||
@ -1034,6 +1039,15 @@ export interface IndicesDeleteTemplate extends Generic {
|
||||
master_timeout?: string;
|
||||
}
|
||||
|
||||
export interface IndicesDiskUsage extends Generic {
|
||||
index: string;
|
||||
run_expensive_tasks?: boolean;
|
||||
flush?: boolean;
|
||||
ignore_unavailable?: boolean;
|
||||
allow_no_indices?: boolean;
|
||||
expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all';
|
||||
}
|
||||
|
||||
export interface IndicesExists extends Generic {
|
||||
index: string | string[];
|
||||
local?: boolean;
|
||||
@ -1076,6 +1090,14 @@ export interface IndicesExistsType extends Generic {
|
||||
local?: boolean;
|
||||
}
|
||||
|
||||
export interface IndicesFieldUsageStats extends Generic {
|
||||
index: string;
|
||||
fields?: string | string[];
|
||||
ignore_unavailable?: boolean;
|
||||
allow_no_indices?: boolean;
|
||||
expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all';
|
||||
}
|
||||
|
||||
export interface IndicesFlush extends Generic {
|
||||
index?: string | string[];
|
||||
force?: boolean;
|
||||
@ -1842,6 +1864,10 @@ export interface MlPutFilter<T = RequestBody> extends Generic {
|
||||
|
||||
export interface MlPutJob<T = RequestBody> extends Generic {
|
||||
job_id: string;
|
||||
ignore_unavailable?: boolean;
|
||||
allow_no_indices?: boolean;
|
||||
ignore_throttled?: boolean;
|
||||
expand_wildcards?: 'open' | 'closed' | 'hidden' | 'none' | 'all';
|
||||
body: T;
|
||||
}
|
||||
|
||||
@ -1856,6 +1882,11 @@ export interface MlPutTrainedModelAlias extends Generic {
|
||||
reassign?: boolean;
|
||||
}
|
||||
|
||||
export interface MlResetJob extends Generic {
|
||||
job_id: string;
|
||||
wait_for_completion?: boolean;
|
||||
}
|
||||
|
||||
export interface MlRevertModelSnapshot<T = RequestBody> extends Generic {
|
||||
job_id: string;
|
||||
snapshot_id: string;
|
||||
@ -1994,6 +2025,15 @@ export interface Mtermvectors<T = RequestBody> extends Generic {
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface NodesClearRepositoriesMeteringArchive extends Generic {
|
||||
node_id: string | string[];
|
||||
max_archive_version: number;
|
||||
}
|
||||
|
||||
export interface NodesGetRepositoriesMeteringInfo extends Generic {
|
||||
node_id: string | string[];
|
||||
}
|
||||
|
||||
export interface NodesHotThreads extends Generic {
|
||||
node_id?: string | string[];
|
||||
interval?: string;
|
||||
@ -2039,7 +2079,7 @@ export interface NodesUsage extends Generic {
|
||||
}
|
||||
|
||||
export interface OpenPointInTime extends Generic {
|
||||
index?: string | string[];
|
||||
index: string | string[];
|
||||
preference?: string;
|
||||
routing?: string;
|
||||
ignore_unavailable?: boolean;
|
||||
@ -2196,6 +2236,20 @@ export interface Search<T = RequestBody> extends Generic {
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface SearchMvt<T = RequestBody> extends Generic {
|
||||
index: string | string[];
|
||||
field: string;
|
||||
zoom: number;
|
||||
x: number;
|
||||
y: number;
|
||||
exact_bounds?: boolean;
|
||||
extent?: number;
|
||||
grid_precision?: number;
|
||||
grid_type?: 'grid' | 'point';
|
||||
size?: number;
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface SearchShards extends Generic {
|
||||
index?: string | string[];
|
||||
preference?: string;
|
||||
@ -2422,6 +2476,34 @@ export interface SecurityPutUser<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecurityQueryApiKeys<T = RequestBody> extends Generic {
|
||||
body?: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlAuthenticate<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlCompleteLogout<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlInvalidate<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlLogout<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlPrepareAuthentication<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SecuritySamlServiceProviderMetadata extends Generic {
|
||||
realm_name: string;
|
||||
}
|
||||
|
||||
export interface ShutdownDeleteNode extends Generic {
|
||||
node_id: string;
|
||||
}
|
||||
@ -2515,6 +2597,7 @@ export interface SnapshotGet extends Generic {
|
||||
master_timeout?: string;
|
||||
ignore_unavailable?: boolean;
|
||||
index_details?: boolean;
|
||||
include_repository?: boolean;
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
@ -2524,6 +2607,21 @@ export interface SnapshotGetRepository extends Generic {
|
||||
local?: boolean;
|
||||
}
|
||||
|
||||
export interface SnapshotRepositoryAnalyze extends Generic {
|
||||
repository: string;
|
||||
blob_count?: number;
|
||||
concurrency?: number;
|
||||
read_node_count?: number;
|
||||
early_read_node_count?: number;
|
||||
seed?: number;
|
||||
rare_action_probability?: number;
|
||||
max_blob_size?: string;
|
||||
max_total_data_size?: string;
|
||||
timeout?: string;
|
||||
detailed?: boolean;
|
||||
rarely_abort_writes?: boolean;
|
||||
}
|
||||
|
||||
export interface SnapshotRestore<T = RequestBody> extends Generic {
|
||||
repository: string;
|
||||
snapshot: string;
|
||||
@ -2549,6 +2647,22 @@ export interface SqlClearCursor<T = RequestBody> extends Generic {
|
||||
body: T;
|
||||
}
|
||||
|
||||
export interface SqlDeleteAsync extends Generic {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface SqlGetAsync extends Generic {
|
||||
id: string;
|
||||
delimiter?: string;
|
||||
format?: string;
|
||||
keep_alive?: string;
|
||||
wait_for_completion_timeout?: string;
|
||||
}
|
||||
|
||||
export interface SqlGetAsyncStatus extends Generic {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface SqlQuery<T = RequestBody> extends Generic {
|
||||
format?: string;
|
||||
body: T;
|
||||
|
||||
510
api/types.d.ts
vendored
510
api/types.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -83,4 +83,18 @@ class MySerializer extends Serializer {
|
||||
const client = new Client({
|
||||
Serializer: MySerializer
|
||||
})
|
||||
----
|
||||
----
|
||||
|
||||
[discrete]
|
||||
==== Migrate to v8
|
||||
|
||||
The Node.js client can be configured to emit an HTTP header
|
||||
``Accept: application/vnd.elasticsearch+json; compatible-with=7``
|
||||
which signals to Elasticsearch that the client is requesting
|
||||
``7.x`` version of request and response bodies. This allows for
|
||||
upgrading from 7.x to 8.x version of Elasticsearch without upgrading
|
||||
everything at once. Elasticsearch should be upgraded first after
|
||||
the compatibility header is configured and clients should be upgraded
|
||||
second.
|
||||
To enable to setting, configure the environment variable
|
||||
``ELASTIC_CLIENT_APIVERSIONING`` to ``true``.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
[[basic-config]]
|
||||
=== Basic configuration
|
||||
|
||||
This page shows you the possible basic configuration options that the clients
|
||||
This page shows you the possible basic configuration options that the clients
|
||||
offers.
|
||||
|
||||
|
||||
@ -46,9 +46,9 @@ node: {
|
||||
----
|
||||
|
||||
|`auth`
|
||||
a|Your authentication data. You can use both basic authentication and
|
||||
a|Your authentication data. You can use both basic authentication and
|
||||
{ref}/security-api-create-api-key.html[ApiKey]. +
|
||||
See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication]
|
||||
See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication]
|
||||
for more details. +
|
||||
_Default:_ `null`
|
||||
|
||||
@ -67,6 +67,13 @@ auth: {
|
||||
apiKey: 'base64EncodedKey'
|
||||
}
|
||||
----
|
||||
Bearer authentication, useful for https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html[service account tokens]. Be aware that it does not handle automatic token refresh:
|
||||
[source,js]
|
||||
----
|
||||
auth: {
|
||||
bearer: 'token'
|
||||
}
|
||||
----
|
||||
|
||||
|
||||
|`maxRetries`
|
||||
@ -134,7 +141,7 @@ const client = new Client({
|
||||
----
|
||||
|
||||
|`agent`
|
||||
a|`http.AgentOptions, function` - http agent https://nodejs.org/api/http.html#http_new_agent_options[options],
|
||||
a|`http.AgentOptions, function` - http agent https://nodejs.org/api/http.html#http_new_agent_options[options],
|
||||
or a function that returns an actual http agent instance. If you want to disable the http agent use entirely
|
||||
(and disable the `keep-alive` feature), set the agent to `false`. +
|
||||
_Default:_ `null`
|
||||
@ -189,7 +196,7 @@ function nodeSelector (connections) {
|
||||
----
|
||||
|
||||
|`generateRequestId`
|
||||
a|`function` - function to generate the request id for every request, it takes
|
||||
a|`function` - function to generate the request id for every request, it takes
|
||||
two parameters, the request parameters and options. +
|
||||
By default it generates an incremental integer for every request. +
|
||||
_Custom function example:_
|
||||
@ -226,17 +233,17 @@ such as the client and platform version. +
|
||||
_Default:_ `true`
|
||||
|
||||
|`cloud`
|
||||
a|`object` - Custom configuration for connecting to
|
||||
https://cloud.elastic.co[Elastic Cloud]. See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication]
|
||||
a|`object` - Custom configuration for connecting to
|
||||
https://cloud.elastic.co[Elastic Cloud]. See https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/auth-reference.html[Authentication]
|
||||
for more details. +
|
||||
_Default:_ `null` +
|
||||
_Cloud configuration example:_
|
||||
_Default:_ `null` +
|
||||
_Cloud configuration example:_
|
||||
[source,js]
|
||||
----
|
||||
const client = new Client({
|
||||
cloud: {
|
||||
id: 'name:bG9jYWxob3N0JGFiY2QkZWZnaA=='
|
||||
},
|
||||
},
|
||||
auth: {
|
||||
username: 'elastic',
|
||||
password: 'changeme'
|
||||
@ -248,4 +255,28 @@ const client = new Client({
|
||||
|`boolean`, `'proto'`, `'constructor'` - By the default the client will protect you against prototype poisoning attacks. Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more. If needed you can disable prototype poisoning protection entirely or one of the two checks. Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more. +
|
||||
_Default:_ `false`
|
||||
|
||||
|===
|
||||
|`caFingerprint`
|
||||
|`string` - If configured, verify that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied fingerprint. Only accepts SHA256 digest fingerprints. +
|
||||
_Default:_ `null`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
==== Performances considerations
|
||||
|
||||
By default, the client will protection you against prototype poisoning attacks.
|
||||
Read https://web.archive.org/web/20200319091159/https://hueniverse.com/square-brackets-are-the-enemy-ff5b9fd8a3e8?gi=184a27ee2a08[this article] to learn more.
|
||||
If needed you can disable prototype poisoning protection entirely or one of the two checks.
|
||||
Read the `secure-json-parse` https://github.com/fastify/secure-json-parse[documentation] to learn more.
|
||||
|
||||
While it's good to be safe, you should know that security always comes with a cost.
|
||||
With big enough payloads, this security check could causea drop in the overall performances,
|
||||
which might be a problem for your application.
|
||||
If you know you can trust the data stored in Elasticsearch, you can safely disable this check.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
const client = new Client({
|
||||
disablePrototypePoisoningProtection: true
|
||||
})
|
||||
----
|
||||
|
||||
@ -1,6 +1,59 @@
|
||||
[[changelog-client]]
|
||||
== Release notes
|
||||
|
||||
[discrete]
|
||||
=== 7.14.0
|
||||
|
||||
[discrete]
|
||||
==== Features
|
||||
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.14`
|
||||
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.14/release-notes-7.14.0.html[here].
|
||||
|
||||
[discrete]
|
||||
===== Verify connection to Elasticsearch https://github.com/elastic/elasticsearch-js/pull/1487[#1487]
|
||||
|
||||
The client will verify if it's working with a supported release of Elasticsearch.
|
||||
Elastic language clients are guaranteed to be able to communicate with Elasticsearch or Elastic solutions running on the same major version and greater or equal minor version.
|
||||
|
||||
Language clients are forward compatible; meaning that clients support communicating with greater minor versions of Elasticsearch. Elastic language clients are not guaranteed to be backwards compatible.
|
||||
|
||||
[discrete]
|
||||
===== Add api compatibility header support https://github.com/elastic/elasticsearch-js/pull/1478[#1478]
|
||||
|
||||
If you configure the `ELASTIC_CLIENT_APIVERSIONING` to `true` the client will send a compatibility header
|
||||
to allow you to use a 7.x client against a 8.x cluster. In this way it will be easier to migrate your code to a newer release of Elasticsearch.
|
||||
|
||||
[discrete]
|
||||
===== Add support for bearer auth https://github.com/elastic/elasticsearch-js/pull/1488[#1488]
|
||||
|
||||
Bearer authentication, useful for https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html[service account tokens].
|
||||
Be aware that it does not handle automatic token refresh:
|
||||
|
||||
[source,js]
|
||||
----
|
||||
auth: {
|
||||
bearer: 'token'
|
||||
}
|
||||
----
|
||||
|
||||
[discrete]
|
||||
===== Bulk update improvements https://github.com/elastic/elasticsearch-js/pull/1428[#1428]
|
||||
|
||||
The final stats object will let you know how many `noop` operations happened.
|
||||
Also, a new `.stats` getter has been added to allow you to read the stats before
|
||||
the operation finishes.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
const b = client.helpers.bulk({ ... })
|
||||
...
|
||||
console.log(b.stats)
|
||||
----
|
||||
|
||||
[discrete]
|
||||
=== 7.13.0
|
||||
|
||||
@ -10,7 +63,7 @@
|
||||
[discrete]
|
||||
===== Remove Node.js v10 support https://github.com/elastic/elasticsearch-js/pull/1471[#1471]
|
||||
|
||||
According to our
|
||||
According to our
|
||||
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/installation.html#nodejs-support[support matrix].
|
||||
|
||||
[discrete]
|
||||
@ -19,7 +72,7 @@ https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/inst
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.13`
|
||||
|
||||
You can find all the API changes
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/release-notes-7.13.0.html[here].
|
||||
|
||||
[discrete]
|
||||
@ -56,7 +109,7 @@ This is now fixed and in case of error you will get the full body response.
|
||||
[discrete]
|
||||
===== Remove Node.js v8 support https://github.com/elastic/elasticsearch-js/pull/1402[#1402]
|
||||
|
||||
According to our
|
||||
According to our
|
||||
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/installation.html#nodejs-support[support matrix].
|
||||
|
||||
[discrete]
|
||||
@ -65,7 +118,7 @@ https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/inst
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.12`
|
||||
|
||||
You can find all the API changes
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.12/release-notes-7.12.0.html[here].
|
||||
|
||||
[discrete]
|
||||
@ -91,15 +144,15 @@ Now the thenable offers a `.finally` method as well.
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.11`
|
||||
|
||||
You can find all the API changes
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.11/release-notes-7.11.0.html[here].
|
||||
|
||||
[discrete]
|
||||
===== Added new observability events https://github.com/elastic/elasticsearch-js/pull/1365[#1365]
|
||||
|
||||
Two new observability events has been introduced: `serialization` and
|
||||
`deserialization`. The event order is described in the following graph, in some
|
||||
edge cases, the order is not guaranteed. You can find in
|
||||
Two new observability events has been introduced: `serialization` and
|
||||
`deserialization`. The event order is described in the following graph, in some
|
||||
edge cases, the order is not guaranteed. You can find in
|
||||
https://github.com/elastic/elasticsearch-js/blob/master/test/acceptance/events-order.test.js[`test/acceptance/events-order.test.js`]
|
||||
how the order changes based on the situation.
|
||||
|
||||
@ -122,7 +175,7 @@ serialization
|
||||
[discrete]
|
||||
===== Added x-elastic-client-meta header https://github.com/elastic/elasticsearch-js/pull/1373[#1373]
|
||||
|
||||
Adds the `x-elastic-client-meta` HTTP header which is used by Elastic Cloud and
|
||||
Adds the `x-elastic-client-meta` HTTP header which is used by Elastic Cloud and
|
||||
can be disabled with the `enableMetaHeader` parameter set to `false`.
|
||||
|
||||
[discrete]
|
||||
@ -131,9 +184,9 @@ can be disabled with the `enableMetaHeader` parameter set to `false`.
|
||||
[discrete]
|
||||
===== Fixes req.abort() with a body that is a stream calls callback(err) twice https://github.com/elastic/elasticsearch-js/pull/1376[#1376]
|
||||
|
||||
When using a body that is a stream to client.search(), and calling req.abort(),
|
||||
the callback is called twice. Once for the RequestAbortedError, as expected, and
|
||||
once for a "premature close" error from end-of-stream, used by pump, used by the
|
||||
When using a body that is a stream to client.search(), and calling req.abort(),
|
||||
the callback is called twice. Once for the RequestAbortedError, as expected, and
|
||||
once for a "premature close" error from end-of-stream, used by pump, used by the
|
||||
client. This issue has now been fixed.
|
||||
|
||||
[discrete]
|
||||
@ -145,14 +198,14 @@ client. This issue has now been fixed.
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.10`.
|
||||
|
||||
You can find all the API changes
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.10/release-notes-7.10.0.html[here].
|
||||
|
||||
[discrete]
|
||||
===== Added proxy support https://github.com/elastic/elasticsearch-js/pull/1260[#1260]
|
||||
|
||||
If you need to pass through an http(s) proxy for connecting to {es}, the client
|
||||
offers out of the box a handy configuration for helping you with it. Under the
|
||||
If you need to pass through an http(s) proxy for connecting to {es}, the client
|
||||
offers out of the box a handy configuration for helping you with it. Under the
|
||||
hood it uses the https://github.com/delvedor/hpagent[`hpagent`] module.
|
||||
|
||||
[source,js]
|
||||
@ -179,15 +232,15 @@ const client = new Client({
|
||||
[discrete]
|
||||
===== Scroll search should clear the scroll at the end https://github.com/elastic/elasticsearch-js/pull/1331[#1331]
|
||||
|
||||
From now on the scroll search helper will automatically close the scroll on
|
||||
From now on the scroll search helper will automatically close the scroll on
|
||||
{es}, by doing so, {es} will free resources faster.
|
||||
|
||||
[discrete]
|
||||
===== Handle connectivity issues while reading the body https://github.com/elastic/elasticsearch-js/pull/1343[#1343]
|
||||
|
||||
It might happen that the underlying socket stops working due to an external
|
||||
cause while reading the body. This could lead to an unwanted
|
||||
`DeserialzationError`. From now, this will be handled as a generic
|
||||
It might happen that the underlying socket stops working due to an external
|
||||
cause while reading the body. This could lead to an unwanted
|
||||
`DeserialzationError`. From now, this will be handled as a generic
|
||||
`ConnectionError`.
|
||||
|
||||
[discrete]
|
||||
@ -196,13 +249,13 @@ cause while reading the body. This could lead to an unwanted
|
||||
[discrete]
|
||||
===== Add warning log about nodejs version support https://github.com/elastic/elasticsearch-js/pull/1349[#1349]
|
||||
|
||||
`7.11` will be the last version of the client that will support Node.js v8,
|
||||
while `7.12` will be the last one that supports Node.js v10. If you are eusing
|
||||
this versions you will see a `DeprecationWaring` in your logs. We strongly
|
||||
recommend to upgrade to newer versions of Node.js as usng an EOL version will
|
||||
`7.11` will be the last version of the client that will support Node.js v8,
|
||||
while `7.12` will be the last one that supports Node.js v10. If you are using
|
||||
this versions you will see a `DeprecationWaring` in your logs. We strongly
|
||||
recommend to upgrade to newer versions of Node.js as usng an EOL version will
|
||||
expose you to securty risks.
|
||||
|
||||
Please refer to https://ela.st/nodejs-support[ela.st/nodejs-support] for
|
||||
Please refer to https://ela.st/nodejs-support[ela.st/nodejs-support] for
|
||||
additional information.
|
||||
|
||||
[discrete]
|
||||
@ -214,16 +267,16 @@ additional information.
|
||||
[discrete]
|
||||
===== Improve child performances https://github.com/elastic/elasticsearch-js/pull/1314[#1314]
|
||||
|
||||
The client code has been refactored to speed up the performances of the child
|
||||
method. Before this pr, creating many children per second would have caused a
|
||||
high memory consumption and a spike in CPU usage. This pr changes the way the
|
||||
client is created by refactoring the code generation, now the clients methods
|
||||
are no longer added to the instance with a for loop but via prototypal
|
||||
inheritance. Thus, the overall performances are way better, now creating a child
|
||||
The client code has been refactored to speed up the performances of the child
|
||||
method. Before this pr, creating many children per second would have caused a
|
||||
high memory consumption and a spike in CPU usage. This pr changes the way the
|
||||
client is created by refactoring the code generation, now the clients methods
|
||||
are no longer added to the instance with a for loop but via prototypal
|
||||
inheritance. Thus, the overall performances are way better, now creating a child
|
||||
is ~5 times faster, and it consumes ~70% less memory.
|
||||
|
||||
This change should not cause any breaking change unless you were mocking the
|
||||
client methods. In such case you should refactor it, or use
|
||||
This change should not cause any breaking change unless you were mocking the
|
||||
client methods. In such case you should refactor it, or use
|
||||
https://github.com/elastic/elasticsearch-js-mock[elasticsearch-js-mock].
|
||||
|
||||
Finally, this change should also fix once and of all the bundlers support.
|
||||
@ -231,15 +284,15 @@ Finally, this change should also fix once and of all the bundlers support.
|
||||
[discrete]
|
||||
===== Throw all errors asynchronously https://github.com/elastic/elasticsearch-js/pull/1295[#1295]
|
||||
|
||||
Some validation errors were thrown synchronously, causing the callback to be
|
||||
called in th same tick. This issue is known as _"The release fo Zalgo"_ (see
|
||||
Some validation errors were thrown synchronously, causing the callback to be
|
||||
called in th same tick. This issue is known as _"The release fo Zalgo"_ (see
|
||||
https://blog.izs.me/2013/08/designing-apis-for-asynchrony[here]).
|
||||
|
||||
[discrete]
|
||||
===== Fix `maxRetries` request option handling https://github.com/elastic/elasticsearch-js/pull/1296[#1296]
|
||||
|
||||
The `maxRetries` parameter can be configured on a per requets basis, if set to
|
||||
zero it was defaulting to the client default. Now the client is honoring the
|
||||
The `maxRetries` parameter can be configured on a per requets basis, if set to
|
||||
zero it was defaulting to the client default. Now the client is honoring the
|
||||
request specific configuration.
|
||||
|
||||
[discrete]
|
||||
@ -250,7 +303,7 @@ The Connection requets option types were not accepting `null` as valid value.
|
||||
[discrete]
|
||||
===== Fixed `size` and `maxRetries` parameters in helpers https://github.com/elastic/elasticsearch-js/pull/1284[#1284]
|
||||
|
||||
The `size` parameter was being passed too the scroll request, which was causing
|
||||
The `size` parameter was being passed too the scroll request, which was causing
|
||||
an error. Value of `maxRetries` set to 0 was resulting in no request at all.
|
||||
|
||||
[discrete]
|
||||
@ -276,8 +329,8 @@ const client = new Client({
|
||||
[discrete]
|
||||
===== Add support for a global context option https://github.com/elastic/elasticsearch-js/pull/1256[#1256]
|
||||
|
||||
Before this, you could set a `context` option in each request, but there was no
|
||||
way of setting it globally. Now you can by configuring the `context` object in
|
||||
Before this, you could set a `context` option in each request, but there was no
|
||||
way of setting it globally. Now you can by configuring the `context` object in
|
||||
the global configuration, that will be merged with the local one.
|
||||
|
||||
[source,js]
|
||||
@ -305,7 +358,7 @@ import { Client } from '@elastic/elasticsearch'
|
||||
[discrete]
|
||||
===== Allow the client name to be a symbol https://github.com/elastic/elasticsearch-js/pull/1254[#1254]
|
||||
|
||||
It was possible in plain JavaScript, but not in TypeScript, now you can do it in
|
||||
It was possible in plain JavaScript, but not in TypeScript, now you can do it in
|
||||
TypeScript as well.
|
||||
|
||||
[source,js]
|
||||
@ -325,17 +378,17 @@ Only `Record<string, any>` was allowed. Now `string` is allowed as well.
|
||||
[discrete]
|
||||
===== Fixed type definitions https://github.com/elastic/elasticsearch-js/pull/1263[#1263]
|
||||
|
||||
* The `transport.request` defintion was incorrect, it was returning a
|
||||
* The `transport.request` defintion was incorrect, it was returning a
|
||||
`Promise<T>` instead of `TransportRequestPromise<T>`.
|
||||
* The `refresh` parameter of most APIs was declared as
|
||||
`'true' | 'false' | 'wait_for'`, which was clunky. Now is
|
||||
* The `refresh` parameter of most APIs was declared as
|
||||
`'true' | 'false' | 'wait_for'`, which was clunky. Now is
|
||||
`'wait_for' | boolean`.
|
||||
|
||||
[discrete]
|
||||
===== Generate response type as boolean if the request is HEAD only https://github.com/elastic/elasticsearch-js/pull/1275[#1275]
|
||||
|
||||
All HEAD request will have the body casted to a boolean value, `true` in case of
|
||||
a 200 response, `false` in case of a 404 response. The type definitions were not
|
||||
All HEAD request will have the body casted to a boolean value, `true` in case of
|
||||
a 200 response, `false` in case of a 404 response. The type definitions were not
|
||||
reflecting this behavior.
|
||||
|
||||
[source,ts]
|
||||
@ -355,10 +408,10 @@ console.log(body) // either `true` or `false`
|
||||
[discrete]
|
||||
===== Updated default http agent configuration https://github.com/elastic/elasticsearch-js/pull/1242[#1242]
|
||||
|
||||
Added the scheduling: 'lifo' option to the default HTTP agent configuration to
|
||||
avoid maximizing the open sockets against {es} and lowering the risk of
|
||||
encountering socket timeouts. This feature is only available from Node v14.5+,
|
||||
but it should be backported to v10 and v12
|
||||
Added the scheduling: 'lifo' option to the default HTTP agent configuration to
|
||||
avoid maximizing the open sockets against {es} and lowering the risk of
|
||||
encountering socket timeouts. This feature is only available from Node v14.5+,
|
||||
but it should be backported to v10 and v12
|
||||
(https://github.com/nodejs/node/pull/33278[nodejs/node#33278]).
|
||||
|
||||
[discrete]
|
||||
@ -366,12 +419,12 @@ but it should be backported to v10 and v12
|
||||
|
||||
This pr introduce two changes which should not impact the surface API:
|
||||
|
||||
* Refactored the `client.child` API to allocate fewer objects, this change
|
||||
improves memory consumption over time and improves the child creation
|
||||
* Refactored the `client.child` API to allocate fewer objects, this change
|
||||
improves memory consumption over time and improves the child creation
|
||||
performances by ~12%.
|
||||
* The client no longer inherits from the EventEmitter class, but instead has an
|
||||
internal event emitter and exposes only the API useful for the users, namely
|
||||
`emit, `on`, `once`, and `off`. The type definitions have been updated
|
||||
* The client no longer inherits from the EventEmitter class, but instead has an
|
||||
internal event emitter and exposes only the API useful for the users, namely
|
||||
`emit, `on`, `once`, and `off`. The type definitions have been updated
|
||||
accordingly.
|
||||
|
||||
[discrete]
|
||||
@ -388,10 +441,10 @@ You can find all the API changes https://www.elastic.co/guide/en/elasticsearch/r
|
||||
[discrete]
|
||||
===== Added multi search helper https://github.com/elastic/elasticsearch-js/pull/1186[#1186]
|
||||
|
||||
If you are sending search request at a high rate, this helper might be useful
|
||||
for you. It will use the mutli search API under the hood to batch the requests
|
||||
and improve the overall performances of your application. The `result` exposes a
|
||||
`documents` property as well, which allows you to access directly the hits
|
||||
If you are sending search request at a high rate, this helper might be useful
|
||||
for you. It will use the mutli search API under the hood to batch the requests
|
||||
and improve the overall performances of your application. The `result` exposes a
|
||||
`documents` property as well, which allows you to access directly the hits
|
||||
sources.
|
||||
|
||||
[source,js]
|
||||
@ -423,10 +476,10 @@ m.search(
|
||||
[discrete]
|
||||
===== Added timeout support in bulk and msearch helpers https://github.com/elastic/elasticsearch-js/pull/1206[#1206]
|
||||
|
||||
If there is a slow producer, the bulk helper might send data with a very large
|
||||
period of time, and if the process crashes for any reason, the data would be
|
||||
lost. This pr introduces a `flushInterval` option in the bulk helper to avoid
|
||||
this issue. By default, the bulk helper will flush the data automatically every
|
||||
If there is a slow producer, the bulk helper might send data with a very large
|
||||
period of time, and if the process crashes for any reason, the data would be
|
||||
lost. This pr introduces a `flushInterval` option in the bulk helper to avoid
|
||||
this issue. By default, the bulk helper will flush the data automatically every
|
||||
30 seconds, unless the threshold has been reached before.
|
||||
|
||||
[source,js]
|
||||
@ -436,8 +489,8 @@ const b = client.helpers.bulk({
|
||||
})
|
||||
----
|
||||
|
||||
The same problem might happen with the multi search helper, where the user is
|
||||
not sending search requests fast enough. A `flushInterval` options has been
|
||||
The same problem might happen with the multi search helper, where the user is
|
||||
not sending search requests fast enough. A `flushInterval` options has been
|
||||
added as well, with a default value of 500 milliseconds.
|
||||
|
||||
[source,js]
|
||||
@ -453,16 +506,16 @@ const m = client.helpers.msearch({
|
||||
[discrete]
|
||||
===== Use filter_path for improving the search helpers performances https://github.com/elastic/elasticsearch-js/pull/1199[#1199]
|
||||
|
||||
From now on, all he search helpers will use the `filter_path` option
|
||||
automatically when needed to retrieve only the hits source. This change will
|
||||
From now on, all he search helpers will use the `filter_path` option
|
||||
automatically when needed to retrieve only the hits source. This change will
|
||||
result in less netwprk traffic and improved deserialization performances.
|
||||
|
||||
[discrete]
|
||||
===== Search helpers documents getter https://github.com/elastic/elasticsearch-js/pull/1186[#1186]
|
||||
|
||||
Before this, the `documents` key that you can access in any search helper was
|
||||
computed as soon as we got the search result from Elasticsearch. With this
|
||||
change the `documents` key is now a getter, which makes this process lazy,
|
||||
Before this, the `documents` key that you can access in any search helper was
|
||||
computed as soon as we got the search result from Elasticsearch. With this
|
||||
change the `documents` key is now a getter, which makes this process lazy,
|
||||
resulting in better performances and lower memory impact.
|
||||
|
||||
[discrete]
|
||||
@ -474,8 +527,8 @@ resulting in better performances and lower memory impact.
|
||||
[discrete]
|
||||
===== Disable client Helpers in Node.js < 10 - https://github.com/elastic/elasticsearch-js/pull/1194[#1194]
|
||||
|
||||
The client helpers can't be used in Node.js < 10 because it needs a custom flag
|
||||
to be able to use them. Given that not every provider allows the user to specify
|
||||
The client helpers can't be used in Node.js < 10 because it needs a custom flag
|
||||
to be able to use them. Given that not every provider allows the user to specify
|
||||
custom Node.js flags, the Helpers has been disabled completely in Node.js < 10.
|
||||
|
||||
[discrete]
|
||||
@ -493,16 +546,16 @@ will be no conflicts in case of the same header with different casing.
|
||||
[discrete]
|
||||
===== Support for Elasticsearch `v7.7`.
|
||||
|
||||
You can find all the API changes
|
||||
You can find all the API changes
|
||||
https://www.elastic.co/guide/en/elasticsearch/reference/7.7/release-notes-7.7.0.html[here].
|
||||
|
||||
[discrete]
|
||||
===== Introduced client helpers - https://github.com/elastic/elasticsearch-js/pull/1107[#1107]
|
||||
|
||||
From now on, the client comes with an handy collection of helpers to give you a
|
||||
From now on, the client comes with an handy collection of helpers to give you a
|
||||
more comfortable experience with some APIs.
|
||||
|
||||
CAUTION: The client helpers are experimental, and the API may change in the next
|
||||
CAUTION: The client helpers are experimental, and the API may change in the next
|
||||
minor releases.
|
||||
|
||||
The following helpers has been introduced:
|
||||
@ -515,16 +568,16 @@ The following helpers has been introduced:
|
||||
[discrete]
|
||||
===== The `ConnectionPool.getConnection` now always returns a `Connection` - https://github.com/elastic/elasticsearch-js/pull/1127[#1127]
|
||||
|
||||
What does this mean? It means that you will see less `NoLivingConnectionError`,
|
||||
which now can only be caused if you set a selector/filter too strict. For
|
||||
improving the debugging experience, the `NoLivingConnectionsError` error message
|
||||
What does this mean? It means that you will see less `NoLivingConnectionError`,
|
||||
which now can only be caused if you set a selector/filter too strict. For
|
||||
improving the debugging experience, the `NoLivingConnectionsError` error message
|
||||
has been updated.
|
||||
|
||||
[discrete]
|
||||
===== Abortable promises - https://github.com/elastic/elasticsearch-js/pull/1141[#1141]
|
||||
|
||||
From now on, it will be possible to abort a request generated with the
|
||||
promise-styl API. If you abort a request generated from a promise, the promise
|
||||
From now on, it will be possible to abort a request generated with the
|
||||
promise-styl API. If you abort a request generated from a promise, the promise
|
||||
will be rejected with a `RequestAbortedError`.
|
||||
|
||||
|
||||
@ -546,8 +599,8 @@ promise.abort()
|
||||
[discrete]
|
||||
===== Major refactor of the Type Definitions - https://github.com/elastic/elasticsearch-js/pull/1119[#1119] https://github.com/elastic/elasticsearch-js/issues/1130[#1130] https://github.com/elastic/elasticsearch-js/pull/1132[#1132]
|
||||
|
||||
Now every API makes better use of the generics and overloading, so you can (or
|
||||
not, by default request/response bodies are `Record<string, any>`) define the
|
||||
Now every API makes better use of the generics and overloading, so you can (or
|
||||
not, by default request/response bodies are `Record<string, any>`) define the
|
||||
request/response bodies in the generics.
|
||||
|
||||
[source,ts]
|
||||
@ -560,10 +613,10 @@ client.search<SearchResponse>(...)
|
||||
client.search<SearchResponse, SearchBody>(...)
|
||||
----
|
||||
|
||||
This *should* not be a breaking change, as every generics defaults to `any`. It
|
||||
might happen to some users that the code breaks, but our test didn't detect any
|
||||
of it, probably because they were not robust enough. However, given the gigantic
|
||||
improvement in the developer experience, we have decided to release this change
|
||||
This *should* not be a breaking change, as every generics defaults to `any`. It
|
||||
might happen to some users that the code breaks, but our test didn't detect any
|
||||
of it, probably because they were not robust enough. However, given the gigantic
|
||||
improvement in the developer experience, we have decided to release this change
|
||||
in the 7.x line.
|
||||
|
||||
[discrete]
|
||||
@ -572,35 +625,35 @@ in the 7.x line.
|
||||
[discrete]
|
||||
===== The `ConnectionPool.update` method now cleans the `dead` list - https://github.com/elastic/elasticsearch-js/issues/1122[#1122] https://github.com/elastic/elasticsearch-js/pull/1127[#1127]
|
||||
|
||||
It can happen in a situation where we are updating the connections list and
|
||||
running sniff, leaving the `dead` list in a dirty state. Now the
|
||||
`ConnectionPool.update` cleans up the `dead` list every time, which makes way
|
||||
It can happen in a situation where we are updating the connections list and
|
||||
running sniff, leaving the `dead` list in a dirty state. Now the
|
||||
`ConnectionPool.update` cleans up the `dead` list every time, which makes way
|
||||
more sense given that all the new connections are alive.
|
||||
|
||||
[discrete]
|
||||
===== `ConnectionPoolmarkDead` should ignore connections that no longer exists - https://github.com/elastic/elasticsearch-js/pull/1159[#1159]
|
||||
|
||||
It might happen that markDead is called just after a pool update, and in such
|
||||
case, the client was adding the dead list a node that no longer exists, causing
|
||||
It might happen that markDead is called just after a pool update, and in such
|
||||
case, the client was adding the dead list a node that no longer exists, causing
|
||||
unhandled exceptions later.
|
||||
|
||||
[discrete]
|
||||
===== Do not retry a request if the body is a stream - https://github.com/elastic/elasticsearch-js/pull/1143[#1143]
|
||||
|
||||
The client should not retry if it's sending a stream body, because it should
|
||||
store in memory a copy of the stream to be able to send it again, but since it
|
||||
doesn't know in advance the size of the stream, it risks to take too much
|
||||
memory. Furthermore, copying everytime the stream is very an expensive
|
||||
The client should not retry if it's sending a stream body, because it should
|
||||
store in memory a copy of the stream to be able to send it again, but since it
|
||||
doesn't know in advance the size of the stream, it risks to take too much
|
||||
memory. Furthermore, copying everytime the stream is very an expensive
|
||||
operation.
|
||||
|
||||
[discrete]
|
||||
===== Return an error if the request has been aborted - https://github.com/elastic/elasticsearch-js/pull/1141[#1141]
|
||||
|
||||
Until now, aborting a request was blocking the HTTP request, but never calling
|
||||
the callback or resolving the promise to notify the user. This is a bug because
|
||||
it could lead to dangerous memory leaks. From now on if the user calls the
|
||||
`request.abort()` method, the callback style API will be called with a
|
||||
`RequestAbortedError`, the promise will be rejected with `RequestAbortedError`
|
||||
Until now, aborting a request was blocking the HTTP request, but never calling
|
||||
the callback or resolving the promise to notify the user. This is a bug because
|
||||
it could lead to dangerous memory leaks. From now on if the user calls the
|
||||
`request.abort()` method, the callback style API will be called with a
|
||||
`RequestAbortedError`, the promise will be rejected with `RequestAbortedError`
|
||||
as well.
|
||||
|
||||
[discrete]
|
||||
@ -608,14 +661,14 @@ as well.
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Secure json parsing -
|
||||
- Secure json parsing -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1110[#1110]
|
||||
- ApiKey should take precedence over basic auth -
|
||||
- ApiKey should take precedence over basic auth -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1115[#1115]
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- Fix typo in api reference -
|
||||
- Fix typo in api reference -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1109[#1109]
|
||||
|
||||
[discrete]
|
||||
@ -628,22 +681,22 @@ Support for Elasticsearch `v7.6`.
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Skip compression in case of empty string body -
|
||||
- Skip compression in case of empty string body -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1080[#1080]
|
||||
- Fix typo in NoLivingConnectionsError -
|
||||
- Fix typo in NoLivingConnectionsError -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1045[#1045]
|
||||
- Change TransportRequestOptions.ignore to number[] -
|
||||
- Change TransportRequestOptions.ignore to number[] -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1053[#1053]
|
||||
- ClientOptions["cloud"] should have optional auth fields -
|
||||
- ClientOptions["cloud"] should have optional auth fields -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1032[#1032]
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- Docs: Return super in example Transport subclass -
|
||||
- Docs: Return super in example Transport subclass -
|
||||
https://github.com/elastic/elasticsearch-js/pull/980[#980]
|
||||
- Add examples to reference -
|
||||
- Add examples to reference -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1076[#1076]
|
||||
- Added new examples -
|
||||
- Added new examples -
|
||||
https://github.com/elastic/elasticsearch-js/pull/1031[#1031]
|
||||
|
||||
[discrete]
|
||||
@ -662,21 +715,21 @@ Support for Elasticsearch `v7.4`.
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Fix issue; node roles are defaulting to true when undefined is breaking usage
|
||||
of nodeFilter option -
|
||||
- Fix issue; node roles are defaulting to true when undefined is breaking usage
|
||||
of nodeFilter option -
|
||||
https://github.com/elastic/elasticsearch-js/pull/967[#967]
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- Updated API reference doc -
|
||||
https://github.com/elastic/elasticsearch-js/pull/945[#945],
|
||||
- Updated API reference doc -
|
||||
https://github.com/elastic/elasticsearch-js/pull/945[#945],
|
||||
https://github.com/elastic/elasticsearch-js/pull/969[#969]
|
||||
- Fix inaccurate description sniffEndpoint -
|
||||
- Fix inaccurate description sniffEndpoint -
|
||||
https://github.com/elastic/elasticsearch-js/pull/959[#959]
|
||||
|
||||
**Internals:**
|
||||
|
||||
- Update code generation
|
||||
- Update code generation
|
||||
https://github.com/elastic/elasticsearch-js/pull/969[#969]
|
||||
|
||||
[discrete]
|
||||
@ -686,26 +739,26 @@ Support for Elasticsearch `v7.3`.
|
||||
|
||||
**Features:**
|
||||
|
||||
- Added `auth` option -
|
||||
- Added `auth` option -
|
||||
https://github.com/elastic/elasticsearch-js/pull/908[#908]
|
||||
- Added support for `ApiKey` authentication -
|
||||
- Added support for `ApiKey` authentication -
|
||||
https://github.com/elastic/elasticsearch-js/pull/908[#908]
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- fix(Typings): sniffInterval can also be boolean -
|
||||
- fix(Typings): sniffInterval can also be boolean -
|
||||
https://github.com/elastic/elasticsearch-js/pull/914[#914]
|
||||
|
||||
**Internals:**
|
||||
|
||||
- Refactored connection pool -
|
||||
- Refactored connection pool -
|
||||
https://github.com/elastic/elasticsearch-js/pull/913[#913]
|
||||
|
||||
**Documentation:**
|
||||
|
||||
- Better reference code examples -
|
||||
- Better reference code examples -
|
||||
https://github.com/elastic/elasticsearch-js/pull/920[#920]
|
||||
- Improve README -
|
||||
- Improve README -
|
||||
https://github.com/elastic/elasticsearch-js/pull/909[#909]
|
||||
|
||||
[discrete]
|
||||
@ -715,7 +768,7 @@ Support for Elasticsearch `v7.2`
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Remove auth data from inspect and toJSON in connection class -
|
||||
- Remove auth data from inspect and toJSON in connection class -
|
||||
https://github.com/elastic/elasticsearch-js/pull/887[#887]
|
||||
|
||||
[discrete]
|
||||
@ -725,9 +778,9 @@ Support for Elasticsearch `v7.1`
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Support for non-friendly chars in url username and password -
|
||||
- Support for non-friendly chars in url username and password -
|
||||
https://github.com/elastic/elasticsearch-js/pull/858[#858]
|
||||
- Patch deprecated parameters -
|
||||
- Patch deprecated parameters -
|
||||
https://github.com/elastic/elasticsearch-js/pull/851[#851]
|
||||
|
||||
[discrete]
|
||||
@ -735,17 +788,17 @@ Support for Elasticsearch `v7.1`
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Fix TypeScript export *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/841[#841])* -
|
||||
- Fix TypeScript export *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/841[#841])* -
|
||||
https://github.com/elastic/elasticsearch-js/pull/842[#842]
|
||||
- Fix http and https port handling *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/843[#843])* -
|
||||
- Fix http and https port handling *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/843[#843])* -
|
||||
https://github.com/elastic/elasticsearch-js/pull/845[#845]
|
||||
- Fix TypeScript definiton *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/803[#803])* -
|
||||
- Fix TypeScript definiton *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/803[#803])* -
|
||||
https://github.com/elastic/elasticsearch-js/pull/846[#846]
|
||||
- Added toJSON method to Connection class *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/848[#848])* -
|
||||
- Added toJSON method to Connection class *(issue
|
||||
https://github.com/elastic/elasticsearch-js/pull/848[#848])* -
|
||||
https://github.com/elastic/elasticsearch-js/pull/849[#849]
|
||||
|
||||
[discrete]
|
||||
|
||||
@ -10,6 +10,7 @@ This page contains the information you need to connect and use the Client with
|
||||
* <<client-usage, Using the client>>
|
||||
* <<client-connect-proxy, Connecting through a proxy>>
|
||||
* <<client-error-handling, Handling errors>>
|
||||
* <<product-check, Automatic product check>>
|
||||
|
||||
[discrete]
|
||||
[[authentication]]
|
||||
@ -93,6 +94,26 @@ const client = new Client({
|
||||
})
|
||||
----
|
||||
|
||||
[discrete]
|
||||
[[auth-bearer]]
|
||||
==== Bearer authentication
|
||||
|
||||
You can provide your credentials by passing the `bearer` token
|
||||
parameter via the `auth` option.
|
||||
Useful for https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html[service account tokens].
|
||||
Be aware that it does not handle automatic token refresh.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
const client = new Client({
|
||||
node: 'https://localhost:9200',
|
||||
auth: {
|
||||
bearer: 'token'
|
||||
}
|
||||
})
|
||||
----
|
||||
|
||||
|
||||
[discrete]
|
||||
[[auth-basic]]
|
||||
@ -156,6 +177,29 @@ const client = new Client({
|
||||
})
|
||||
----
|
||||
|
||||
[discrete]
|
||||
[[auth-ca-fingerprint]]
|
||||
==== CA fingerprint
|
||||
|
||||
You can configure the client to only trust certificates that are signed by a specific CA certificate ( CA certificate pinning ) by providing a `caFingerprint` option. This will verify that the fingerprint of the CA certificate that has signed the certificate of the server matches the supplied value.
|
||||
a `caFingerprint` option, which will verify the supplied certificate authority fingerprint.
|
||||
You must configure a SHA256 digest.
|
||||
|
||||
[source,js]
|
||||
----
|
||||
const { Client } = require('@elastic/elasticsearch')
|
||||
const client = new Client({
|
||||
node: 'https://example.com'
|
||||
auth: { ... },
|
||||
// the fingerprint (SHA256) of the CA certificate that is used to sign the certificate that the Elasticsearch node presents for TLS.
|
||||
caFingerprint: '20:0D:CA:FA:76:...',
|
||||
ssl: {
|
||||
// might be required if it's a self-signed certificate
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
})
|
||||
----
|
||||
|
||||
[discrete]
|
||||
[[client-usage]]
|
||||
=== Usage
|
||||
@ -497,3 +541,15 @@ a|* `name` - `string`
|
||||
* `statusCode` - `object`, the response headers
|
||||
* `headers` - `object`, the response status code
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
[[product-check]]
|
||||
=== Automatic product check
|
||||
|
||||
Since v7.14.0, the client performs a required product check before the first call.
|
||||
This pre-flight product check allows the client to establish the version of Elasticsearch
|
||||
that it is communicating with. The product check requires one additional HTTP request to
|
||||
be sent to the server as part of the request pipeline before the main API call is sent.
|
||||
In most cases, this will succeed during the very first API call that the client sends.
|
||||
Once the product check completes, no further product check HTTP requests are sent for
|
||||
subsequent API calls.
|
||||
|
||||
@ -17,7 +17,7 @@ To install a specific major version of the client, run the following command:
|
||||
npm install @elastic/elasticsearch@<major>
|
||||
----
|
||||
|
||||
To learn more about the supported major versions, please refer to the
|
||||
To learn more about the supported major versions, please refer to the
|
||||
<<js-compatibility-matrix>>.
|
||||
|
||||
[discrete]
|
||||
@ -37,7 +37,7 @@ to support that version for at least another minor release. If you are using the
|
||||
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,
|
||||
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
|
||||
@ -62,9 +62,12 @@ of `^7.10.0`).
|
||||
[[js-compatibility-matrix]]
|
||||
=== Compatibility matrix
|
||||
|
||||
The library is compatible with all {es} versions since 5.x. We recommend you to
|
||||
use the same major version of the client as the {es} instance that you are
|
||||
using.
|
||||
Elastic language clients are guaranteed to be able to communicate with Elasticsearch
|
||||
or Elastic solutions running on the same major version and greater or equal minor version.
|
||||
|
||||
Language clients are forward compatible; meaning that clients support communicating
|
||||
with greater minor versions of Elasticsearch. Elastic language clients are not
|
||||
guaranteed to be backwards compatible.
|
||||
|
||||
[%header,cols=2*]
|
||||
|===
|
||||
@ -91,4 +94,4 @@ using.
|
||||
WARNING: There is no official support for the browser environment. It exposes
|
||||
your {es} instance to everyone, which could lead to security issues. We
|
||||
recommend you to write a lightweight proxy that uses this client instead,
|
||||
you can see a proxy example https://github.com/elastic/elasticsearch-js/tree/master/docs/examples/proxy[here].
|
||||
you can see a proxy example https://github.com/elastic/elasticsearch-js/tree/master/docs/examples/proxy[here].
|
||||
|
||||
@ -1969,7 +1969,7 @@ link:{ref}/cluster-allocation-explain.html[Documentation] +
|
||||
|`boolean` - Return information about disk usage and shard sizes (default: false)
|
||||
|
||||
|`body`
|
||||
|`object` - The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'
|
||||
|`object` - The index, shard, and primary flag to explain. Empty means 'explain a randomly-chosen unassigned shard'
|
||||
|
||||
|===
|
||||
|
||||
@ -3648,6 +3648,27 @@ client.ilm.getStatus()
|
||||
link:{ref}/ilm-get-status.html[Documentation] +
|
||||
|
||||
|
||||
[discrete]
|
||||
=== ilm.migrateToDataTiers
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.ilm.migrateToDataTiers({
|
||||
dry_run: boolean,
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/ilm-migrate-to-data-tiers.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`dry_run` or `dryRun`
|
||||
|`boolean` - If set to true it will simulate the migration, providing a way to retrieve the ILM policies and indices that need to be migrated. The default is false
|
||||
|
||||
|`body`
|
||||
|`object` - Optionally specify a legacy index template name to delete and optionally specify a node attribute name used for index shard routing (defaults to "data")
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== ilm.moveToStep
|
||||
|
||||
@ -4111,8 +4132,8 @@ link:{ref}/indices-delete-index.html[Documentation] +
|
||||
|`boolean` - Ignore if a wildcard expression resolves to no concrete indices (default: false)
|
||||
|
||||
|`expand_wildcards` or `expandWildcards`
|
||||
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether wildcard expressions should get expanded to open or closed indices (default: open) +
|
||||
_Default:_ `open`
|
||||
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether wildcard expressions should get expanded to open, closed, or hidden indices +
|
||||
_Default:_ `open,closed`
|
||||
|
||||
|===
|
||||
|
||||
@ -4217,6 +4238,44 @@ link:{ref}/indices-templates.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== indices.diskUsage
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.diskUsage({
|
||||
index: string,
|
||||
run_expensive_tasks: boolean,
|
||||
flush: boolean,
|
||||
ignore_unavailable: boolean,
|
||||
allow_no_indices: boolean,
|
||||
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all'
|
||||
})
|
||||
----
|
||||
link:{ref}/indices-disk-usage.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`index`
|
||||
|`string` - Comma-separated list of indices or data streams to analyze the disk usage
|
||||
|
||||
|`run_expensive_tasks` or `runExpensiveTasks`
|
||||
|`boolean` - Must be set to [true] in order for the task to be performed. Defaults to false.
|
||||
|
||||
|`flush`
|
||||
|`boolean` - Whether flush or not before analyzing the index disk usage. Defaults to true
|
||||
|
||||
|`ignore_unavailable` or `ignoreUnavailable`
|
||||
|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
|
||||
|`allow_no_indices` or `allowNoIndices`
|
||||
|`boolean` - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
|
||||
|`expand_wildcards` or `expandWildcards`
|
||||
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. +
|
||||
_Default:_ `open`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== indices.exists
|
||||
|
||||
@ -4393,6 +4452,40 @@ _Default:_ `open`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== indices.fieldUsageStats
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.indices.fieldUsageStats({
|
||||
index: string,
|
||||
fields: string | string[],
|
||||
ignore_unavailable: boolean,
|
||||
allow_no_indices: boolean,
|
||||
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all'
|
||||
})
|
||||
----
|
||||
link:{ref}/field-usage-stats.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`index`
|
||||
|`string` - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices
|
||||
|
||||
|`fields`
|
||||
|`string \| string[]` - A comma-separated list of fields to include in the stats if only a subset of fields should be returned (supports wildcards)
|
||||
|
||||
|`ignore_unavailable` or `ignoreUnavailable`
|
||||
|`boolean` - Whether specified concrete indices should be ignored when unavailable (missing or closed)
|
||||
|
||||
|`allow_no_indices` or `allowNoIndices`
|
||||
|`boolean` - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)
|
||||
|
||||
|`expand_wildcards` or `expandWildcards`
|
||||
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether to expand wildcard expression to concrete indices that are open, closed or both. +
|
||||
_Default:_ `open`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== indices.flush
|
||||
|
||||
@ -7595,6 +7688,10 @@ link:{ref}/ml-put-filter.html[Documentation] +
|
||||
----
|
||||
client.ml.putJob({
|
||||
job_id: string,
|
||||
ignore_unavailable: boolean,
|
||||
allow_no_indices: boolean,
|
||||
ignore_throttled: boolean,
|
||||
expand_wildcards: 'open' | 'closed' | 'hidden' | 'none' | 'all',
|
||||
body: object
|
||||
})
|
||||
----
|
||||
@ -7604,6 +7701,18 @@ link:{ref}/ml-put-job.html[Documentation] +
|
||||
|`job_id` or `jobId`
|
||||
|`string` - The ID of the job to create
|
||||
|
||||
|`ignore_unavailable` or `ignoreUnavailable`
|
||||
|`boolean` - Ignore unavailable indexes (default: false). Only set if datafeed_config is provided.
|
||||
|
||||
|`allow_no_indices` or `allowNoIndices`
|
||||
|`boolean` - Ignore if the source indices expressions resolves to no concrete indices (default: true). Only set if datafeed_config is provided.
|
||||
|
||||
|`ignore_throttled` or `ignoreThrottled`
|
||||
|`boolean` - Ignore indices that are marked as throttled (default: true). Only set if datafeed_config is provided.
|
||||
|
||||
|`expand_wildcards` or `expandWildcards`
|
||||
|`'open' \| 'closed' \| 'hidden' \| 'none' \| 'all'` - Whether source index expressions should get expanded to open or closed indices (default: open). Only set if datafeed_config is provided.
|
||||
|
||||
|`body`
|
||||
|`object` - The job
|
||||
|
||||
@ -7655,6 +7764,28 @@ link:{ref}/put-trained-models-aliases.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== ml.resetJob
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.ml.resetJob({
|
||||
job_id: string,
|
||||
wait_for_completion: boolean
|
||||
})
|
||||
----
|
||||
link:{ref}/ml-reset-job.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`job_id` or `jobId`
|
||||
|`string` - The ID of the job to reset
|
||||
|
||||
|`wait_for_completion` or `waitForCompletion`
|
||||
|`boolean` - Should this request wait until the operation has completed before returning +
|
||||
_Default:_ `true`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== ml.revertModelSnapshot
|
||||
|
||||
@ -8237,6 +8368,44 @@ _Default:_ `true`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== nodes.clearRepositoriesMeteringArchive
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.nodes.clearRepositoriesMeteringArchive({
|
||||
node_id: string | string[],
|
||||
max_archive_version: number
|
||||
})
|
||||
----
|
||||
link:{ref}/clear-repositories-metering-archive-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`node_id` or `nodeId`
|
||||
|`string \| string[]` - Comma-separated list of node IDs or names used to limit returned information.
|
||||
|
||||
|`max_archive_version` or `maxArchiveVersion`
|
||||
|`number` - Specifies the maximum archive_version to be cleared from the archive.
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== nodes.getRepositoriesMeteringInfo
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.nodes.getRepositoriesMeteringInfo({
|
||||
node_id: string | string[]
|
||||
})
|
||||
----
|
||||
link:{ref}/get-repositories-metering-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`node_id` or `nodeId`
|
||||
|`string \| string[]` - A comma-separated list of node IDs or names to limit the returned information.
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== nodes.hotThreads
|
||||
|
||||
@ -8623,7 +8792,7 @@ client.renderSearchTemplate({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/search-template.html#_validating_templates[Documentation] +
|
||||
link:{ref}/render-search-template-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`id`
|
||||
@ -8725,7 +8894,7 @@ link:{ref}/rollup-put-job.html[Documentation] +
|
||||
|
||||
[discrete]
|
||||
=== rollup.rollup
|
||||
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.rollup.rollup({
|
||||
@ -8734,7 +8903,7 @@ client.rollup.rollup({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/rollup-api.html[Documentation] +
|
||||
link:{ref}/xpack-rollup.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`index`
|
||||
@ -9079,6 +9248,67 @@ _Default:_ `5`
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== searchMvt
|
||||
*Stability:* experimental
|
||||
[source,ts]
|
||||
----
|
||||
client.searchMvt({
|
||||
index: string | string[],
|
||||
field: string,
|
||||
zoom: number,
|
||||
x: number,
|
||||
y: number,
|
||||
exact_bounds: boolean,
|
||||
extent: number,
|
||||
grid_precision: number,
|
||||
grid_type: 'grid' | 'point',
|
||||
size: number,
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/search-vector-tile-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`index`
|
||||
|`string \| string[]` - Comma-separated list of data streams, indices, or aliases to search
|
||||
|
||||
|`field`
|
||||
|`string` - Field containing geospatial data to return
|
||||
|
||||
|`zoom`
|
||||
|`number` - Zoom level for the vector tile to search
|
||||
|
||||
|`x`
|
||||
|`number` - X coordinate for the vector tile to search
|
||||
|
||||
|`y`
|
||||
|`number` - Y coordinate for the vector tile to search
|
||||
|
||||
|`exact_bounds` or `exactBounds`
|
||||
|`boolean` - If false, the meta layer's feature is the bounding box of the tile. If true, the meta layer's feature is a bounding box resulting from a `geo_bounds` aggregation.
|
||||
|
||||
|`extent`
|
||||
|`number` - Size, in pixels, of a side of the vector tile. +
|
||||
_Default:_ `4096`
|
||||
|
||||
|`grid_precision` or `gridPrecision`
|
||||
|`number` - Additional zoom levels available through the aggs layer. Accepts 0-8. +
|
||||
_Default:_ `8`
|
||||
|
||||
|`grid_type` or `gridType`
|
||||
|`'grid' \| 'point'` - Determines the geometry type for features in the aggs layer. +
|
||||
_Default:_ `grid`
|
||||
|
||||
|`size`
|
||||
|`number` - Maximum number of features to return in the hits layer. Accepts 0-10000. +
|
||||
_Default:_ `10000`
|
||||
|
||||
|`body`
|
||||
|`object` - Search request body.
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== searchShards
|
||||
|
||||
@ -10020,6 +10250,125 @@ link:{ref}/security-api-put-user.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.queryApiKeys
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.queryApiKeys({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-query-api-key.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - From, size, query, sort and search_after
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlAuthenticate
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlAuthenticate({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-authenticate.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - The SAML response to authenticate
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlCompleteLogout
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlCompleteLogout({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-complete-logout.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - The logout response to verify
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlInvalidate
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlInvalidate({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-invalidate.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - The LogoutRequest message
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlLogout
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlLogout({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-logout.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - The tokens to invalidate
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlPrepareAuthentication
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlPrepareAuthentication({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-prepare-authentication.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|`object` - The realm for which to create the authentication request, identified by either its name or the ACS URL
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== security.samlServiceProviderMetadata
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.security.samlServiceProviderMetadata({
|
||||
realm_name: string
|
||||
})
|
||||
----
|
||||
link:{ref}/security-api-saml-sp-metadata.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`realm_name` or `realmName`
|
||||
|`string` - The name of the SAML realm to get the metadata for
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== shutdown.deleteNode
|
||||
*Stability:* experimental
|
||||
@ -10382,6 +10731,7 @@ client.snapshot.get({
|
||||
master_timeout: string,
|
||||
ignore_unavailable: boolean,
|
||||
index_details: boolean,
|
||||
include_repository: boolean,
|
||||
verbose: boolean
|
||||
})
|
||||
----
|
||||
@ -10403,6 +10753,9 @@ link:{ref}/modules-snapshots.html[Documentation] +
|
||||
|`index_details` or `indexDetails`
|
||||
|`boolean` - Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
|
||||
|
||||
|`include_repository` or `includeRepository`
|
||||
|`boolean` - Whether to include the repository name in the snapshot info. Defaults to true.
|
||||
|
||||
|`verbose`
|
||||
|`boolean` - Whether to show verbose snapshot info or only show the basic info found in the repository index blob
|
||||
|
||||
@ -10433,6 +10786,67 @@ link:{ref}/modules-snapshots.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== snapshot.repositoryAnalyze
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.snapshot.repositoryAnalyze({
|
||||
repository: string,
|
||||
blob_count: number,
|
||||
concurrency: number,
|
||||
read_node_count: number,
|
||||
early_read_node_count: number,
|
||||
seed: number,
|
||||
rare_action_probability: number,
|
||||
max_blob_size: string,
|
||||
max_total_data_size: string,
|
||||
timeout: string,
|
||||
detailed: boolean,
|
||||
rarely_abort_writes: boolean
|
||||
})
|
||||
----
|
||||
link:{ref}/modules-snapshots.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`repository`
|
||||
|`string` - A repository name
|
||||
|
||||
|`blob_count` or `blobCount`
|
||||
|`number` - Number of blobs to create during the test. Defaults to 100.
|
||||
|
||||
|`concurrency`
|
||||
|`number` - Number of operations to run concurrently during the test. Defaults to 10.
|
||||
|
||||
|`read_node_count` or `readNodeCount`
|
||||
|`number` - Number of nodes on which to read a blob after writing. Defaults to 10.
|
||||
|
||||
|`early_read_node_count` or `earlyReadNodeCount`
|
||||
|`number` - Number of nodes on which to perform an early read on a blob, i.e. before writing has completed. Early reads are rare actions so the 'rare_action_probability' parameter is also relevant. Defaults to 2.
|
||||
|
||||
|`seed`
|
||||
|`number` - Seed for the random number generator used to create the test workload. Defaults to a random value.
|
||||
|
||||
|`rare_action_probability` or `rareActionProbability`
|
||||
|`number` - Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02.
|
||||
|
||||
|`max_blob_size` or `maxBlobSize`
|
||||
|`string` - Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'.
|
||||
|
||||
|`max_total_data_size` or `maxTotalDataSize`
|
||||
|`string` - Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'.
|
||||
|
||||
|`timeout`
|
||||
|`string` - Explicit operation timeout. Defaults to '30s'.
|
||||
|
||||
|`detailed`
|
||||
|`boolean` - Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned.
|
||||
|
||||
|`rarely_abort_writes` or `rarelyAbortWrites`
|
||||
|`boolean` - Whether to rarely abort writes before they complete. Defaults to 'true'.
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== snapshot.restore
|
||||
|
||||
@ -10529,7 +10943,7 @@ client.sql.clearCursor({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/sql-pagination.html[Documentation] +
|
||||
link:{ref}/clear-sql-cursor-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
@ -10537,6 +10951,75 @@ link:{ref}/sql-pagination.html[Documentation] +
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== sql.deleteAsync
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.sql.deleteAsync({
|
||||
id: string
|
||||
})
|
||||
----
|
||||
link:{ref}/delete-async-sql-search-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`id`
|
||||
|`string` - The async search ID
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== sql.getAsync
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.sql.getAsync({
|
||||
id: string,
|
||||
delimiter: string,
|
||||
format: string,
|
||||
keep_alive: string,
|
||||
wait_for_completion_timeout: string
|
||||
})
|
||||
----
|
||||
link:{ref}/get-async-sql-search-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`id`
|
||||
|`string` - The async search ID
|
||||
|
||||
|`delimiter`
|
||||
|`string` - Separator for CSV results +
|
||||
_Default:_ `,`
|
||||
|
||||
|`format`
|
||||
|`string` - Short version of the Accept header, e.g. json, yaml
|
||||
|
||||
|`keep_alive` or `keepAlive`
|
||||
|`string` - Retention period for the search and its results +
|
||||
_Default:_ `5d`
|
||||
|
||||
|`wait_for_completion_timeout` or `waitForCompletionTimeout`
|
||||
|`string` - Duration to wait for complete results
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== sql.getAsyncStatus
|
||||
|
||||
[source,ts]
|
||||
----
|
||||
client.sql.getAsyncStatus({
|
||||
id: string
|
||||
})
|
||||
----
|
||||
link:{ref}/get-async-sql-search-status-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`id`
|
||||
|`string` - The async search ID
|
||||
|
||||
|===
|
||||
|
||||
[discrete]
|
||||
=== sql.query
|
||||
|
||||
@ -10547,7 +11030,7 @@ client.sql.query({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/sql-rest-overview.html[Documentation] +
|
||||
link:{ref}/sql-search-api.html[Documentation] +
|
||||
{jsclient}/sql_query_examples.html[Code Example] +
|
||||
[cols=2*]
|
||||
|===
|
||||
@ -10568,7 +11051,7 @@ client.sql.translate({
|
||||
body: object
|
||||
})
|
||||
----
|
||||
link:{ref}/sql-translate.html[Documentation] +
|
||||
link:{ref}/sql-translate-api.html[Documentation] +
|
||||
[cols=2*]
|
||||
|===
|
||||
|`body`
|
||||
|
||||
@ -32,3 +32,10 @@ class MyTransport extends Transport {
|
||||
}
|
||||
----
|
||||
|
||||
==== Supported content types
|
||||
|
||||
- `application/json`, in this case the transport will return a plain JavaScript object
|
||||
- `text/plain`, in this case the transport will return a plain string
|
||||
- `application/vnd.mapbox-vector-tile`, in this case the transport will return a Buffer
|
||||
- `application/vnd.elasticsearch+json`, in this case the transport will return a plain JavaScript object
|
||||
|
||||
|
||||
150
index.d.ts
vendored
150
index.d.ts
vendored
@ -43,7 +43,8 @@ import {
|
||||
CloudConnectionPool,
|
||||
ResurrectEvent,
|
||||
BasicAuth,
|
||||
ApiKeyAuth
|
||||
ApiKeyAuth,
|
||||
BearerAuth
|
||||
} from './lib/pool';
|
||||
import Serializer from './lib/Serializer';
|
||||
import Helpers from './lib/Helpers';
|
||||
@ -106,7 +107,7 @@ interface ClientOptions {
|
||||
opaqueIdPrefix?: string;
|
||||
generateRequestId?: generateRequestIdFn;
|
||||
name?: string | symbol;
|
||||
auth?: BasicAuth | ApiKeyAuth;
|
||||
auth?: BasicAuth | ApiKeyAuth | BearerAuth;
|
||||
context?: Context;
|
||||
proxy?: string | URL;
|
||||
enableMetaHeader?: boolean;
|
||||
@ -117,6 +118,7 @@ interface ClientOptions {
|
||||
password?: string;
|
||||
};
|
||||
disablePrototypePoisoningProtection?: boolean | 'proto' | 'constructor';
|
||||
caFingerprint?: string;
|
||||
}
|
||||
|
||||
declare class Client {
|
||||
@ -832,6 +834,14 @@ declare class Client {
|
||||
getStatus<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IlmGetStatus, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IlmGetStatus, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrate_to_data_tiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IlmMigrateToDataTiers<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
migrate_to_data_tiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrate_to_data_tiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IlmMigrateToDataTiers<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrate_to_data_tiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IlmMigrateToDataTiers<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IlmMigrateToDataTiers<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
migrateToDataTiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IlmMigrateToDataTiers<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
migrateToDataTiers<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IlmMigrateToDataTiers<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
move_to_step<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.IlmMoveToStep<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
move_to_step<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
move_to_step<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.IlmMoveToStep<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -958,6 +968,14 @@ declare class Client {
|
||||
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDeleteTemplate, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
deleteTemplate<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDeleteTemplate, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
disk_usage<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDiskUsage, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
disk_usage<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
disk_usage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDiskUsage, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
disk_usage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDiskUsage, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
diskUsage<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesDiskUsage, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
diskUsage<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
diskUsage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDiskUsage, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
diskUsage<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesDiskUsage, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
exists<TResponse = boolean, TContext = Context>(params?: RequestParams.IndicesExists, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
exists<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
exists<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExists, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -994,6 +1012,14 @@ declare class Client {
|
||||
existsType<TResponse = boolean, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
existsType<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
existsType<TResponse = boolean, TContext = Context>(params: RequestParams.IndicesExistsType, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
field_usage_stats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFieldUsageStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
field_usage_stats<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
field_usage_stats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFieldUsageStats, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
field_usage_stats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFieldUsageStats, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFieldUsageStats, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
fieldUsageStats<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFieldUsageStats, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
fieldUsageStats<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFieldUsageStats, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
flush<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.IndicesFlush, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
flush<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
flush<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.IndicesFlush, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -1760,6 +1786,14 @@ declare class Client {
|
||||
putTrainedModelAlias<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
putTrainedModelAlias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlPutTrainedModelAlias, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
putTrainedModelAlias<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlPutTrainedModelAlias, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
reset_job<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.MlResetJob, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
reset_job<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
reset_job<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlResetJob, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
reset_job<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlResetJob, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
resetJob<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.MlResetJob, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
resetJob<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
resetJob<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlResetJob, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
resetJob<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.MlResetJob, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
revert_model_snapshot<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.MlRevertModelSnapshot<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
revert_model_snapshot<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
revert_model_snapshot<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.MlRevertModelSnapshot<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -1892,6 +1926,22 @@ declare class Client {
|
||||
mtermvectors<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Mtermvectors<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
mtermvectors<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Mtermvectors<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
nodes: {
|
||||
clear_repositories_metering_archive<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesClearRepositoriesMeteringArchive, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
clear_repositories_metering_archive<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clear_repositories_metering_archive<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesClearRepositoriesMeteringArchive, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clear_repositories_metering_archive<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesClearRepositoriesMeteringArchive, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clearRepositoriesMeteringArchive<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesClearRepositoriesMeteringArchive, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
clearRepositoriesMeteringArchive<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clearRepositoriesMeteringArchive<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesClearRepositoriesMeteringArchive, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clearRepositoriesMeteringArchive<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesClearRepositoriesMeteringArchive, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_repositories_metering_info<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesGetRepositoriesMeteringInfo, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
get_repositories_metering_info<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_repositories_metering_info<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesGetRepositoriesMeteringInfo, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_repositories_metering_info<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesGetRepositoriesMeteringInfo, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getRepositoriesMeteringInfo<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesGetRepositoriesMeteringInfo, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
getRepositoriesMeteringInfo<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getRepositoriesMeteringInfo<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesGetRepositoriesMeteringInfo, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getRepositoriesMeteringInfo<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesGetRepositoriesMeteringInfo, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
hot_threads<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.NodesHotThreads, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
hot_threads<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
hot_threads<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.NodesHotThreads, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -2055,6 +2105,14 @@ declare class Client {
|
||||
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Search<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.Search<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search_mvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SearchMvt<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
search_mvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search_mvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SearchMvt<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search_mvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SearchMvt<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
searchMvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SearchMvt<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
searchMvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
searchMvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SearchMvt<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
searchMvt<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SearchMvt<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search_shards<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SearchShards, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
search_shards<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
search_shards<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SearchShards, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -2408,6 +2466,62 @@ declare class Client {
|
||||
putUser<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
putUser<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityPutUser<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
putUser<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityPutUser<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
query_api_keys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityQueryApiKeys<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
query_api_keys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
query_api_keys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityQueryApiKeys<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
query_api_keys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityQueryApiKeys<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
queryApiKeys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecurityQueryApiKeys<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
queryApiKeys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
queryApiKeys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityQueryApiKeys<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
queryApiKeys<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecurityQueryApiKeys<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_authenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlAuthenticate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_authenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_authenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlAuthenticate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_authenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlAuthenticate<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlAuthenticate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlAuthenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlAuthenticate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlAuthenticate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlAuthenticate<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_complete_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_complete_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_complete_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_complete_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlCompleteLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlCompleteLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlCompleteLogout<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_invalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlInvalidate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_invalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_invalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlInvalidate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_invalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlInvalidate<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlInvalidate<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlInvalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlInvalidate<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlInvalidate<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlInvalidate<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlLogout<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlLogout<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_logout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlLogout<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlLogout<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlLogout<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlLogout<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlLogout<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_prepare_authentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_prepare_authentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_prepare_authentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_prepare_authentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlPrepareAuthentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlPrepareAuthentication<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlPrepareAuthentication<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_service_provider_metadata<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlServiceProviderMetadata, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
saml_service_provider_metadata<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_service_provider_metadata<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlServiceProviderMetadata, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
saml_service_provider_metadata<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlServiceProviderMetadata, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SecuritySamlServiceProviderMetadata, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
samlServiceProviderMetadata<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlServiceProviderMetadata, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
samlServiceProviderMetadata<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SecuritySamlServiceProviderMetadata, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
}
|
||||
shutdown: {
|
||||
delete_node<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.ShutdownDeleteNode, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
@ -2550,6 +2664,14 @@ declare class Client {
|
||||
getRepository<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getRepository<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetRepository, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getRepository<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotGetRepository, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repository_analyze<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotRepositoryAnalyze, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
repository_analyze<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repository_analyze<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotRepositoryAnalyze, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repository_analyze<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotRepositoryAnalyze, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repositoryAnalyze<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotRepositoryAnalyze, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
repositoryAnalyze<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repositoryAnalyze<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotRepositoryAnalyze, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
repositoryAnalyze<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotRepositoryAnalyze, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
restore<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SnapshotRestore<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
restore<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
restore<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SnapshotRestore<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
@ -2576,6 +2698,30 @@ declare class Client {
|
||||
clearCursor<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clearCursor<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SqlClearCursor<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
clearCursor<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SqlClearCursor<TRequestBody>, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
delete_async<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlDeleteAsync, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
delete_async<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
delete_async<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlDeleteAsync, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
delete_async<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlDeleteAsync, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
deleteAsync<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlDeleteAsync, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
deleteAsync<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
deleteAsync<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlDeleteAsync, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
deleteAsync<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlDeleteAsync, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlGetAsync, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
get_async<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsync, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsync, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsync<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlGetAsync, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
getAsync<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsync<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsync, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsync<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsync, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async_status<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlGetAsyncStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
get_async_status<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async_status<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsyncStatus, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
get_async_status<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsyncStatus, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TResponse = Record<string, any>, TContext = Context>(params?: RequestParams.SqlGetAsyncStatus, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
getAsyncStatus<TResponse = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsyncStatus, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
getAsyncStatus<TResponse = Record<string, any>, TContext = Context>(params: RequestParams.SqlGetAsyncStatus, options: TransportRequestOptions, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
query<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params?: RequestParams.SqlQuery<TRequestBody>, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>
|
||||
query<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
query<TResponse = Record<string, any>, TRequestBody extends RequestBody = Record<string, any>, TContext = Context>(params: RequestParams.SqlQuery<TRequestBody>, callback: callbackFn<TResponse, TContext>): TransportRequestCallback
|
||||
|
||||
22
index.js
22
index.js
@ -102,6 +102,7 @@ class Client extends ESAPI {
|
||||
suggestCompression: false,
|
||||
compression: false,
|
||||
ssl: null,
|
||||
caFingerprint: null,
|
||||
agent: null,
|
||||
headers: {},
|
||||
nodeFilter: null,
|
||||
@ -116,6 +117,14 @@ class Client extends ESAPI {
|
||||
disablePrototypePoisoningProtection: false
|
||||
}, opts)
|
||||
|
||||
if (options.caFingerprint !== null && isHttpConnection(opts.node || opts.nodes)) {
|
||||
throw new ConfigurationError('You can\'t configure the caFingerprint with a http connection')
|
||||
}
|
||||
|
||||
if (process.env.ELASTIC_CLIENT_APIVERSIONING === 'true') {
|
||||
options.headers = Object.assign({ accept: 'application/vnd.elasticsearch+json; compatible-with=7' }, options.headers)
|
||||
}
|
||||
|
||||
this[kInitialOptions] = options
|
||||
this[kExtensions] = []
|
||||
this.name = options.name
|
||||
@ -142,6 +151,7 @@ class Client extends ESAPI {
|
||||
Connection: options.Connection,
|
||||
auth: options.auth,
|
||||
emit: this[kEventEmitter].emit.bind(this[kEventEmitter]),
|
||||
caFingerprint: options.caFingerprint,
|
||||
sniffEnabled: options.sniffInterval !== false ||
|
||||
options.sniffOnStart !== false ||
|
||||
options.sniffOnConnectionFault !== false
|
||||
@ -251,6 +261,10 @@ class Client extends ESAPI {
|
||||
}
|
||||
|
||||
const client = new Client(options)
|
||||
// sync product check
|
||||
const tSymbol = Object.getOwnPropertySymbols(this.transport)
|
||||
.filter(symbol => symbol.description === 'product check')[0]
|
||||
client.transport[tSymbol] = this.transport[tSymbol]
|
||||
// Add parent extensions
|
||||
if (this[kExtensions].length > 0) {
|
||||
this[kExtensions].forEach(({ name, opts, fn }) => {
|
||||
@ -307,6 +321,14 @@ function getAuth (node) {
|
||||
}
|
||||
}
|
||||
|
||||
function isHttpConnection (node) {
|
||||
if (Array.isArray(node)) {
|
||||
return node.some((n) => (typeof n === 'string' ? new URL(n).protocol : n.url.protocol) === 'http:')
|
||||
} else {
|
||||
return (typeof node === 'string' ? new URL(node).protocol : node.url.protocol) === 'http:'
|
||||
}
|
||||
}
|
||||
|
||||
const events = {
|
||||
RESPONSE: 'response',
|
||||
REQUEST: 'request',
|
||||
|
||||
1
lib/Connection.d.ts
vendored
1
lib/Connection.d.ts
vendored
@ -40,6 +40,7 @@ export interface ConnectionOptions {
|
||||
roles?: ConnectionRoles;
|
||||
auth?: BasicAuth | ApiKeyAuth;
|
||||
proxy?: string | URL;
|
||||
caFingerprint?: string;
|
||||
}
|
||||
|
||||
interface ConnectionRoles {
|
||||
|
||||
@ -42,6 +42,7 @@ class Connection {
|
||||
this.headers = prepareHeaders(opts.headers, opts.auth)
|
||||
this.deadCount = 0
|
||||
this.resurrectTimeout = 0
|
||||
this.caFingerprint = opts.caFingerprint
|
||||
|
||||
this._openRequests = 0
|
||||
this._status = opts.status || Connection.statuses.ALIVE
|
||||
@ -112,7 +113,14 @@ class Connection {
|
||||
const onError = err => {
|
||||
cleanListeners()
|
||||
this._openRequests--
|
||||
callback(new ConnectionError(err.message), null)
|
||||
let message = err.message
|
||||
if (err.code === 'ECONNRESET') {
|
||||
/* istanbul ignore next */
|
||||
const socket = request.socket || {}
|
||||
/* istanbul ignore next */
|
||||
message += ` - Local: ${socket.localAddress || 'unknown'}:${socket.localPort || 'unknown'}, Remote: ${socket.remoteAddress || 'unknown'}:${socket.remotePort || 'unknown'}`
|
||||
}
|
||||
callback(new ConnectionError(message), null)
|
||||
}
|
||||
|
||||
const onAbort = () => {
|
||||
@ -123,10 +131,36 @@ class Connection {
|
||||
callback(new RequestAbortedError(), null)
|
||||
}
|
||||
|
||||
const onSocket = socket => {
|
||||
/* istanbul ignore else */
|
||||
if (!socket.isSessionReused()) {
|
||||
socket.once('secureConnect', () => {
|
||||
const issuerCertificate = getIssuerCertificate(socket)
|
||||
/* istanbul ignore next */
|
||||
if (issuerCertificate == null) {
|
||||
onError(new Error('Invalid or malformed certificate'))
|
||||
request.once('error', () => {}) // we need to catch the request aborted error
|
||||
return request.abort()
|
||||
}
|
||||
|
||||
// Check if fingerprint matches
|
||||
/* istanbul ignore else */
|
||||
if (this.caFingerprint !== issuerCertificate.fingerprint256) {
|
||||
onError(new Error('Server certificate CA fingerprint does not match the value configured in caFingerprint'))
|
||||
request.once('error', () => {}) // we need to catch the request aborted error
|
||||
return request.abort()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
request.on('response', onResponse)
|
||||
request.on('timeout', onTimeout)
|
||||
request.on('error', onError)
|
||||
request.on('abort', onAbort)
|
||||
if (this.caFingerprint != null) {
|
||||
request.on('socket', onSocket)
|
||||
}
|
||||
|
||||
// Disables the Nagle algorithm
|
||||
request.setNoDelay(true)
|
||||
@ -152,6 +186,7 @@ class Connection {
|
||||
request.removeListener('timeout', onTimeout)
|
||||
request.removeListener('error', onError)
|
||||
request.removeListener('abort', onAbort)
|
||||
request.removeListener('socket', onSocket)
|
||||
cleanedListeners = true
|
||||
}
|
||||
}
|
||||
@ -331,6 +366,8 @@ function prepareHeaders (headers = {}, auth) {
|
||||
} else {
|
||||
headers.authorization = `ApiKey ${auth.apiKey}`
|
||||
}
|
||||
} else if (auth.bearer) {
|
||||
headers.authorization = `Bearer ${auth.bearer}`
|
||||
} else if (auth.username && auth.password) {
|
||||
headers.authorization = 'Basic ' + Buffer.from(`${auth.username}:${auth.password}`).toString('base64')
|
||||
}
|
||||
@ -338,5 +375,25 @@ function prepareHeaders (headers = {}, auth) {
|
||||
return headers
|
||||
}
|
||||
|
||||
function getIssuerCertificate (socket) {
|
||||
let certificate = socket.getPeerCertificate(true)
|
||||
while (certificate && Object.keys(certificate).length > 0) {
|
||||
// invalid certificate
|
||||
if (certificate.issuerCertificate == null) {
|
||||
return null
|
||||
}
|
||||
|
||||
// We have reached the root certificate.
|
||||
// In case of self-signed certificates, `issuerCertificate` may be a circular reference.
|
||||
if (certificate.fingerprint256 === certificate.issuerCertificate.fingerprint256) {
|
||||
break
|
||||
}
|
||||
|
||||
// continue the loop
|
||||
certificate = certificate.issuerCertificate
|
||||
}
|
||||
return certificate
|
||||
}
|
||||
|
||||
module.exports = Connection
|
||||
module.exports.internals = { prepareHeaders }
|
||||
module.exports.internals = { prepareHeaders, getIssuerCertificate }
|
||||
|
||||
2
lib/Helpers.d.ts
vendored
2
lib/Helpers.d.ts
vendored
@ -36,6 +36,7 @@ export interface ScrollSearchResponse<TDocument = unknown, TResponse = Record<st
|
||||
|
||||
export interface BulkHelper<T> extends Promise<T> {
|
||||
abort: () => BulkHelper<T>
|
||||
readonly stats: BulkStats
|
||||
}
|
||||
|
||||
export interface BulkStats {
|
||||
@ -43,6 +44,7 @@ export interface BulkStats {
|
||||
failed: number
|
||||
retry: number
|
||||
successful: number
|
||||
noop: number
|
||||
time: number
|
||||
bytes: number
|
||||
aborted: boolean
|
||||
|
||||
@ -456,6 +456,7 @@ class Helpers {
|
||||
failed: 0,
|
||||
retry: 0,
|
||||
successful: 0,
|
||||
noop: 0,
|
||||
time: 0,
|
||||
bytes: 0,
|
||||
aborted: false
|
||||
@ -463,6 +464,9 @@ class Helpers {
|
||||
|
||||
const p = iterate()
|
||||
const helper = {
|
||||
get stats () {
|
||||
return stats
|
||||
},
|
||||
then (onFulfilled, onRejected) {
|
||||
return p.then(onFulfilled, onRejected)
|
||||
},
|
||||
@ -692,6 +696,11 @@ class Helpers {
|
||||
if (err) return callback(err, null)
|
||||
if (body.errors === false) {
|
||||
stats.successful += body.items.length
|
||||
for (const item of body.items) {
|
||||
if (item.update && item.update.result === 'noop') {
|
||||
stats.noop++
|
||||
}
|
||||
}
|
||||
return callback(null, [])
|
||||
}
|
||||
const retry = []
|
||||
|
||||
7
lib/Transport.d.ts
vendored
7
lib/Transport.d.ts
vendored
@ -26,7 +26,8 @@ import * as errors from './errors';
|
||||
export type ApiError = errors.ConfigurationError | errors.ConnectionError |
|
||||
errors.DeserializationError | errors.SerializationError |
|
||||
errors.NoLivingConnectionsError | errors.ResponseError |
|
||||
errors.TimeoutError | errors.RequestAbortedError
|
||||
errors.TimeoutError | errors.RequestAbortedError |
|
||||
errors.ProductNotSupportedError
|
||||
|
||||
export type Context = unknown
|
||||
|
||||
@ -154,8 +155,8 @@ export default class Transport {
|
||||
_nextSniff: number;
|
||||
_isSniffing: boolean;
|
||||
constructor(opts: TransportOptions);
|
||||
request(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse>;
|
||||
request(params: TransportRequestParams, options?: TransportRequestOptions, callback?: (err: ApiError, result: ApiResponse) => void): TransportRequestCallback;
|
||||
request<TResponse = Record<string, any>, TContext = Context>(params: TransportRequestParams, options?: TransportRequestOptions): TransportRequestPromise<ApiResponse<TResponse, TContext>>;
|
||||
request<TResponse = Record<string, any>, TContext = Context>(params: TransportRequestParams, options?: TransportRequestOptions, callback?: (err: ApiError, result: ApiResponse<TResponse, TContext>) => void): TransportRequestCallback;
|
||||
getConnection(opts: TransportGetConnectionOptions): Connection | null;
|
||||
sniff(opts?: TransportSniffOptions, callback?: (...args: any[]) => void): void;
|
||||
}
|
||||
|
||||
271
lib/Transport.js
271
lib/Transport.js
@ -24,12 +24,14 @@ const os = require('os')
|
||||
const { gzip, unzip, createGzip } = require('zlib')
|
||||
const buffer = require('buffer')
|
||||
const ms = require('ms')
|
||||
const { EventEmitter } = require('events')
|
||||
const {
|
||||
ConnectionError,
|
||||
RequestAbortedError,
|
||||
NoLivingConnectionsError,
|
||||
ResponseError,
|
||||
ConfigurationError
|
||||
ConfigurationError,
|
||||
ProductNotSupportedError
|
||||
} = require('./errors')
|
||||
|
||||
const noop = () => {}
|
||||
@ -38,6 +40,9 @@ const clientVersion = require('../package.json').version
|
||||
const userAgent = `elasticsearch-js/${clientVersion} (${os.platform()} ${os.release()}-${os.arch()}; Node.js ${process.version})`
|
||||
const MAX_BUFFER_LENGTH = buffer.constants.MAX_LENGTH
|
||||
const MAX_STRING_LENGTH = buffer.constants.MAX_STRING_LENGTH
|
||||
const kProductCheck = Symbol('product check')
|
||||
const kApiVersioning = Symbol('api versioning')
|
||||
const kEventEmitter = Symbol('event emitter')
|
||||
|
||||
class Transport {
|
||||
constructor (opts) {
|
||||
@ -64,6 +69,9 @@ class Transport {
|
||||
this.generateRequestId = opts.generateRequestId || generateRequestId()
|
||||
this.name = opts.name
|
||||
this.opaqueIdPrefix = opts.opaqueIdPrefix
|
||||
this[kProductCheck] = 0 // 0 = to be checked, 1 = checking, 2 = checked-ok, 3 checked-notok, 4 checked-nodefault
|
||||
this[kApiVersioning] = process.env.ELASTIC_CLIENT_APIVERSIONING === 'true'
|
||||
this[kEventEmitter] = new EventEmitter()
|
||||
|
||||
this.nodeFilter = opts.nodeFilter || defaultNodeFilter
|
||||
if (typeof opts.nodeSelector === 'function') {
|
||||
@ -81,7 +89,11 @@ class Transport {
|
||||
this._isSniffing = false
|
||||
|
||||
if (opts.sniffOnStart === true) {
|
||||
this.sniff({ reason: Transport.sniffReasons.SNIFF_ON_START })
|
||||
// timer needed otherwise it will clash
|
||||
// with the product check testing
|
||||
setTimeout(() => {
|
||||
this.sniff({ reason: Transport.sniffReasons.SNIFF_ON_START })
|
||||
}, 10)
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +183,7 @@ class Transport {
|
||||
|
||||
const makeRequest = () => {
|
||||
if (meta.aborted === true) {
|
||||
this.emit('request', new RequestAbortedError(), result)
|
||||
return process.nextTick(callback, new RequestAbortedError(), result)
|
||||
}
|
||||
meta.connection = this.getConnection({ requestId: meta.request.id })
|
||||
@ -226,6 +239,7 @@ class Transport {
|
||||
|
||||
const contentEncoding = (result.headers['content-encoding'] || '').toLowerCase()
|
||||
const isCompressed = contentEncoding.indexOf('gzip') > -1 || contentEncoding.indexOf('deflate') > -1
|
||||
const isVectorTile = (result.headers['content-type'] || '').indexOf('application/vnd.mapbox-vector-tile') > -1
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (result.headers['content-length'] !== undefined) {
|
||||
@ -244,8 +258,9 @@ class Transport {
|
||||
}
|
||||
// if the response is compressed, we must handle it
|
||||
// as buffer for allowing decompression later
|
||||
let payload = isCompressed ? [] : ''
|
||||
const onData = isCompressed
|
||||
// while if it's a vector tile, we should return it as buffer
|
||||
let payload = isCompressed || isVectorTile ? [] : ''
|
||||
const onData = isCompressed || isVectorTile
|
||||
? chunk => { payload.push(chunk) }
|
||||
: chunk => { payload += chunk }
|
||||
const onEnd = err => {
|
||||
@ -261,7 +276,7 @@ class Transport {
|
||||
if (isCompressed) {
|
||||
unzip(Buffer.concat(payload), onBody)
|
||||
} else {
|
||||
onBody(null, payload)
|
||||
onBody(null, isVectorTile ? Buffer.concat(payload) : payload)
|
||||
}
|
||||
}
|
||||
|
||||
@ -270,7 +285,7 @@ class Transport {
|
||||
onEnd(new Error('Response aborted while reading the body'))
|
||||
}
|
||||
|
||||
if (!isCompressed) {
|
||||
if (!isCompressed && !isVectorTile) {
|
||||
response.setEncoding('utf8')
|
||||
}
|
||||
|
||||
@ -286,7 +301,9 @@ class Transport {
|
||||
this.emit('response', err, result)
|
||||
return callback(err, result)
|
||||
}
|
||||
if (Buffer.isBuffer(payload)) {
|
||||
|
||||
const isVectorTile = (result.headers['content-type'] || '').indexOf('application/vnd.mapbox-vector-tile') > -1
|
||||
if (Buffer.isBuffer(payload) && !isVectorTile) {
|
||||
payload = payload.toString()
|
||||
}
|
||||
const isHead = params.method === 'HEAD'
|
||||
@ -295,7 +312,8 @@ class Transport {
|
||||
// - 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 &&
|
||||
(result.headers['content-type'].indexOf('application/json') > -1 ||
|
||||
result.headers['content-type'].indexOf('application/vnd.elasticsearch+json') > -1) &&
|
||||
isHead === false &&
|
||||
payload !== ''
|
||||
) {
|
||||
@ -347,91 +365,130 @@ class Transport {
|
||||
}
|
||||
}
|
||||
|
||||
this.emit('serialization', null, result)
|
||||
const headers = Object.assign({}, this.headers, lowerCaseHeaders(options.headers))
|
||||
const prepareRequest = () => {
|
||||
this.emit('serialization', null, result)
|
||||
const headers = Object.assign({}, this.headers, lowerCaseHeaders(options.headers))
|
||||
|
||||
if (options.opaqueId !== undefined) {
|
||||
headers['x-opaque-id'] = this.opaqueIdPrefix !== null
|
||||
? this.opaqueIdPrefix + options.opaqueId
|
||||
: options.opaqueId
|
||||
}
|
||||
if (options.opaqueId !== undefined) {
|
||||
headers['x-opaque-id'] = this.opaqueIdPrefix !== null
|
||||
? this.opaqueIdPrefix + options.opaqueId
|
||||
: options.opaqueId
|
||||
}
|
||||
|
||||
// handle json body
|
||||
if (params.body != null) {
|
||||
if (shouldSerialize(params.body) === true) {
|
||||
try {
|
||||
params.body = this.serializer.serialize(params.body)
|
||||
} catch (err) {
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
return transportReturn
|
||||
// handle json body
|
||||
if (params.body != null) {
|
||||
if (shouldSerialize(params.body) === true) {
|
||||
try {
|
||||
params.body = this.serializer.serialize(params.body)
|
||||
} catch (err) {
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
return transportReturn
|
||||
}
|
||||
}
|
||||
|
||||
if (params.body !== '') {
|
||||
headers['content-type'] = headers['content-type'] || (this[kApiVersioning] ? 'application/vnd.elasticsearch+json; compatible-with=7' : 'application/json')
|
||||
}
|
||||
|
||||
// handle ndjson body
|
||||
} else if (params.bulkBody != null) {
|
||||
if (shouldSerialize(params.bulkBody) === true) {
|
||||
try {
|
||||
params.body = this.serializer.ndserialize(params.bulkBody)
|
||||
} catch (err) {
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
return transportReturn
|
||||
}
|
||||
} else {
|
||||
params.body = params.bulkBody
|
||||
}
|
||||
if (params.body !== '') {
|
||||
headers['content-type'] = headers['content-type'] || (this[kApiVersioning] ? 'application/vnd.elasticsearch+x-ndjson; compatible-with=7' : 'application/x-ndjson')
|
||||
}
|
||||
}
|
||||
|
||||
if (params.body !== '') {
|
||||
headers['content-type'] = headers['content-type'] || 'application/json'
|
||||
params.headers = headers
|
||||
// serializes the querystring
|
||||
if (options.querystring == null) {
|
||||
params.querystring = this.serializer.qserialize(params.querystring)
|
||||
} else {
|
||||
params.querystring = this.serializer.qserialize(
|
||||
Object.assign({}, params.querystring, options.querystring)
|
||||
)
|
||||
}
|
||||
|
||||
// handle ndjson body
|
||||
} else if (params.bulkBody != null) {
|
||||
if (shouldSerialize(params.bulkBody) === true) {
|
||||
try {
|
||||
params.body = this.serializer.ndserialize(params.bulkBody)
|
||||
} catch (err) {
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
return transportReturn
|
||||
// handles request timeout
|
||||
params.timeout = toMs(options.requestTimeout || this.requestTimeout)
|
||||
if (options.asStream === true) params.asStream = true
|
||||
|
||||
// handle compression
|
||||
if (params.body !== '' && params.body != null) {
|
||||
if (isStream(params.body) === true) {
|
||||
if (compression === 'gzip') {
|
||||
params.headers['content-encoding'] = compression
|
||||
params.body = params.body.pipe(createGzip())
|
||||
}
|
||||
makeRequest()
|
||||
} else if (compression === 'gzip') {
|
||||
gzip(params.body, (err, buffer) => {
|
||||
/* istanbul ignore next */
|
||||
if (err) {
|
||||
this.emit('request', err, result)
|
||||
return callback(err, result)
|
||||
}
|
||||
params.headers['content-encoding'] = compression
|
||||
params.headers['content-length'] = '' + Buffer.byteLength(buffer)
|
||||
params.body = buffer
|
||||
makeRequest()
|
||||
})
|
||||
} else {
|
||||
params.headers['content-length'] = '' + Buffer.byteLength(params.body)
|
||||
makeRequest()
|
||||
}
|
||||
} else {
|
||||
params.body = params.bulkBody
|
||||
}
|
||||
if (params.body !== '') {
|
||||
headers['content-type'] = headers['content-type'] || 'application/x-ndjson'
|
||||
makeRequest()
|
||||
}
|
||||
}
|
||||
|
||||
params.headers = headers
|
||||
// serializes the querystring
|
||||
if (options.querystring == null) {
|
||||
params.querystring = this.serializer.qserialize(params.querystring)
|
||||
} else {
|
||||
params.querystring = this.serializer.qserialize(
|
||||
Object.assign({}, params.querystring, options.querystring)
|
||||
)
|
||||
}
|
||||
|
||||
// handles request timeout
|
||||
params.timeout = toMs(options.requestTimeout || this.requestTimeout)
|
||||
if (options.asStream === true) params.asStream = true
|
||||
meta.request.params = params
|
||||
meta.request.options = options
|
||||
|
||||
// handle compression
|
||||
if (params.body !== '' && params.body != null) {
|
||||
if (isStream(params.body) === true) {
|
||||
if (compression === 'gzip') {
|
||||
params.headers['content-encoding'] = compression
|
||||
params.body = params.body.pipe(createGzip())
|
||||
}
|
||||
makeRequest()
|
||||
} else if (compression === 'gzip') {
|
||||
gzip(params.body, (err, buffer) => {
|
||||
/* istanbul ignore next */
|
||||
if (err) {
|
||||
this.emit('request', err, result)
|
||||
return callback(err, result)
|
||||
}
|
||||
params.headers['content-encoding'] = compression
|
||||
params.headers['content-length'] = '' + Buffer.byteLength(buffer)
|
||||
params.body = buffer
|
||||
makeRequest()
|
||||
})
|
||||
// still need to check the product or waiting for the check to finish
|
||||
if (this[kProductCheck] === 0 || this[kProductCheck] === 1) {
|
||||
// let pass info requests
|
||||
if (params.method === 'GET' && params.path === '/') {
|
||||
prepareRequest()
|
||||
} else {
|
||||
params.headers['content-length'] = '' + Buffer.byteLength(params.body)
|
||||
makeRequest()
|
||||
// wait for product check to finish
|
||||
this[kEventEmitter].once('product-check', (error, status) => {
|
||||
if (status === false) {
|
||||
const err = error || new ProductNotSupportedError(result)
|
||||
if (this[kProductCheck] === 4) {
|
||||
err.message = 'The client noticed that the server is not a supported distribution of Elasticsearch'
|
||||
}
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
} else {
|
||||
prepareRequest()
|
||||
}
|
||||
})
|
||||
// the very first request triggers the product check
|
||||
if (this[kProductCheck] === 0) {
|
||||
this.productCheck()
|
||||
}
|
||||
}
|
||||
// the product check is finished and it's not Elasticsearch
|
||||
} else if (this[kProductCheck] === 3 || this[kProductCheck] === 4) {
|
||||
const err = new ProductNotSupportedError(result)
|
||||
if (this[kProductCheck] === 4) {
|
||||
err.message = 'The client noticed that the server is not a supported distribution of Elasticsearch'
|
||||
}
|
||||
this.emit('request', err, result)
|
||||
process.nextTick(callback, err, result)
|
||||
// the product check finished and it's Elasticsearch
|
||||
} else {
|
||||
makeRequest()
|
||||
prepareRequest()
|
||||
}
|
||||
|
||||
return transportReturn
|
||||
@ -491,6 +548,68 @@ class Transport {
|
||||
callback(null, hosts)
|
||||
})
|
||||
}
|
||||
|
||||
productCheck () {
|
||||
debug('Start product check')
|
||||
this[kProductCheck] = 1
|
||||
this.request({
|
||||
method: 'GET',
|
||||
path: '/'
|
||||
}, (err, result) => {
|
||||
this[kProductCheck] = 3
|
||||
if (err) {
|
||||
debug('Product check failed', err)
|
||||
if (err.statusCode === 401 || err.statusCode === 403) {
|
||||
this[kProductCheck] = 2
|
||||
process.emitWarning(
|
||||
'The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.',
|
||||
'ProductNotSupportedSecurityError'
|
||||
)
|
||||
this[kEventEmitter].emit('product-check', null, true)
|
||||
} else {
|
||||
this[kProductCheck] = 0
|
||||
this[kEventEmitter].emit('product-check', err, false)
|
||||
}
|
||||
} else {
|
||||
debug('Checking elasticsearch version', result.body, result.headers)
|
||||
if (result.body.version == null || typeof result.body.version.number !== 'string') {
|
||||
debug('Can\'t access Elasticsearch version')
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
}
|
||||
const tagline = result.body.tagline
|
||||
const version = result.body.version.number.split('.')
|
||||
const major = Number(version[0])
|
||||
const minor = Number(version[1])
|
||||
if (major < 6) {
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
} else if (major >= 6 && major < 7) {
|
||||
if (tagline !== 'You Know, for Search') {
|
||||
debug('Bad tagline')
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
}
|
||||
} else if (major === 7 && minor < 14) {
|
||||
if (tagline !== 'You Know, for Search') {
|
||||
debug('Bad tagline')
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
}
|
||||
|
||||
if (result.body.version.build_flavor !== 'default') {
|
||||
debug('Bad build_flavor')
|
||||
this[kProductCheck] = 4
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
}
|
||||
} else {
|
||||
if (result.headers['x-elastic-product'] !== 'Elasticsearch') {
|
||||
debug('x-elastic-product not recognized')
|
||||
return this[kEventEmitter].emit('product-check', null, false)
|
||||
}
|
||||
}
|
||||
debug('Valid Elasticsearch distribution')
|
||||
this[kProductCheck] = 2
|
||||
this[kEventEmitter].emit('product-check', null, true)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Transport.sniffReasons = {
|
||||
|
||||
7
lib/errors.d.ts
vendored
7
lib/errors.d.ts
vendored
@ -81,3 +81,10 @@ export declare class RequestAbortedError<TResponse = Record<string, any>, TConte
|
||||
meta: ApiResponse<TResponse, TContext>;
|
||||
constructor(message: string, meta: ApiResponse);
|
||||
}
|
||||
|
||||
export declare class ProductNotSupportedError<TResponse = Record<string, any>, TContext = Context> extends ElasticsearchClientError {
|
||||
name: string;
|
||||
message: string;
|
||||
meta: ApiResponse<TResponse, TContext>;
|
||||
constructor(meta: ApiResponse);
|
||||
}
|
||||
|
||||
@ -97,8 +97,10 @@ class ResponseError extends ElasticsearchClientError {
|
||||
} else {
|
||||
this.message = meta.body.error.type
|
||||
}
|
||||
} else if (typeof meta.body === 'object' && meta.body != null) {
|
||||
this.message = JSON.stringify(meta.body)
|
||||
} else {
|
||||
this.message = 'Response Error'
|
||||
this.message = meta.body || 'Response Error'
|
||||
}
|
||||
this.meta = meta
|
||||
}
|
||||
@ -133,6 +135,16 @@ class RequestAbortedError extends ElasticsearchClientError {
|
||||
}
|
||||
}
|
||||
|
||||
class ProductNotSupportedError extends ElasticsearchClientError {
|
||||
constructor (meta) {
|
||||
super('Product Not Supported Error')
|
||||
Error.captureStackTrace(this, ProductNotSupportedError)
|
||||
this.name = 'ProductNotSupportedError'
|
||||
this.message = 'The client noticed that the server is not Elasticsearch and we do not support this unknown product.'
|
||||
this.meta = meta
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ElasticsearchClientError,
|
||||
TimeoutError,
|
||||
@ -142,5 +154,6 @@ module.exports = {
|
||||
DeserializationError,
|
||||
ConfigurationError,
|
||||
ResponseError,
|
||||
RequestAbortedError
|
||||
RequestAbortedError,
|
||||
ProductNotSupportedError
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ class BaseConnectionPool {
|
||||
this._ssl = opts.ssl
|
||||
this._agent = opts.agent
|
||||
this._proxy = opts.proxy || null
|
||||
this._caFingerprint = opts.caFingerprint || null
|
||||
}
|
||||
|
||||
getConnection () {
|
||||
@ -72,6 +73,8 @@ class BaseConnectionPool {
|
||||
if (opts.agent == null) opts.agent = this._agent
|
||||
/* istanbul ignore else */
|
||||
if (opts.proxy == null) opts.proxy = this._proxy
|
||||
/* istanbul ignore else */
|
||||
if (opts.caFingerprint == null) opts.caFingerprint = this._caFingerprint
|
||||
|
||||
const connection = new this.Connection(opts)
|
||||
|
||||
|
||||
6
lib/pool/index.d.ts
vendored
6
lib/pool/index.d.ts
vendored
@ -31,6 +31,7 @@ interface BaseConnectionPoolOptions {
|
||||
auth?: BasicAuth | ApiKeyAuth;
|
||||
emit: (event: string | symbol, ...args: any[]) => boolean;
|
||||
Connection: typeof Connection;
|
||||
caFingerprint?: string;
|
||||
}
|
||||
|
||||
interface ConnectionPoolOptions extends BaseConnectionPoolOptions {
|
||||
@ -61,6 +62,10 @@ interface BasicAuth {
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface BearerAuth {
|
||||
bearer: string
|
||||
}
|
||||
|
||||
interface resurrectOptions {
|
||||
now?: number;
|
||||
requestId: string;
|
||||
@ -204,6 +209,7 @@ export {
|
||||
getConnectionOptions,
|
||||
ApiKeyAuth,
|
||||
BasicAuth,
|
||||
BearerAuth,
|
||||
internals,
|
||||
resurrectOptions,
|
||||
ResurrectEvent,
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
"./": "./"
|
||||
},
|
||||
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
|
||||
"version": "7.14.0",
|
||||
"versionCanary": "7.14.0-canary.6",
|
||||
"version": "7.15.0",
|
||||
"versionCanary": "7.15.0-canary.4",
|
||||
"keywords": [
|
||||
"elasticsearch",
|
||||
"elastic",
|
||||
@ -100,6 +100,7 @@
|
||||
"jsx": false,
|
||||
"flow": false,
|
||||
"coverage": false,
|
||||
"jobs-auto": true
|
||||
"jobs-auto": true,
|
||||
"check-coverage": false
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
const { test } = require('tap')
|
||||
const intoStream = require('into-stream')
|
||||
const { Client, Connection, events } = require('../../index')
|
||||
const { Connection, events } = require('../../index')
|
||||
const {
|
||||
TimeoutError,
|
||||
ConnectionError,
|
||||
@ -31,6 +31,7 @@ const {
|
||||
DeserializationError
|
||||
} = require('../../lib/errors')
|
||||
const {
|
||||
Client,
|
||||
buildServer,
|
||||
connection: {
|
||||
MockConnection,
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
|
||||
const { test } = require('tap')
|
||||
const FakeTimers = require('@sinonjs/fake-timers')
|
||||
const { Client, Transport } = require('../../index')
|
||||
const { Transport } = require('../../index')
|
||||
const {
|
||||
Client,
|
||||
connection: { MockConnection, MockConnectionSniff }
|
||||
} = require('../utils')
|
||||
const noop = () => {}
|
||||
|
||||
1348
test/acceptance/product-check.test.js
Normal file
1348
test/acceptance/product-check.test.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,8 +4,8 @@
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client } = require('../../index')
|
||||
const {
|
||||
Client,
|
||||
buildProxy: {
|
||||
createProxy,
|
||||
createSecureProxy,
|
||||
|
||||
@ -23,8 +23,8 @@ const { test } = require('tap')
|
||||
const { URL } = require('url')
|
||||
const FakeTimers = require('@sinonjs/fake-timers')
|
||||
const workq = require('workq')
|
||||
const { buildCluster } = require('../utils')
|
||||
const { Client, events } = require('../../index')
|
||||
const { Client, buildCluster } = require('../utils')
|
||||
const { events } = require('../../index')
|
||||
|
||||
/**
|
||||
* The aim of this test is to verify how the resurrect logic behaves
|
||||
|
||||
@ -23,8 +23,8 @@ const { test } = require('tap')
|
||||
const { URL } = require('url')
|
||||
const FakeTimers = require('@sinonjs/fake-timers')
|
||||
const workq = require('workq')
|
||||
const { buildCluster } = require('../utils')
|
||||
const { Client, Connection, Transport, events, errors } = require('../../index')
|
||||
const { Client, buildCluster } = require('../utils')
|
||||
const { Connection, Transport, events, errors } = require('../../index')
|
||||
|
||||
/**
|
||||
* The aim of this test is to verify how the sniffer behaves
|
||||
@ -77,6 +77,7 @@ test('Should update the connection pool', t => {
|
||||
t.same(hosts[i], {
|
||||
url: new URL(nodes[id].url),
|
||||
id: id,
|
||||
caFingerprint: null,
|
||||
roles: {
|
||||
master: true,
|
||||
data: true,
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
"name": "parcel-test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node index.js",
|
||||
"build": "parcel build index.js --no-source-maps"
|
||||
|
||||
@ -47,6 +47,8 @@ const freeSkips = {
|
||||
// TODO: remove this once 'arbitrary_key' is implemented
|
||||
// https://github.com/elastic/elasticsearch/pull/41492
|
||||
'indices.split/30_copy_settings.yml': ['*'],
|
||||
'indices.stats/50_disk_usage.yml': ['Disk usage stats'],
|
||||
'indices.stats/60_field_usage.yml': ['Field usage stats'],
|
||||
// skipping because we are booting ES with `discovery.type=single-node`
|
||||
// and this test will fail because of this configuration
|
||||
'nodes.stats/30_discovery.yml': ['*'],
|
||||
@ -55,6 +57,7 @@ const freeSkips = {
|
||||
'search.aggregation/240_max_buckets.yml': ['*']
|
||||
}
|
||||
const platinumBlackList = {
|
||||
'analytics/histogram.yml': ['Histogram requires values in increasing order'],
|
||||
// this two test cases are broken, we should
|
||||
// return on those in the future.
|
||||
'analytics/top_metrics.yml': [
|
||||
|
||||
@ -80,6 +80,18 @@ function build (opts = {}) {
|
||||
|
||||
// remove 'x_pack_rest_user', used in some xpack test
|
||||
await client.security.deleteUser({ username: 'x_pack_rest_user' }, { ignore: [404] })
|
||||
|
||||
const { body: searchableSnapshotIndices } = await client.cluster.state({
|
||||
metric: 'metadata',
|
||||
filter_path: 'metadata.indices.*.settings.index.store.snapshot'
|
||||
})
|
||||
if (searchableSnapshotIndices.metadata != null && searchableSnapshotIndices.metadata.indices != null) {
|
||||
await helper.runInParallel(
|
||||
client, 'indices.delete',
|
||||
Object.keys(searchableSnapshotIndices.metadata.indices).map(i => ({ index: i })),
|
||||
{ ignore: [404] }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// clean snapshots
|
||||
@ -164,6 +176,13 @@ function build (opts = {}) {
|
||||
)
|
||||
}
|
||||
|
||||
const { body: shutdownNodes } = await client.shutdown.getNode()
|
||||
if (shutdownNodes._nodes == null && shutdownNodes.cluster_name == null) {
|
||||
for (const node of shutdownNodes.nodes) {
|
||||
await client.shutdown.deleteNode({ node_id: node.node_id })
|
||||
}
|
||||
}
|
||||
|
||||
// wait for pending task before resolving the promise
|
||||
await sleep(100)
|
||||
while (true) {
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
const { Client, errors } = require('../../index')
|
||||
const { buildServer } = require('../utils')
|
||||
const { errors } = require('../../index')
|
||||
const { Client, buildServer } = require('../utils')
|
||||
|
||||
function runAsyncTest (test) {
|
||||
test('async await (search)', t => {
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client, errors } = require('../../index')
|
||||
const { buildServer } = require('../utils')
|
||||
const { errors } = require('../../index')
|
||||
const { Client, buildServer } = require('../utils')
|
||||
|
||||
test('Basic (callback)', t => {
|
||||
t.plan(2)
|
||||
|
||||
@ -20,8 +20,9 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client, errors } = require('../../index')
|
||||
const { errors } = require('../../index')
|
||||
const {
|
||||
Client,
|
||||
buildServer,
|
||||
connection: { MockConnection }
|
||||
} = require('../utils')
|
||||
|
||||
@ -23,9 +23,11 @@ const { test } = require('tap')
|
||||
const { URL } = require('url')
|
||||
const buffer = require('buffer')
|
||||
const intoStream = require('into-stream')
|
||||
const { Client, ConnectionPool, Transport, Connection, errors } = require('../../index')
|
||||
const { ConnectionPool, Transport, Connection, errors } = require('../../index')
|
||||
const { CloudConnectionPool } = require('../../lib/pool')
|
||||
const { buildServer } = require('../utils')
|
||||
const { Client, buildServer, connection } = require('../utils')
|
||||
const { buildMockConnection } = connection
|
||||
|
||||
let clientVersion = require('../../package.json').version
|
||||
if (clientVersion.includes('-')) {
|
||||
clientVersion = clientVersion.slice(0, clientVersion.indexOf('-')) + 'p'
|
||||
@ -1421,3 +1423,223 @@ test('Disable prototype poisoning protection', t => {
|
||||
t.error(err)
|
||||
})
|
||||
})
|
||||
|
||||
test('API compatibility header (json)', t => {
|
||||
t.plan(4)
|
||||
|
||||
function handler (req, res) {
|
||||
t.equal(req.headers.accept, 'application/vnd.elasticsearch+json; compatible-with=7')
|
||||
t.equal(req.headers['content-type'], 'application/vnd.elasticsearch+json; compatible-with=7')
|
||||
res.setHeader('Content-Type', 'application/vnd.elasticsearch+json; compatible-with=7')
|
||||
res.end(JSON.stringify({ hello: 'world' }))
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
process.env.ELASTIC_CLIENT_APIVERSIONING = 'true'
|
||||
const client = new Client({
|
||||
node: `http://localhost:${port}`
|
||||
})
|
||||
|
||||
client.index({ index: 'foo', body: {} }, (err, { body }) => {
|
||||
t.error(err)
|
||||
t.same(body, { hello: 'world' })
|
||||
server.stop()
|
||||
delete process.env.ELASTIC_CLIENT_APIVERSIONING
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('API compatibility header (x-ndjson)', t => {
|
||||
t.plan(4)
|
||||
|
||||
function handler (req, res) {
|
||||
t.equal(req.headers.accept, 'application/vnd.elasticsearch+json; compatible-with=7')
|
||||
t.equal(req.headers['content-type'], 'application/vnd.elasticsearch+x-ndjson; compatible-with=7')
|
||||
res.setHeader('Content-Type', 'application/vnd.elasticsearch+json; compatible-with=7')
|
||||
res.end(JSON.stringify({ hello: 'world' }))
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
process.env.ELASTIC_CLIENT_APIVERSIONING = 'true'
|
||||
const client = new Client({
|
||||
node: `http://localhost:${port}`
|
||||
})
|
||||
|
||||
client.bulk({ index: 'foo', body: [{}, {}] }, (err, { body }) => {
|
||||
t.error(err)
|
||||
t.same(body, { hello: 'world' })
|
||||
server.stop()
|
||||
delete process.env.ELASTIC_CLIENT_APIVERSIONING
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Bearer auth', t => {
|
||||
t.plan(3)
|
||||
|
||||
function handler (req, res) {
|
||||
t.match(req.headers, {
|
||||
authorization: 'Bearer Zm9vOmJhcg=='
|
||||
})
|
||||
res.setHeader('Content-Type', 'application/json;utf=8')
|
||||
res.end(JSON.stringify({ hello: 'world' }))
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
const client = new Client({
|
||||
node: `http://localhost:${port}`,
|
||||
auth: {
|
||||
bearer: 'Zm9vOmJhcg=='
|
||||
}
|
||||
})
|
||||
|
||||
client.info((err, { body }) => {
|
||||
t.error(err)
|
||||
t.same(body, { hello: 'world' })
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Check server fingerprint (success)', t => {
|
||||
t.plan(1)
|
||||
|
||||
function handler (req, res) {
|
||||
res.end('ok')
|
||||
}
|
||||
|
||||
buildServer(handler, { secure: true }, ({ port, caFingerprint }, server) => {
|
||||
const client = new Client({
|
||||
node: `https://localhost:${port}`,
|
||||
caFingerprint
|
||||
})
|
||||
|
||||
client.info((err, res) => {
|
||||
t.error(err)
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Check server fingerprint (failure)', t => {
|
||||
t.plan(2)
|
||||
|
||||
function handler (req, res) {
|
||||
res.end('ok')
|
||||
}
|
||||
|
||||
buildServer(handler, { secure: true }, ({ port }, server) => {
|
||||
const client = new Client({
|
||||
node: `https://localhost:${port}`,
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
|
||||
client.info((err, res) => {
|
||||
t.ok(err instanceof errors.ConnectionError)
|
||||
t.equal(err.message, 'Server certificate CA fingerprint does not match the value configured in caFingerprint')
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('caFingerprint can\'t be configured over http / 1', t => {
|
||||
t.plan(2)
|
||||
|
||||
try {
|
||||
new Client({ // eslint-disable-line
|
||||
node: 'http://localhost:9200',
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
t.fail('shuld throw')
|
||||
} catch (err) {
|
||||
t.ok(err instanceof errors.ConfigurationError)
|
||||
t.equal(err.message, 'You can\'t configure the caFingerprint with a http connection')
|
||||
}
|
||||
})
|
||||
|
||||
test('caFingerprint can\'t be configured over http / 2', t => {
|
||||
t.plan(2)
|
||||
|
||||
try {
|
||||
new Client({ // eslint-disable-line
|
||||
nodes: ['http://localhost:9200'],
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
t.fail('should throw')
|
||||
} catch (err) {
|
||||
t.ok(err instanceof errors.ConfigurationError)
|
||||
t.equal(err.message, 'You can\'t configure the caFingerprint with a http connection')
|
||||
}
|
||||
})
|
||||
|
||||
test('caFingerprint can\'t be configured over http / 3', t => {
|
||||
t.plan(1)
|
||||
|
||||
try {
|
||||
new Client({ // eslint-disable-line
|
||||
nodes: ['https://localhost:9200'],
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
t.pass('should not throw')
|
||||
} catch (err) {
|
||||
t.fail('shuld not throw')
|
||||
}
|
||||
})
|
||||
|
||||
test('caFingerprint can\'t be configured over http / 4', t => {
|
||||
t.plan(2)
|
||||
|
||||
try {
|
||||
new Client({ // eslint-disable-line
|
||||
node: { url: new URL('http://localhost:9200') },
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
t.fail('shuld throw')
|
||||
} catch (err) {
|
||||
t.ok(err instanceof errors.ConfigurationError)
|
||||
t.equal(err.message, 'You can\'t configure the caFingerprint with a http connection')
|
||||
}
|
||||
})
|
||||
|
||||
test('caFingerprint can\'t be configured over http / 5', t => {
|
||||
t.plan(2)
|
||||
|
||||
try {
|
||||
new Client({ // eslint-disable-line
|
||||
nodes: [{ url: new URL('http://localhost:9200') }],
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
t.fail('should throw')
|
||||
} catch (err) {
|
||||
t.ok(err instanceof errors.ConfigurationError)
|
||||
t.equal(err.message, 'You can\'t configure the caFingerprint with a http connection')
|
||||
}
|
||||
})
|
||||
|
||||
test('Error body that is not a json', t => {
|
||||
t.plan(5)
|
||||
|
||||
const MockConnection = buildMockConnection({
|
||||
onRequest (params) {
|
||||
return {
|
||||
statusCode: 400,
|
||||
body: '<html><body>error!</body></html>',
|
||||
headers: { 'content-type': 'text/html' }
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const client = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
Connection: MockConnection,
|
||||
maxRetries: 1
|
||||
})
|
||||
|
||||
client.info((err, result) => {
|
||||
t.ok(err instanceof errors.ResponseError)
|
||||
t.equal(err.name, 'ResponseError')
|
||||
t.equal(err.body, '<html><body>error!</body></html>')
|
||||
t.equal(err.message, '<html><body>error!</body></html>')
|
||||
t.equal(err.statusCode, 400)
|
||||
})
|
||||
})
|
||||
|
||||
@ -28,7 +28,8 @@ const hpagent = require('hpagent')
|
||||
const intoStream = require('into-stream')
|
||||
const { buildServer } = require('../utils')
|
||||
const Connection = require('../../lib/Connection')
|
||||
const { TimeoutError, ConfigurationError, RequestAbortedError } = require('../../lib/errors')
|
||||
const { TimeoutError, ConfigurationError, RequestAbortedError, ConnectionError } = require('../../lib/errors')
|
||||
const { getIssuerCertificate } = Connection.internals
|
||||
|
||||
test('Basic (http)', t => {
|
||||
t.plan(4)
|
||||
@ -947,3 +948,161 @@ test('Abort with a slow body', t => {
|
||||
|
||||
setImmediate(() => request.abort())
|
||||
})
|
||||
|
||||
test('Check server fingerprint (success)', t => {
|
||||
t.plan(2)
|
||||
|
||||
function handler (req, res) {
|
||||
res.end('ok')
|
||||
}
|
||||
|
||||
buildServer(handler, { secure: true }, ({ port, caFingerprint }, server) => {
|
||||
const connection = new Connection({
|
||||
url: new URL(`https://localhost:${port}`),
|
||||
caFingerprint
|
||||
})
|
||||
|
||||
connection.request({
|
||||
path: '/hello',
|
||||
method: 'GET'
|
||||
}, (err, res) => {
|
||||
t.error(err)
|
||||
|
||||
let payload = ''
|
||||
res.setEncoding('utf8')
|
||||
res.on('data', chunk => { payload += chunk })
|
||||
res.on('error', err => t.fail(err))
|
||||
res.on('end', () => {
|
||||
t.equal(payload, 'ok')
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Check server fingerprint (failure)', t => {
|
||||
t.plan(2)
|
||||
|
||||
function handler (req, res) {
|
||||
res.end('ok')
|
||||
}
|
||||
|
||||
buildServer(handler, { secure: true }, ({ port }, server) => {
|
||||
const connection = new Connection({
|
||||
url: new URL(`https://localhost:${port}`),
|
||||
caFingerprint: 'FO:OB:AR'
|
||||
})
|
||||
|
||||
connection.request({
|
||||
path: '/hello',
|
||||
method: 'GET'
|
||||
}, (err, res) => {
|
||||
t.ok(err instanceof ConnectionError)
|
||||
t.equal(err.message, 'Server certificate CA fingerprint does not match the value configured in caFingerprint')
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('getIssuerCertificate returns the root CA', t => {
|
||||
t.plan(2)
|
||||
const issuerCertificate = {
|
||||
fingerprint256: 'BA:ZF:AZ',
|
||||
subject: {
|
||||
C: '1',
|
||||
ST: '1',
|
||||
L: '1',
|
||||
O: '1',
|
||||
OU: '1',
|
||||
CN: '1'
|
||||
},
|
||||
issuer: {
|
||||
C: '1',
|
||||
ST: '1',
|
||||
L: '1',
|
||||
O: '1',
|
||||
OU: '1',
|
||||
CN: '1'
|
||||
}
|
||||
}
|
||||
issuerCertificate.issuerCertificate = issuerCertificate
|
||||
|
||||
const socket = {
|
||||
getPeerCertificate (bool) {
|
||||
t.ok(bool)
|
||||
return {
|
||||
fingerprint256: 'FO:OB:AR',
|
||||
subject: {
|
||||
C: '1',
|
||||
ST: '1',
|
||||
L: '1',
|
||||
O: '1',
|
||||
OU: '1',
|
||||
CN: '1'
|
||||
},
|
||||
issuer: {
|
||||
C: '2',
|
||||
ST: '2',
|
||||
L: '2',
|
||||
O: '2',
|
||||
OU: '2',
|
||||
CN: '2'
|
||||
},
|
||||
issuerCertificate
|
||||
}
|
||||
}
|
||||
}
|
||||
t.same(getIssuerCertificate(socket), issuerCertificate)
|
||||
})
|
||||
|
||||
test('getIssuerCertificate detects invalid/malformed certificates', t => {
|
||||
t.plan(2)
|
||||
const socket = {
|
||||
getPeerCertificate (bool) {
|
||||
t.ok(bool)
|
||||
return {
|
||||
fingerprint256: 'FO:OB:AR',
|
||||
subject: {
|
||||
C: '1',
|
||||
ST: '1',
|
||||
L: '1',
|
||||
O: '1',
|
||||
OU: '1',
|
||||
CN: '1'
|
||||
},
|
||||
issuer: {
|
||||
C: '2',
|
||||
ST: '2',
|
||||
L: '2',
|
||||
O: '2',
|
||||
OU: '2',
|
||||
CN: '2'
|
||||
}
|
||||
// missing issuerCertificate
|
||||
}
|
||||
}
|
||||
}
|
||||
t.equal(getIssuerCertificate(socket), null)
|
||||
})
|
||||
|
||||
test('Should show local/remote socket address in case of ECONNRESET', t => {
|
||||
t.plan(2)
|
||||
|
||||
function handler (req, res) {
|
||||
res.destroy()
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
const connection = new Connection({
|
||||
url: new URL(`http://localhost:${port}`)
|
||||
})
|
||||
connection.request({
|
||||
path: '/hello',
|
||||
method: 'GET'
|
||||
}, (err, res) => {
|
||||
t.ok(err instanceof ConnectionError)
|
||||
t.match(err.message, /socket\shang\sup\s-\sLocal:\s127.0.0.1:\d+,\sRemote:\s127.0.0.1:\d+/)
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -197,3 +197,29 @@ test('ResponseError with meaningful message / 3', t => {
|
||||
t.equal(err.toString(), JSON.stringify(meta.body))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('ResponseError with meaningful message when body is not json', t => {
|
||||
const meta = {
|
||||
statusCode: 400,
|
||||
body: '<html><body>error!</body></html>',
|
||||
headers: { 'content-type': 'text/html' }
|
||||
}
|
||||
const err = new errors.ResponseError(meta)
|
||||
t.equal(err.name, 'ResponseError')
|
||||
t.equal(err.message, '<html><body>error!</body></html>')
|
||||
t.equal(err.toString(), JSON.stringify(meta.body))
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('ResponseError with meaningful message when body is falsy', t => {
|
||||
const meta = {
|
||||
statusCode: 400,
|
||||
body: '',
|
||||
headers: { 'content-type': 'text/plain' }
|
||||
}
|
||||
const err = new errors.ResponseError(meta)
|
||||
t.equal(err.name, 'ResponseError')
|
||||
t.equal(err.message, 'Response Error')
|
||||
t.equal(err.toString(), JSON.stringify(meta.body))
|
||||
t.end()
|
||||
})
|
||||
|
||||
@ -20,9 +20,10 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client, events } = require('../../index')
|
||||
const { events } = require('../../index')
|
||||
const { TimeoutError } = require('../../lib/errors')
|
||||
const {
|
||||
Client,
|
||||
connection: {
|
||||
MockConnection,
|
||||
MockConnectionTimeout
|
||||
|
||||
@ -24,8 +24,8 @@ const { join } = require('path')
|
||||
const split = require('split2')
|
||||
const FakeTimers = require('@sinonjs/fake-timers')
|
||||
const { test } = require('tap')
|
||||
const { Client, errors } = require('../../../')
|
||||
const { buildServer, connection } = require('../../utils')
|
||||
const { errors } = require('../../../')
|
||||
const { Client, buildServer, connection } = require('../../utils')
|
||||
let clientVersion = require('../../../package.json').version
|
||||
if (clientVersion.includes('-')) {
|
||||
clientVersion = clientVersion.slice(0, clientVersion.indexOf('-')) + 'p'
|
||||
@ -913,6 +913,55 @@ test('bulk update', t => {
|
||||
})
|
||||
})
|
||||
|
||||
t.test('Should track the number of noop results', async t => {
|
||||
let count = 0
|
||||
const MockConnection = connection.buildMockConnection({
|
||||
onRequest (params) {
|
||||
t.strictEqual(params.path, '/_bulk')
|
||||
t.match(params.headers, { 'content-type': 'application/x-ndjson' })
|
||||
const [action, payload] = params.body.split('\n')
|
||||
t.deepEqual(JSON.parse(action), { update: { _index: 'test', _id: count } })
|
||||
t.deepEqual(JSON.parse(payload), { doc: dataset[count++], doc_as_upsert: true })
|
||||
return { body: { errors: false, items: [{ update: { result: 'noop' } }] } }
|
||||
}
|
||||
})
|
||||
|
||||
const client = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
Connection: MockConnection
|
||||
})
|
||||
let id = 0
|
||||
const result = await client.helpers.bulk({
|
||||
datasource: dataset.slice(),
|
||||
flushBytes: 1,
|
||||
concurrency: 1,
|
||||
onDocument (doc) {
|
||||
return [{
|
||||
update: {
|
||||
_index: 'test',
|
||||
_id: id++
|
||||
}
|
||||
}, {
|
||||
doc_as_upsert: true
|
||||
}]
|
||||
},
|
||||
onDrop (doc) {
|
||||
t.fail('This should never be called')
|
||||
}
|
||||
})
|
||||
|
||||
t.type(result.time, 'number')
|
||||
t.type(result.bytes, 'number')
|
||||
t.match(result, {
|
||||
total: 3,
|
||||
successful: 3,
|
||||
noop: 3,
|
||||
retry: 0,
|
||||
failed: 0,
|
||||
aborted: false
|
||||
})
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
@ -1263,5 +1312,52 @@ test('Flush interval', t => {
|
||||
})
|
||||
})
|
||||
|
||||
t.test('Operation stats', async t => {
|
||||
let count = 0
|
||||
const MockConnection = connection.buildMockConnection({
|
||||
onRequest (params) {
|
||||
t.strictEqual(params.path, '/_bulk')
|
||||
t.match(params.headers, {
|
||||
'content-type': 'application/x-ndjson',
|
||||
'x-elastic-client-meta': `es=${clientVersion},js=${nodeVersion},t=${clientVersion},hc=${nodeVersion},h=bp`
|
||||
})
|
||||
const [action, payload] = params.body.split('\n')
|
||||
t.deepEqual(JSON.parse(action), { index: { _index: 'test' } })
|
||||
t.deepEqual(JSON.parse(payload), dataset[count++])
|
||||
return { body: { errors: false, items: [{}] } }
|
||||
}
|
||||
})
|
||||
|
||||
const client = new Client({
|
||||
node: 'http://localhost:9200',
|
||||
Connection: MockConnection
|
||||
})
|
||||
const b = client.helpers.bulk({
|
||||
datasource: dataset.slice(),
|
||||
flushBytes: 1,
|
||||
concurrency: 1,
|
||||
onDocument (doc) {
|
||||
return {
|
||||
index: { _index: 'test' }
|
||||
}
|
||||
},
|
||||
onDrop (doc) {
|
||||
t.fail('This should never be called')
|
||||
}
|
||||
})
|
||||
const result = await b
|
||||
|
||||
t.type(result.time, 'number')
|
||||
t.type(result.bytes, 'number')
|
||||
t.match(result, b.stats)
|
||||
t.match(result, {
|
||||
total: 3,
|
||||
successful: 3,
|
||||
retry: 0,
|
||||
failed: 0,
|
||||
aborted: false
|
||||
})
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client, errors } = require('../../../')
|
||||
const { connection } = require('../../utils')
|
||||
const { errors } = require('../../../')
|
||||
const { Client, connection } = require('../../utils')
|
||||
const FakeTimers = require('@sinonjs/fake-timers')
|
||||
|
||||
test('Basic', async t => {
|
||||
|
||||
@ -20,8 +20,8 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client, errors } = require('../../../')
|
||||
const { connection } = require('../../utils')
|
||||
const { errors } = require('../../../')
|
||||
const { Client, connection } = require('../../utils')
|
||||
let clientVersion = require('../../../package.json').version
|
||||
if (clientVersion.includes('-')) {
|
||||
clientVersion = clientVersion.slice(0, clientVersion.indexOf('-')) + 'p'
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
'use strict'
|
||||
|
||||
const { test } = require('tap')
|
||||
const { Client } = require('../../../')
|
||||
const { connection } = require('../../utils')
|
||||
const { Client, connection } = require('../../utils')
|
||||
|
||||
test('Search should have an additional documents property', async t => {
|
||||
const MockConnection = connection.buildMockConnection({
|
||||
|
||||
@ -27,6 +27,7 @@ const os = require('os')
|
||||
const intoStream = require('into-stream')
|
||||
const {
|
||||
buildServer,
|
||||
skipProductCheck,
|
||||
connection: { MockConnection, MockConnectionTimeout, MockConnectionError }
|
||||
} = require('../utils')
|
||||
const {
|
||||
@ -65,6 +66,7 @@ test('Basic', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -92,6 +94,7 @@ test('Basic (promises support)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport
|
||||
.request({
|
||||
@ -119,6 +122,7 @@ test('Basic - failing (promises support)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport
|
||||
.request({
|
||||
@ -145,6 +149,7 @@ test('Basic (options + promises support)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport
|
||||
.request({
|
||||
@ -190,6 +195,7 @@ test('Send POST', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -246,6 +252,7 @@ test('Send POST (ndjson)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -289,6 +296,7 @@ test('Send stream', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -332,6 +340,7 @@ test('Send stream (bulkBody)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -365,6 +374,7 @@ test('Not JSON payload from server', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -396,6 +406,7 @@ test('NoLivingConnectionsError (null connection)', t => {
|
||||
return null
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -424,6 +435,7 @@ test('NoLivingConnectionsError (undefined connection)', t => {
|
||||
return undefined
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -447,6 +459,7 @@ test('SerializationError', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const body = { hello: 'world' }
|
||||
body.o = body
|
||||
@ -473,6 +486,7 @@ test('SerializationError (bulk)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const bulkBody = { hello: 'world' }
|
||||
bulkBody.o = bulkBody
|
||||
@ -505,6 +519,7 @@ test('DeserializationError', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -541,6 +556,7 @@ test('TimeoutError (should call markDead on the failing connection)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -575,6 +591,7 @@ test('ConnectionError (should call markDead on the failing connection)', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -620,6 +637,7 @@ test('Retry mechanism', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -664,6 +682,7 @@ test('Should not retry if the body is a stream', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -709,6 +728,7 @@ test('Should not retry if the bulkBody is a stream', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -754,6 +774,7 @@ test('No retry', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -805,6 +826,7 @@ test('Custom retry mechanism', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -852,6 +874,7 @@ test('Should not retry on 429', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -889,6 +912,7 @@ test('Should call markAlive with a successful response', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -926,6 +950,7 @@ test('Should call resurrect on every request', t => {
|
||||
sniffOnStart: false,
|
||||
name: 'elasticsearch-js'
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -954,6 +979,7 @@ test('Should return a request aborter utility', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const request = transport.request({
|
||||
method: 'GET',
|
||||
@ -1002,6 +1028,7 @@ test('Retry mechanism and abort', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const request = transport.request({
|
||||
method: 'GET',
|
||||
@ -1031,6 +1058,7 @@ test('Abort a request with the promise API', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const request = transport.request({
|
||||
method: 'GET',
|
||||
@ -1070,6 +1098,7 @@ test('ResponseError', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1105,6 +1134,7 @@ test('Override requestTimeout', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1167,6 +1197,7 @@ test('sniff', t => {
|
||||
sniffOnConnectionFault: true,
|
||||
sniffEndpoint: '/sniff'
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1200,6 +1231,7 @@ test('sniff', t => {
|
||||
sniffInterval: 1,
|
||||
sniffEndpoint: '/sniff'
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const params = { method: 'GET', path: '/' }
|
||||
clock.tick(100)
|
||||
@ -1233,6 +1265,7 @@ test('sniff', t => {
|
||||
sniffInterval: false,
|
||||
sniffEndpoint: '/sniff'
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.sniff((err, hosts) => {
|
||||
t.ok(err instanceof ConnectionError)
|
||||
@ -1269,6 +1302,7 @@ test(`Should mark as dead connections where the statusCode is 502/3/4
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1323,6 +1357,7 @@ test('Should retry the request if the statusCode is 502/3/4', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1354,6 +1389,7 @@ test('Ignore status code', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1403,6 +1439,7 @@ test('Should serialize the querystring', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1446,6 +1483,7 @@ test('timeout option', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1476,6 +1514,7 @@ test('timeout option', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1512,6 +1551,7 @@ test('timeout option', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1542,6 +1582,7 @@ test('timeout option', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1576,6 +1617,7 @@ test('Should cast to boolean HEAD request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'HEAD',
|
||||
@ -1601,6 +1643,7 @@ test('Should cast to boolean HEAD request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'HEAD',
|
||||
@ -1627,6 +1670,7 @@ test('Should cast to boolean HEAD request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'HEAD',
|
||||
@ -1652,6 +1696,7 @@ test('Should cast to boolean HEAD request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'HEAD',
|
||||
@ -1694,6 +1739,7 @@ test('Suggest compression', t => {
|
||||
sniffOnStart: false,
|
||||
suggestCompression: true
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1734,6 +1780,7 @@ test('Broken compression', t => {
|
||||
sniffOnStart: false,
|
||||
suggestCompression: true
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1769,6 +1816,7 @@ test('Warning header', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1806,6 +1854,7 @@ test('Warning header', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1840,6 +1889,7 @@ test('Warning header', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1875,6 +1925,7 @@ test('asStream set to true', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -1933,6 +1984,7 @@ test('Compress request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -1981,6 +2033,7 @@ test('Compress request', t => {
|
||||
sniffOnStart: false,
|
||||
compression: 'gzip'
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -2026,6 +2079,7 @@ test('Compress request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -2085,6 +2139,7 @@ test('Compress request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'DELETE',
|
||||
@ -2151,6 +2206,7 @@ test('Compress request', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'POST',
|
||||
@ -2195,6 +2251,7 @@ test('Headers configuration', t => {
|
||||
'x-foo': 'bar'
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2234,6 +2291,7 @@ test('Headers configuration', t => {
|
||||
'x-foo': 'bar'
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2272,6 +2330,7 @@ test('Headers configuration', t => {
|
||||
'x-foo': 'bar'
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2312,6 +2371,7 @@ test('nodeFilter and nodeSelector', t => {
|
||||
return conns[0]
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2345,6 +2405,7 @@ test('Should accept custom querystring in the optons object', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2381,6 +2442,7 @@ test('Should accept custom querystring in the optons object', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2425,6 +2487,7 @@ test('Should add an User-Agent header', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2459,6 +2522,7 @@ test('Should pass request params and options to generateRequestId', t => {
|
||||
return 'id'
|
||||
}
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request(params, options, t.error)
|
||||
})
|
||||
@ -2484,6 +2548,7 @@ test('Secure json parsing', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2516,6 +2581,7 @@ test('Secure json parsing', t => {
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
@ -2574,6 +2640,7 @@ test('The callback with a sync error should be called in the next tick - json',
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const body = { a: true }
|
||||
body.o = body
|
||||
@ -2605,6 +2672,7 @@ test('The callback with a sync error should be called in the next tick - ndjson'
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
const field = { a: true }
|
||||
field.o = field
|
||||
@ -2621,3 +2689,76 @@ test('The callback with a sync error should be called in the next tick - ndjson'
|
||||
t.type(transportReturn.catch, 'function')
|
||||
t.type(transportReturn.abort, 'function')
|
||||
})
|
||||
|
||||
test('Support mapbox vector tile', t => {
|
||||
t.plan(2)
|
||||
const mvtContent = 'GoMCCgRtZXRhEikSFAAAAQACAQMBBAAFAgYDBwAIBAkAGAMiDwkAgEAagEAAAP8//z8ADxoOX3NoYXJkcy5mYWlsZWQaD19zaGFyZHMuc2tpcHBlZBoSX3NoYXJkcy5zdWNjZXNzZnVsGg1fc2hhcmRzLnRvdGFsGhlhZ2dyZWdhdGlvbnMuX2NvdW50LmNvdW50GhdhZ2dyZWdhdGlvbnMuX2NvdW50LnN1bRoTaGl0cy50b3RhbC5yZWxhdGlvbhoQaGl0cy50b3RhbC52YWx1ZRoJdGltZWRfb3V0GgR0b29rIgIwACICMAIiCRkAAAAAAAAAACIECgJlcSICOAAogCB4Ag=='
|
||||
|
||||
function handler (req, res) {
|
||||
res.setHeader('Content-Type', 'application/vnd.mapbox-vector-tile')
|
||||
res.end(Buffer.from(mvtContent, 'base64'))
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
const pool = new ConnectionPool({ Connection })
|
||||
pool.addConnection(`http://localhost:${port}`)
|
||||
|
||||
const transport = new Transport({
|
||||
emit: () => {},
|
||||
connectionPool: pool,
|
||||
serializer: new Serializer(),
|
||||
maxRetries: 3,
|
||||
requestTimeout: 30000,
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
path: '/hello'
|
||||
}, (err, { body }) => {
|
||||
t.error(err)
|
||||
t.same(body.toString('base64'), Buffer.from(mvtContent, 'base64').toString('base64'))
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
test('Compressed mapbox vector tile', t => {
|
||||
t.plan(2)
|
||||
const mvtContent = 'GoMCCgRtZXRhEikSFAAAAQACAQMBBAAFAgYDBwAIBAkAGAMiDwkAgEAagEAAAP8//z8ADxoOX3NoYXJkcy5mYWlsZWQaD19zaGFyZHMuc2tpcHBlZBoSX3NoYXJkcy5zdWNjZXNzZnVsGg1fc2hhcmRzLnRvdGFsGhlhZ2dyZWdhdGlvbnMuX2NvdW50LmNvdW50GhdhZ2dyZWdhdGlvbnMuX2NvdW50LnN1bRoTaGl0cy50b3RhbC5yZWxhdGlvbhoQaGl0cy50b3RhbC52YWx1ZRoJdGltZWRfb3V0GgR0b29rIgIwACICMAIiCRkAAAAAAAAAACIECgJlcSICOAAogCB4Ag=='
|
||||
|
||||
function handler (req, res) {
|
||||
const body = gzipSync(Buffer.from(mvtContent, 'base64'))
|
||||
res.setHeader('Content-Type', 'application/vnd.mapbox-vector-tile')
|
||||
res.setHeader('Content-Encoding', 'gzip')
|
||||
res.setHeader('Content-Length', Buffer.byteLength(body))
|
||||
res.end(body)
|
||||
}
|
||||
|
||||
buildServer(handler, ({ port }, server) => {
|
||||
const pool = new ConnectionPool({ Connection })
|
||||
pool.addConnection(`http://localhost:${port}`)
|
||||
|
||||
const transport = new Transport({
|
||||
emit: () => {},
|
||||
connectionPool: pool,
|
||||
serializer: new Serializer(),
|
||||
maxRetries: 3,
|
||||
requestTimeout: 30000,
|
||||
sniffInterval: false,
|
||||
sniffOnStart: false
|
||||
})
|
||||
skipProductCheck(transport)
|
||||
|
||||
transport.request({
|
||||
method: 'GET',
|
||||
path: '/hello'
|
||||
}, (err, { body }) => {
|
||||
t.error(err)
|
||||
t.same(body.toString('base64'), Buffer.from(mvtContent, 'base64').toString('base64'))
|
||||
server.stop()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@ -133,7 +133,7 @@ function buildMockConnection (opts) {
|
||||
|
||||
class MockConnection extends Connection {
|
||||
request (params, callback) {
|
||||
let { body, statusCode } = opts.onRequest(params)
|
||||
let { body, statusCode, headers } = opts.onRequest(params)
|
||||
if (typeof body !== 'string') {
|
||||
body = JSON.stringify(body)
|
||||
}
|
||||
@ -144,7 +144,8 @@ function buildMockConnection (opts) {
|
||||
'content-type': 'application/json;utf=8',
|
||||
date: new Date().toISOString(),
|
||||
connection: 'keep-alive',
|
||||
'content-length': Buffer.byteLength(body)
|
||||
'content-length': Buffer.byteLength(body),
|
||||
...headers
|
||||
}
|
||||
process.nextTick(() => {
|
||||
if (!aborted) {
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
|
||||
'use strict'
|
||||
|
||||
const crypto = require('crypto')
|
||||
const debug = require('debug')('elasticsearch-test')
|
||||
const stoppable = require('stoppable')
|
||||
|
||||
@ -35,6 +36,13 @@ const secureOpts = {
|
||||
cert: readFileSync(join(__dirname, '..', 'fixtures', 'https.cert'), 'utf8')
|
||||
}
|
||||
|
||||
const caFingerprint = getFingerprint(secureOpts.cert
|
||||
.split('\n')
|
||||
.slice(1, -1)
|
||||
.map(line => line.trim())
|
||||
.join('')
|
||||
)
|
||||
|
||||
let id = 0
|
||||
function buildServer (handler, opts, cb) {
|
||||
const serverId = id++
|
||||
@ -58,7 +66,7 @@ function buildServer (handler, opts, cb) {
|
||||
server.listen(0, () => {
|
||||
const port = server.address().port
|
||||
debug(`Server '${serverId}' booted on port ${port}`)
|
||||
resolve([Object.assign({}, secureOpts, { port }), server])
|
||||
resolve([Object.assign({}, secureOpts, { port, caFingerprint }), server])
|
||||
})
|
||||
})
|
||||
} else {
|
||||
@ -70,4 +78,11 @@ function buildServer (handler, opts, cb) {
|
||||
}
|
||||
}
|
||||
|
||||
function getFingerprint (content, inputEncoding = 'base64', outputEncoding = 'hex') {
|
||||
const shasum = crypto.createHash('sha256')
|
||||
shasum.update(content, inputEncoding)
|
||||
const res = shasum.digest(outputEncoding)
|
||||
return res.toUpperCase().match(/.{1,2}/g).join(':')
|
||||
}
|
||||
|
||||
module.exports = buildServer
|
||||
|
||||
@ -25,6 +25,7 @@ const buildServer = require('./buildServer')
|
||||
const buildCluster = require('./buildCluster')
|
||||
const buildProxy = require('./buildProxy')
|
||||
const connection = require('./MockConnection')
|
||||
const { Client } = require('../../')
|
||||
|
||||
async function waitCluster (client, waitForStatus = 'green', timeout = '50s', times = 0) {
|
||||
if (!client) {
|
||||
@ -41,10 +42,25 @@ async function waitCluster (client, waitForStatus = 'green', timeout = '50s', ti
|
||||
}
|
||||
}
|
||||
|
||||
function skipProductCheck (client) {
|
||||
const tSymbol = Object.getOwnPropertySymbols(client.transport || client)
|
||||
.filter(symbol => symbol.description === 'product check')[0]
|
||||
;(client.transport || client)[tSymbol] = 2
|
||||
}
|
||||
|
||||
class NoProductCheckClient extends Client {
|
||||
constructor (opts) {
|
||||
super(opts)
|
||||
skipProductCheck(this)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
buildServer,
|
||||
buildCluster,
|
||||
buildProxy,
|
||||
connection,
|
||||
waitCluster
|
||||
waitCluster,
|
||||
skipProductCheck,
|
||||
Client: NoProductCheckClient
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user