diff --git a/.ci/license/check-license-headers.sh b/.ci/license/check-license-headers.sh index e94203302..8470661f7 100755 --- a/.ci/license/check-license-headers.sh +++ b/.ci/license/check-license-headers.sh @@ -37,13 +37,13 @@ function check_license_header { cd "$TOP" nErrors=0 -for f in $(git ls-files --directory ../ | grep '\.ts$'); do +for f in $(git ls-files --directory ../ | grep '\.ts$' | grep -v '^docs/'); do if ! check_license_header $f; then nErrors=$((nErrors+1)) fi done -for f in $(git ls-files --directory ../ | grep '\.js$'); do +for f in $(git ls-files --directory ../ | grep '\.js$' | grep -v '^docs/'); do if ! check_license_header $f; then nErrors=$((nErrors+1)) fi @@ -53,4 +53,4 @@ if [[ $nErrors -eq 0 ]]; then exit 0 else exit 1 -fi \ No newline at end of file +fi diff --git a/.github/workflows/changelog_verifier.yml b/.github/workflows/changelog_verifier.yml index 96f99f17b..992a38b62 100644 --- a/.github/workflows/changelog_verifier.yml +++ b/.github/workflows/changelog_verifier.yml @@ -15,4 +15,4 @@ jobs: - uses: dangoslen/changelog-enforcer@v3 with: - skipLabels: "autocut" + skipLabels: "autocut, skip-changelog" diff --git a/.github/workflows/gh_pages.yml b/.github/workflows/gh_pages.yml new file mode 100644 index 000000000..9d40effde --- /dev/null +++ b/.github/workflows/gh_pages.yml @@ -0,0 +1,37 @@ +name: Publish Docs to Github Pages +on: + workflow_dispatch: + push: + branches: [main, jsdoc] +jobs: + update-docs: + runs-on: ubuntu-latest + name: Update gh-pages with docs + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v1 + with: + ruby-version: 16.x + - name: Install Tools + run: | + sudo apt install -y jq + npm install -g jsdoc + - name: Generate Docs + run: | + export PACKAGE_VERSION=$(jq .version package.json -r | awk -F. '{print $1"."$2}') + export DOC_FOLDER=docs/$PACKAGE_VERSION + jsdoc api lib -d $DOC_FOLDER -r --readme README.md + cp *.md $DOC_FOLDER + cp *.txt $DOC_FOLDER + - name: Commit Docs Change + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + add: 'docs/* -f' + - name: Deploy Docs to gh-pages + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs + keep_files: true + enable_jekyll: true diff --git a/.gitignore b/.gitignore index 09aaa949d..d8abd2df1 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,9 @@ opensearch* !opensearch_dashboards* !opensearchDashboards* +# documentation +docs/ + test/benchmarks/macro/fixtures/* *-junit.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index ff56302c0..192b04181 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,12 +5,21 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Added - Add release details to releasing.md ([319](https://github.com/opensearch-project/opensearch-js/pull/319)) - Allow overriding the aws service identifier in AwsSigv4Signer ([333](https://github.com/opensearch-project/opensearch-js/pull/333)) +- Added skip-changelog label ([339](https://github.com/opensearch-project/opensearch-js/pull/339)) +- Added jsdoc for documentation generation ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) +- Documented Transport#request ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) +- Documented all API methods ([#335](https://github.com/opensearch-project/opensearch-js/issues/335)) +### Dependencies +- Bumps `xmlbuilder2` from 2.4.1 to 3.0.2 +- Bumps `minimatch` from 3.0.4 to 3.1.2 + ### Dependencies ### Changed ### Deprecated ### Removed ### Fixed ### Security +- [CVE-2022-25912] Bumps simple-git from 3.4.0 to 3.15.0 ([#341](https://github.com/opensearch-project/opensearch-js/pull/341)) ## [2.1] ### Added @@ -25,4 +34,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fix mutability of connection headers ([#291](https://github.com/opensearch-project/opensearch-js/issues/291)) [2.1]: https://github.com/opensearch-project/opensearch-js/releases/tag/2.1.0 -[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.1...HEAD +[Unreleased]: https://github.com/opensearch-project/opensearch-js/compare/2.1...HEAD \ No newline at end of file diff --git a/api/api/bulk.js b/api/api/bulk.js index d9dd652f1..3fb5a1401 100644 --- a/api/api/bulk.js +++ b/api/api/bulk.js @@ -63,6 +63,29 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * The bulk operation lets you add, update, or delete many documents in a single request. + * Compared to individual OpenSearch indexing requests, the bulk operation has significant performance benefits. + * Whenever practical, we recommend batching indexing operations into bulk requests. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/|OpenSearch - Bulk} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {Object[]} params.body - {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/#request-body|Request Body} + * @param {string} [params.index] - Specifying the index means you don’t need to include it in the request body. + * @param {string} [params.pipeline] - The pipeline ID for preprocessing documents. + * @param {string} [params.routing] - Routes the request to the specified shard. + * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster. + * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed. + * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/document-apis/bulk/#response|Bulk Response} + */ function bulkApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/cat.js b/api/api/cat.js index 394d6db1e..84e2c3d7e 100644 --- a/api/api/cat.js +++ b/api/api/cat.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-CAT */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'format', @@ -69,6 +71,7 @@ const acceptedQuerystring = [ 'nodes', 'actions', 'parent_task_id', + 'pri', ]; const snakeCase = { expandWildcards: 'expand_wildcards', @@ -92,6 +95,22 @@ function CatApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * The CAT aliases operation lists the mapping of aliases to indices, plus routing and filtering information. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ OpenSearch - CAT aliases} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.name] - To limit the information to specific aliases, provide the alias names seperated by commas. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. Default is 'open'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/#response CAT aliases Response} + */ CatApi.prototype.aliases = function catAliasesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -118,6 +137,23 @@ CatApi.prototype.aliases = function catAliasesApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT allocation operation lists the allocation of disk space for indices and the number of shards on each node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ OpenSearch - CAT allocation} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.node_id] - To limit the information to specific nodes, provide the node names seperated by commas. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/#response CAT allocation Response} + */ CatApi.prototype.allocation = function catAllocationApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -144,6 +180,20 @@ CatApi.prototype.allocation = function catAllocationApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * The CAT count operation lists the number of documents in your cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-count/ OpenSearch - CAT count} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.index] - To see the number of documents in specific indices or aliases, provide the index/alias names seperated by commas. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-count/#response CAT count Response} + */ CatApi.prototype.count = function catCountApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -170,6 +220,20 @@ CatApi.prototype.count = function catCountApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT fielddata operation lists the memory size used by each field per node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ OpenSearch - CAT fielddata} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.fields] - To limit the information to specific fields, provide the field names seperated by commas. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/#response CAT fielddata Response} + */ CatApi.prototype.fielddata = function catFielddataApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -196,6 +260,22 @@ CatApi.prototype.fielddata = function catFielddataApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * The CAT health operation lists the status of the cluster, how long the cluster has been up, the number of nodes, + * and other useful information that helps you analyze the health of your cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-health/ OpenSearch - CAT health} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * @param {boolean} [params.ts=true] - If true, returns HH:MM:SS and Unix epoch timestamps. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-health/#response CAT health Response} + */ CatApi.prototype.health = function catHealthApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -217,6 +297,18 @@ CatApi.prototype.health = function catHealthApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * See the available operations in the CAT API + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/index OpenSearch - CAT} + * + * @memberOf API-CAT + * + * @param {Object} params - (ignored) + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ CatApi.prototype.help = function catHelpApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -238,6 +330,27 @@ CatApi.prototype.help = function catHelpApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT indices operation lists information related to indices—how much disk space they are using, how many shards they have, their health status, and so on. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ OpenSearch - CAT indices} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.index] - To limit the information to specific indices, provide the index names seperated by commas. + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * @param {string} [params.health] - Limit indices based on their health status. Supported values are 'green', 'yellow', and 'red'. + * @param {boolean} [params.include_unloaded_segments=false] - Whether to include information from segments not loaded into memory. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {boolean} [params.pri=false] - Whether to return information only from the primary shards. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-indices/#response CAT indices Response} + */ CatApi.prototype.indices = function catIndicesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -264,6 +377,18 @@ CatApi.prototype.indices = function catIndicesApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT cluster manager operation lists information that helps identify the elected cluster manager node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ OpenSearch - CAT cluster manager} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/#response CAT cluster manager Response} + */ CatApi.prototype.cluster_manager = function catClusterManagerApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -310,6 +435,21 @@ CatApi.prototype.master = function catMasterApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT nodeattrs operation lists the attributes of custom nodes. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-nodeattrs/ OpenSearch - CAT aliases} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-nodeattrs/#response CAT nodeattrs Response} + */ CatApi.prototype.nodeattrs = function catNodeattrsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -331,6 +471,25 @@ CatApi.prototype.nodeattrs = function catNodeattrsApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * The CAT nodes operation lists node-level information, including node roles and load metrics. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-nodes/ OpenSearch - CAT nodes} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * @param {boolean} [params.full_id=false] - If true, return the full node ID. If false, return the shortened node ID. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster_manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * @param {boolean} [params.include_unloaded_segments=false] - Whether to include information from segments not loaded into memory. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-nodes/#response CAT nodes Response} + */ CatApi.prototype.nodes = function catNodesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -352,6 +511,22 @@ CatApi.prototype.nodes = function catNodesApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT pending tasks operation lists the progress of all pending tasks, including task priority and time in queue. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-pending-tasks/ OpenSearch - CAT pending tasks} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster_manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-pending-tasks/#response CAT pending tasks Response} + */ CatApi.prototype.pendingTasks = function catPendingTasksApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -373,6 +548,21 @@ CatApi.prototype.pendingTasks = function catPendingTasksApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * The CAT plugins operation lists the names, components, and versions of the installed plugins. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-plugins/ OpenSearch - CAT plugins} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster_manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-plugins/#response CAT plugins Response} + */ CatApi.prototype.plugins = function catPluginsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -394,6 +584,23 @@ CatApi.prototype.plugins = function catPluginsApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT recovery operation lists all completed and ongoing index and shard recoveries. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-recovery/ OpenSearch - CAT recovery} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * @param {boolean} [params.active_only=false] - Whether to only include ongoing shard recoveries. + * @param {boolean} [params.detailed=false] - Whether to only include ongoing shard recoveries. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-recovery/#response CAT recovery Response} + */ CatApi.prototype.recovery = function catRecoveryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -420,6 +627,21 @@ CatApi.prototype.recovery = function catRecoveryApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT repositories operation lists all completed and ongoing index and shard recoveries. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-repositories/ OpenSearch - CAT repositories} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster_manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-repositories/#response CAT repositories Response} + */ CatApi.prototype.repositories = function catRepositoriesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -441,6 +663,22 @@ CatApi.prototype.repositories = function catRepositoriesApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * The cat segments operation lists Lucene segment-level information for each index. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-segments/ OpenSearch - CAT segments} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.index] - To see only the information about segments of specific indices, provide the index names seperated by commas. + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-segments/#response CAT segments Response} + */ CatApi.prototype.segments = function catSegmentsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -467,6 +705,24 @@ CatApi.prototype.segments = function catSegmentsApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT shards operation lists the state of all primary and replica shards and how they are distributed. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-shards/ OpenSearch - CAT shards} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.index] - To see only the information about shards of specific indices, provide the index names seperated by commas. + * @param {string} [params.bytes] - Specify the units for byte size. For example, '7kb' or '6gb'. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster_manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-shards/#response CAT shards Response} + */ CatApi.prototype.shards = function catShardsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -493,6 +749,21 @@ CatApi.prototype.shards = function catShardsApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT snapshots operation lists all snapshots for a repository. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-snapshots/ OpenSearch - CAT snapshots} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-snapshots/#response CAT snapshots Response} + */ CatApi.prototype.snapshots = function catSnapshotsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -519,6 +790,23 @@ CatApi.prototype.snapshots = function catSnapshotsApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * The CAT tasks operation lists the progress of all tasks currently running on your cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-tasks/ OpenSearch - CAT tasks} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {string} [params.nodes] - A comma-separated list of node IDs or names to limit the returned information. Use '_local' to return information from the node you’re connecting to, specify the node name to get information from specific nodes, or keep the parameter empty to get information from all nodes. + * @param {string} [params.time] - Specify the units for time. For example, '5d' or '7h'. + * @param {boolean} [params.detailed=false] - Returns detailed task information. + * @param {string} [params.parent_task_id] - Returns tasks with a specified parent task ID (node_id:task_number). Keep empty or set to -1 to return all. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-tasks/#response CAT tasks Response} + */ CatApi.prototype.tasks = function catTasksApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -540,6 +828,22 @@ CatApi.prototype.tasks = function catTasksApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * The CAT templates operation lists the names, patterns, order numbers, and version numbers of index templates. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-templates/ OpenSearch - CAT templates} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.name] - If you want to limit it to a specific template or pattern, provide the template name or pattern. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-templates/#response CAT templates Response} + */ CatApi.prototype.templates = function catTemplatesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -566,6 +870,21 @@ CatApi.prototype.templates = function catTemplatesApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * The CAT thread pool operation lists the active, queued, and rejected threads of different thread pools on each node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cat/cat-thread-pool/ OpenSearch - CAT thread pool} + * + * @memberOf API-CAT + * + * @param {Object} params - Accepts {@link https://opensearch.org/docs/latest/api-reference/cat/index#optional-query-parameters - common CAT parameters} along with the following unique parameters: + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cat/cat-thread-pool/#response CAT thread pool Response} + */ CatApi.prototype.threadPool = function catThreadPoolApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/clear_scroll.js b/api/api/clear_scroll.js index 143a7ff9e..07128d4d0 100644 --- a/api/api/clear_scroll.js +++ b/api/api/clear_scroll.js @@ -36,6 +36,20 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Close the search context when you’re done scrolling, because the scroll operation continues to consume computing resources until the timeout. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/scroll/ OpenSearch - Scroll } + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.scroll_id] The ID of the scroll to be terminated. Use `_all` to close all open scroll contexts. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function clearScrollApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/cluster.js b/api/api/cluster.js index 860414dfc..89379796f 100644 --- a/api/api/cluster.js +++ b/api/api/cluster.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Cluster */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'include_yes_decisions', @@ -100,6 +102,26 @@ function ClusterApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * The most basic cluster allocation explain request finds an unassigned shard and explains why it can’t be allocated to a node. If you add some options, you can instead get information on a specific shard, including why OpenSearch assigned it to its current node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-allocation/ OpenSearch - Cluster allocation explain} + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {boolean} [params.include_yes_decisions=false] - OpenSearch makes a series of yes or no decisions when trying to allocate a shard to a node. If this parameter is true, OpenSearch includes the (generally more numerous) “yes” decisions in its response. + * @param {boolean} [params.include_disk_info=false] - Whether to include information about disk usage in the response. + * @param {Object} [params.body] + * @param {string} [params.body.current_node] - If you only want an explanation if the shard happens to be on a particular node, specify that node name here. + * @param {string} [params.body.index] - The name of the shard’s index. + * @param {boolean} [params.body.primary] - Whether to provide an explanation for the primary shard (true) or its first replica (false), which share the same shard ID. + * @param {number} [params.body.shard] - The shard ID that you want an explanation for. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-allocation/#response Cluster allocation explain Response} + */ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi( params, options, @@ -125,6 +147,19 @@ ClusterApi.prototype.allocationExplain = function clusterAllocationExplainApi( return this.transport.request(request, options, callback); }; +/** + * Delete Component Template(s) + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string} [params.name] The name of the component template to be deleted. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTemplateApi( params, options, @@ -156,6 +191,19 @@ ClusterApi.prototype.deleteComponentTemplate = function clusterDeleteComponentTe return this.transport.request(request, options, callback); }; +/** + * Clears cluster voting config exclusions. + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {boolean} [params.wait_for_removal] Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVotingConfigExclusionsApi( params, options, @@ -181,6 +229,19 @@ ClusterApi.prototype.deleteVotingConfigExclusions = function clusterDeleteVoting return this.transport.request(request, options, callback); }; +/** + * Information about whether a particular component template exist + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {boolean} [params.name] Name of the template + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTemplateApi( params, options, @@ -212,6 +273,19 @@ ClusterApi.prototype.existsComponentTemplate = function clusterExistsComponentTe return this.transport.request(request, options, callback); }; +/** + * Returns one or more component templates + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string | string[]} [params.name] Name(s) of the template(s) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplateApi( params, options, @@ -242,6 +316,21 @@ ClusterApi.prototype.getComponentTemplate = function clusterGetComponentTemplate return this.transport.request(request, options, callback); }; +/** + * Get Cluster Settings + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-settings/ OpenSearch - Cluster Settings} + * @memberOf API-Cluster + * + * @param {Object} params + * ç + * @param {boolean} [params.include_defaults] Whether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -263,6 +352,30 @@ ClusterApi.prototype.getSettings = function clusterGetSettingsApi(params, option return this.transport.request(request, options, callback); }; +/** + * The most basic cluster health request returns a simple status of the health of your cluster. OpenSearch expresses cluster health in three colors: green, yellow, and red. A green status means all primary shards and their replicas are allocated to nodes. A yellow status means all primary shards are allocated to nodes, but some replicas aren’t. A red status means at least one primary shard is not allocated to any node. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-health/ OpenSearch - Cluster Health} + * @memberOf API-Cluster + * + * @param {Object} params + * @param {} [params.index] - To get the status of a specific index, provide the index name. + * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. + * @param {string} [params.level=cluster] - The level of detail for returned health information. Supported values are 'cluster', 'indices', and 'shards'. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.timeout=30s] - The amount of time to wait for a response from the cluster. + * @param {string} [params.wait_for_active_shards=0] - Wait until the specified number of shards is active before returning a response. 'all' for all shards + * @param {string} [params.wait_for_nodes] - Wait for N number of nodes. Use 12 for exact match, >12 and <12 for range. + * @param {string} [params.wait_for_events] - Wait until all currently queued events with the given priority are processed. Supported values are 'immediate', 'urgent', 'high', 'normal', 'low', and 'languid'. + * @param {boolean} [params.wait_for_no_relocating_shards=false] - Whether to wait until there are no relocating shards in the cluster. + * @param {boolean} [params.wait_for_no_initializing_shards=false] - Whether to wait until there are no initializing shards in the cluster. + * @param {string} [params.wait_for_status] - Wait until the cluster health reaches the specified status or better. Supported values are 'green', 'yellow', and 'red'. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-health/#response Cluster Health Response} + */ ClusterApi.prototype.health = function clusterHealthApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -289,6 +402,19 @@ ClusterApi.prototype.health = function clusterHealthApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Get a list of any cluster-level changes + * @memberOf API-Cluster + * + * @param {Object} params + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -310,6 +436,19 @@ ClusterApi.prototype.pendingTasks = function clusterPendingTasksApi(params, opti return this.transport.request(request, options, callback); }; +/** + * Updates the cluster voting config exclusions by node ids or node names. + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string} [params.node_names] - A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify node_names. + * @param {string} [params.node_ids] - A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify node_ids. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConfigExclusionsApi( params, options, @@ -335,6 +474,22 @@ ClusterApi.prototype.postVotingConfigExclusions = function clusterPostVotingConf return this.transport.request(request, options, callback); }; +/** + * Creates or updates a component template + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string} params.name - The name of the component template. + * @param {object} params.body - The template definition. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {boolean} [params.create=false] - Whether the index template should only be added if new or can also replace an existing one. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplateApi( params, options, @@ -370,6 +525,22 @@ ClusterApi.prototype.putComponentTemplate = function clusterPutComponentTemplate return this.transport.request(request, options, callback); }; +/** + * Updates the cluster settings. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-settings/ OpenSearch - Cluster Settings} + * @memberOf API-Cluster + * + * @param {Object} params + * @param {boolean} [params.flat_settings] Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {string} [params.timeout=30s] - The amount of time to wait for a response from the cluster. + * @param {object} params.body - The settings to be updated. Can be either 'transient' or 'persistent' (survives cluster restart). + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -397,6 +568,17 @@ ClusterApi.prototype.putSettings = function clusterPutSettingsApi(params, option return this.transport.request(request, options, callback); }; +/** + * This operation provides connection information for any remote OpenSearch clusters that you’ve configured for the local cluster, such as the remote cluster alias, connection mode (sniff or proxy), IP addresses for seed nodes, and timeout settings. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/remote-info/ OpenSearch - Remote cluster information} + * @memberOf API-Cluster + * + * @param {Object} params - (Unused) + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/remote-info/#response Remote cluster information } + */ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -418,6 +600,23 @@ ClusterApi.prototype.remoteInfo = function clusterRemoteInfoApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Allows to manually change the allocation of individual shards in the cluster. + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {object} [params.body] - The definition of 'commands' to perform ('move', 'cancel', 'allocate') + * @param {boolean} [params.dry_run] - Simulate the operation only and return the resulting state + * @param {boolean} [params.explain] - Return an explanation of why the commands can or cannot be executed + * @param {boolean} [params.retry_failed] - Retries allocation of shards that are blocked due to too many subsequent allocation failures + * @param {string | string[]} [params.metric] - Limit the information returned to the specified metrics. Defaults to all but metadata (options: _all, blocks, metadata, nodes, routing_table, cluster_manager_node, version) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -439,6 +638,28 @@ ClusterApi.prototype.reroute = function clusterRerouteApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Get comprehensive information about the state of the cluster. + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string | string[]} [params.metric] - Limit the information returned to the specified metrics. Defaults to all but metadata (options: _all, blocks, metadata, nodes, routing_table, cluster_manager_node, version). + * @param {string | string[]} [params.index] - List of index names; use '_all' or empty string to perform the operation on all indices. + * @param {boolean} [params.local=false] - Whether to return information from the local node only instead of from the cluster manager node. + * @param {string} [params.cluster_manager_timeout=30s] - The amount of time to wait for a connection to the cluster manager node. + * @param {boolean} [params.flat_settings=false] - Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. + * @param {number} [params.wait_for_metadata_version] - Wait for the metadata version to be equal or greater than the specified metadata version. + * @param {string} [params.wait_for_timeout=30s] - The maximum time to wait for wait_for_metadata_version before timing out + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. Default is 'open'. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ ClusterApi.prototype.state = function clusterStateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -482,6 +703,22 @@ ClusterApi.prototype.state = function clusterStateApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * The CAT aliases operation lists the mapping of aliases to indices, plus routing and filtering information. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/cluster-stats/ OpenSearch - Cluster stats} + * + * @memberOf API-Cluster + * + * @param {Object} params + * @param {string | string[]} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use '_local' to return information from the node you're connecting to, leave empty to get information from all nodes. + * + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/cluster-stats/#response Cluster stats Response} + */ + ClusterApi.prototype.stats = function clusterStatsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/count.js b/api/api/count.js index 12d83a2c3..c436297b4 100644 --- a/api/api/count.js +++ b/api/api/count.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Count */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'ignore_unavailable', @@ -67,6 +69,32 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * The count API gives you quick access to the number of documents that match a query. You can also use it to check the document count of an index, data stream, or cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/count/ OpenSearch - Bulk} + * + * @memberOf API-Count + * + * @param {Object} params + * @param {boolean} [params.allow_no_indices=false] - If false, the request returns an error if any wildcard expression or index alias targets any closed or missing indices. + * @param {string} [params.analyzer] - The analyzer to use in the query string. + * @param {boolean} [params.analyze_wildcard=false] - Specifies whether to analyze wildcard and prefix queries. + * @param {string} [params.default_operator='OR'] - Indicates whether the default operator for a string query should be 'AND' or 'OR'. + * @param {string} [params.df] - The default field in case a field prefix is not provided in the query string. + * @param {string} [params.expand_wildcards=open] - Expands wildcard expressions to concrete indices. Combine multiple values with commas. Supported values are 'all', 'open', 'closed', 'hidden', and 'none'. + * @param {boolean} [params.ignore_unavailable=false] - Specifies whether to include missing or closed indices in the response. + * @param {boolean} [params.lenient=false] - Specifies whether OpenSearch should accept requests if queries have format errors (for example, querying a text field for an integer). + * @param {number} [params.min_score] - Include only documents with a minimum '_score' value in the result. + * @param {string} [params.routing] - Value used to route the operation to a specific shard. + * @param {string} [params.preference] - Specifies which shard or node OpenSearch should perform the count operation on. + * @param {number} [params.terminate_after] - The maximum number of documents OpenSearch should process before terminating the request. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/count/#response Count Response} + */ + function countApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/create.js b/api/api/create.js index 896710d9e..32d234466 100644 --- a/api/api/create.js +++ b/api/api/create.js @@ -54,6 +54,32 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Adds a document with a predefined ID to an index. + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/ OpenSearch - Index Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - A unique identifier to attach to the document. + * @param {Object} params.body - The content of the document. + * @param {number} [params.if_seq_no] - Only perform the index operation if the document has the specified sequence number. + * @param {number} [params.if_primary_term] - Only perform the index operation if the document has the specified primary term. + * @param {string} [params.pipeline] - Route the index operation to a certain pipeline. + * @param {string} [params.routing] - value used to assign the index operation to a specific shard. + * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed. + * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/#response Index Response} + */ function createApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/dangling_indices.js b/api/api/dangling_indices.js index 2a62a99d9..4647a8400 100644 --- a/api/api/dangling_indices.js +++ b/api/api/dangling_indices.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Dangling-Indices */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'accept_data_loss', @@ -57,6 +59,22 @@ function DanglingIndicesApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Deletes the specified dangling index + *
See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes} + * @memberOf API-Dangling-Indices + * + * @param {Object} params + * @param {string} params.index_uuid - The UUID of the dangling index + * @param {boolean} [params.accept_data_loss] - Must be set to true in order to delete the dangling index + * @param {string} [params.timeout=30s] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDeleteDanglingIndexApi( params, options, @@ -90,6 +108,22 @@ DanglingIndicesApi.prototype.deleteDanglingIndex = function danglingIndicesDelet return this.transport.request(request, options, callback); }; +/** + * Imports the specified dangling index + *
See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes} + * @memberOf API-Dangling-Indices + * + * @param {Object} params + * @param {string} params.index_uuid - The UUID of the dangling index + * @param {boolean} [params.accept_data_loss] - Must be set to true in order to delete the dangling index + * @param {string} [params.timeout=30s] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImportDanglingIndexApi( params, options, @@ -123,6 +157,17 @@ DanglingIndicesApi.prototype.importDanglingIndex = function danglingIndicesImpor return this.transport.request(request, options, callback); }; +/** + * Retrieve all dangling indices. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/dangling-index/ OpenSearch - Dangling Indexes} + * @memberOf API-Dangling-Indices + * + * @param {Object} params - (Unused) + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ DanglingIndicesApi.prototype.listDanglingIndices = function danglingIndicesListDanglingIndicesApi( params, options, diff --git a/api/api/delete.js b/api/api/delete.js index fff799033..dbdfde11d 100644 --- a/api/api/delete.js +++ b/api/api/delete.js @@ -57,6 +57,29 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Delete a document + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/ OpenSearch - Update Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - A unique identifier to attach to the document. + * @param {number} [params.if_seq_no] - Only perform the delete operation if the document has the specified sequence number. + * @param {number} [params.if_primary_term] - Only perform the delete operation if the document has the specified primary term. + * @param {string} [params.routing] - Value used to assign the index operation to a specific shard. + * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster. + * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/#response Update Response} + */ function deleteApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/delete_by_query.js b/api/api/delete_by_query.js index d4109add1..17f46adc5 100644 --- a/api/api/delete_by_query.js +++ b/api/api/delete_by_query.js @@ -98,6 +98,54 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Deletes documents matching the provided query. + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/delete-by-query/ OpenSearch - Delete by query} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices + * @param {Object} params.body - The search definition using the Query DSL + * @param {string} [params.analyzer] - The analyzer to use for the query string + * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed + * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR) + * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string + * @param {number} [params.from=0] - Starting offset + * @param {boolean} [params.ignore_unavailable=false] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices=true] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified) + * @param {string} [params.conflicts] - What to do when the delete-by-query hits version conflicts? (options: abort, proceed) + * @param {string} [params.expand_wildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.lenient=false] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.q] - Query in the Lucene query string syntax + * @param {string} [params.routing] - A comma-separated list of specific routing values + * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout. + * @param {number} [params.size] - Deprecated, please use 'max_docs' instead + * @param {number} [params.max_docs] - Maximum number of documents to process (default: all documents) + * @param {string} [params.sort] - A comma-separated list of : pairs + * @param {string} [params._source] - True or false to return the _source field or not, or a list of fields to return + * @param {string} [params._source_excludes] - A list of fields to exclude from the returned _source field + * @param {string} [params._source_includes] - A list of fields to extract and return from the _source field + * @param {number} [params.terminate_after] - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * @param {string} [params.stats] - Specific 'tag' of the request for logging and statistical purposes + * @param {boolean} [params.version] - Specify whether to return document version as part of a hit + * @param {boolean} [params.request_cache] - Specify if request cache should be used for this request or not, defaults to index level setting + * @param {boolean} [params.refresh=false] - Should the effected indexes be refreshed? + * @param {string} [params.timeout=1m] - time each individual bulk request should wait for shards that are unavailable. + * @param {string} [params.wait_for_active_shards=1] - Sets the number of shard copies that must be active before proceeding with the delete-by-query operation. 1 means the primary shard only. Set to 'all' for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * @param {number} [params.scroll_size=1000] - Size on the scroll request powering the delete-by-query + * @param {boolean} [params.wait_for_completion] - Should the request should block until the delete-by-query is complete. + * @param {number} [params.requests_per_second=-1] - The throttle for this request in sub-requests per second. -1 means no throttle. + * @param {string} [params.slices=1] - The number of slices this task should be divided into. 1 means the task isn't sliced into subtasks. Can be set to 'auto'. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/delete-by-query/#response Delete by query Response} + */ function deleteByQueryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/delete_by_query_rethrottle.js b/api/api/delete_by_query_rethrottle.js index f328ea359..654f8b526 100644 --- a/api/api/delete_by_query_rethrottle.js +++ b/api/api/delete_by_query_rethrottle.js @@ -47,6 +47,20 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Changes the number of requests per second for a particular Delete By Query operation. + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.task_id - The task id to rethrottle + * @param {number} params.requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function deleteByQueryRethrottleApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/delete_script.js b/api/api/delete_script.js index c4539743d..ac0c89314 100644 --- a/api/api/delete_script.js +++ b/api/api/delete_script.js @@ -50,6 +50,20 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Delete a stored script. + * @memberOf API-Script + * + * @param {Object} params + * @param {string} params.id - Stored script or search template name + * @param {string} [params.timeout=30s] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function deleteScriptApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/exists.js b/api/api/exists.js index 012b0248f..224ad591f 100644 --- a/api/api/exists.js +++ b/api/api/exists.js @@ -63,6 +63,31 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Check whether a document exists + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - Document ID. + * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards. + * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime. + * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.routing] - A value used to route the operation to a specific shard. + * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response} + */ function existsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/exists_source.js b/api/api/exists_source.js index f5e3f4b1c..41999e7be 100644 --- a/api/api/exists_source.js +++ b/api/api/exists_source.js @@ -32,6 +32,31 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** + * Check whether a document source exists + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - Document ID. + * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards. + * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime. + * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.routing] - A value used to route the operation to a specific shard. + * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response} + */ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'preference', diff --git a/api/api/explain.js b/api/api/explain.js index 9030d1781..656b8fb41 100644 --- a/api/api/explain.js +++ b/api/api/explain.js @@ -66,6 +66,33 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Returns information about why a specific matches (or doesn't match) a query. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/explain/ OpenSearch - Explain} + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.id] - The document ID + * @param {string} [params.index] - The name of the index + * @param {Object} [params.body] - The query definition using the Query DSL + * @param {string} [params.analyzer] - The analyzer to use for the query string + * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed + * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR) + * @param {string} [params.df] - The default field for query string query (default: _all) + * @param {string} [params.stored_fields] - A comma-separated list of stored fields to return in the response + * @param {boolean} [params.lenient] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.q] - Query in the Lucene query string syntax + * @param {string} [params.routing] - Specific routing value + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function explainApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/features.js b/api/api/features.js index 4d96a0709..155ea1eb3 100644 --- a/api/api/features.js +++ b/api/api/features.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Features */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'cluster_manager_timeout', @@ -54,6 +56,18 @@ function FeaturesApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Gets a list of features + * @memberOf API-Features + * + * @param {Object} params + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -75,6 +89,16 @@ FeaturesApi.prototype.getFeatures = function featuresGetFeaturesApi(params, opti return this.transport.request(request, options, callback); }; +/** + * Resets the internal state of features, usually by deleting system indices + * @memberOf API-Features + * + * @param {Object} params - (Unused) + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ FeaturesApi.prototype.resetFeatures = function featuresResetFeaturesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/field_caps.js b/api/api/field_caps.js index c935078fe..5c6ff0137 100644 --- a/api/api/field_caps.js +++ b/api/api/field_caps.js @@ -54,6 +54,25 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Returns the information about the capabilities of fields among multiple indices. + *
See also: {@link https://opensearch.org/docs/latest/opensearch/supported-field-types/alias/#using-aliases-in-field-capabilities-api-operations OpenSearch - Alias} + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.fields] - A comma-separated list of field names + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.include_unmapped] - Indicates whether unmapped fields should be included in the response. + * @param {Object} [params.body] - An index filter specified with the Query DSL + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function fieldCapsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/get.js b/api/api/get.js index 096dbfa01..20ff721f6 100644 --- a/api/api/get.js +++ b/api/api/get.js @@ -63,6 +63,31 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Retrieve a document + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - Document ID. + * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards. + * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime. + * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.routing] - A value used to route the operation to a specific shard. + * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response} + */ function getApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/get_script.js b/api/api/get_script.js index 61e6e328b..454fa3564 100644 --- a/api/api/get_script.js +++ b/api/api/get_script.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Script */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'cluster_manager_timeout', @@ -49,6 +51,20 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Retrieves a stored script. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/script-apis/get-stored-script/ OpenSearch - Get Stored Script} + * @memberOf API-Script + * + * @param {Object} params + * @param {string} params.id - Stored script or search template name + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function getScriptApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/get_script_context.js b/api/api/get_script_context.js index 832fc72d2..6958aca28 100644 --- a/api/api/get_script_context.js +++ b/api/api/get_script_context.js @@ -36,6 +36,17 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Retrieves all contexts for stored scripts. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/script-apis/get-script-contexts/ OpenSearch - Get stored script contexts} + * @memberOf API-Script + * + * @param {Object} params - (Unused) + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function getScriptContextApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/get_script_languages.js b/api/api/get_script_languages.js index 29e39d9ff..923c6dd52 100644 --- a/api/api/get_script_languages.js +++ b/api/api/get_script_languages.js @@ -36,6 +36,17 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * The get script language API operation retrieves all supported script languages and their contexts. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/script-apis/get-script-language/ OpenSearch - Get script language} + * @memberOf API-Script + * + * @param {Object} params - (Unused) + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function getScriptLanguagesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/get_source.js b/api/api/get_source.js index ff9ac3ec2..2084b1f26 100644 --- a/api/api/get_source.js +++ b/api/api/get_source.js @@ -61,6 +61,31 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Retrieve the source of a document + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/ OpenSearch - Get Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - Document ID. + * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards. + * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime. + * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.routing] - A value used to route the operation to a specific shard. + * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/get-documents/#response Get Response} + */ function getSourceApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/index.js b/api/api/index.js index 389113fb8..03bcab2b7 100644 --- a/api/api/index.js +++ b/api/api/index.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Document */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'wait_for_active_shards', @@ -62,6 +64,33 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Adds a document to an index. + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/ OpenSearch - Index Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {Object} params.body - The content of the document. + * @param {string} [params.id] - A unique identifier to attach to the document. + * @param {number} [params.if_seq_no] - Only perform the index operation if the document has the specified sequence number. + * @param {number} [params.if_primary_term] - Only perform the index operation if the document has the specified primary term. + * @param {string} [params.pipeline] - Route the index operation to a certain pipeline. + * @param {string} [params.routing] - value used to assign the index operation to a specific shard. + * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster. + * @param {number} [params.version] - The document’s version number. + * @param {number} [params.version_type] - Specific version type (options: 'external' and 'external_gte') + * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed. + * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/index-document/#response Index Response} + */ + function indexApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/indices.js b/api/api/indices.js index f94c0f763..5e7ec6b25 100644 --- a/api/api/indices.js +++ b/api/api/indices.js @@ -29,6 +29,8 @@ 'use strict'; +/** @namespace API-Index */ + /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ @@ -128,6 +130,25 @@ function IndicesApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Adds a block to an index. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma separated list of indices to add a block to + * @param {string} params.block - The block to add (one of read, write, read_only or metadata) + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.addBlock = function indicesAddBlockApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -165,6 +186,21 @@ IndicesApi.prototype.addBlock = function indicesAddBlockApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Performs the analysis process on a text and return the tokens breakdown of the text. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/analyze-apis/perform-text-analysis/ OpenSearch - Perform text analysis} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - The name of the index to scope the operation + * @param {Object} [params.body] - Define analyzer/tokenizer parameters and the text on which the analysis should be performed + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.analyze = function indicesAnalyzeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -191,6 +227,27 @@ IndicesApi.prototype.analyze = function indicesAnalyzeApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Clears all or specific caches for one or more indices. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/clear-index-cache/ OpenSearch - Clear index or data stream cache} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index name to limit the operation + * @param {boolean} [params.fielddata] - Clear field data + * @param {string} [params.fields] - A comma-separated list of fields to clear when using the `fielddata` parameter (default: all) + * @param {boolean} [params.query] - Clear query caches + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.request] - Clear request cache + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.clearCache = function indicesClearCacheApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -217,6 +274,25 @@ IndicesApi.prototype.clearCache = function indicesClearCacheApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Clones an index + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/clone/ OpenSearch - Clone Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - The name of the source index to clone + * @param {string} params.target - The name of the target index to clone into + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {string} [params.wait_for_active_shards] - Set the number of active shards to wait for on the cloned index before the operation returns. + * @param {Object} [params.body] - The configuration for the target index (`settings` and `aliases`) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.clone = function indicesCloneApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -254,6 +330,26 @@ IndicesApi.prototype.clone = function indicesCloneApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * Closes an index. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/close-index/ OpenSearch - Close Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma separated list of indices to close + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.wait_for_active_shards] - Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.close = function indicesCloseApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -281,6 +377,24 @@ IndicesApi.prototype.close = function indicesCloseApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * Creates an index + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/create-index/ OpenSearch - Create Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {Object} [params.body] - The configuration for the index (`settings` and `mappings`) + * @param {string} [params.wait_for_active_shards] - Set the number of active shards to wait for before the operation returns. + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.create = function indicesCreateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -308,6 +422,25 @@ IndicesApi.prototype.create = function indicesCreateApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Deletes an index. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/delete-index/ OpenSearch - Delete Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.ignore_unavailable=false] - Ignore unavailable indexes + * @param {boolean} [params.allow_no_indices=false] - Ignore if a wildcard expression resolves to no concrete indices + * @param {string} [params.expand_wildcards=open] - Whether wildcard expressions should get expanded to open or closed indices (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.delete = function indicesDeleteApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -335,6 +468,23 @@ IndicesApi.prototype.delete = function indicesDeleteApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Deletes an alias. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-alias/ OpenSearch - Index Aliases} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names (supports wildcards); use `_all` for all indices + * @param {string} params.name - A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices. + * @param {string} [params.timeout] - Explicit timestamp for the document + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.deleteAlias = function indicesDeleteAliasApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -377,6 +527,22 @@ IndicesApi.prototype.deleteAlias = function indicesDeleteAliasApi(params, option return this.transport.request(request, options, callback); }; +/** + * Deletes an index template. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-templates/ OpenSearch - Index Templates} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the template + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.deleteIndexTemplate = function indicesDeleteIndexTemplateApi( params, options, @@ -408,6 +574,21 @@ IndicesApi.prototype.deleteIndexTemplate = function indicesDeleteIndexTemplateAp return this.transport.request(request, options, callback); }; +/** + * Deletes an index template (Deprecated. Use IndicesApi#deleteIndexTemplate instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the template + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.deleteTemplate = function indicesDeleteTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -435,6 +616,7 @@ IndicesApi.prototype.deleteTemplate = function indicesDeleteTemplateApi(params, return this.transport.request(request, options, callback); }; +// TODO: Remove. Experimental feature added in ES 7.15 IndicesApi.prototype.diskUsage = function indicesDiskUsageApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -462,6 +644,26 @@ IndicesApi.prototype.diskUsage = function indicesDiskUsageApi(params, options, c return this.transport.request(request, options, callback); }; +/** + * Returns information about whether a particular index exists. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/exists/ OpenSearch - Index Exists} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * @param {boolean} [params.ignore_unavailable=false] - Ignore unavailable indexes + * @param {boolean} [params.allow_no_indices=false] - Ignore if a wildcard expression resolves to no concrete indices + * @param {string} [params.expand_wildcards=open] - Whether wildcard expressions should get expanded to open or closed indices (options: open, closed, hidden, none, all) + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {boolean} [params.include_defaults] - Whether to return all default setting for each of the indices. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.exists = function indicesExistsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -489,6 +691,25 @@ IndicesApi.prototype.exists = function indicesExistsApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Returns information about whether a particular alias exists. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-alias/ OpenSearch - Index Aliases} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - A comma-separated list of alias names to return + * @param {string} [params.index] - A comma-separated list of index names to filter aliases + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.existsAlias = function indicesExistsAliasApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -521,6 +742,23 @@ IndicesApi.prototype.existsAlias = function indicesExistsAliasApi(params, option return this.transport.request(request, options, callback); }; +/** + * Returns information about whether a particular index template exists. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-templates/ OpenSearch - Index Templates} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the template + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.existsIndexTemplate = function indicesExistsIndexTemplateApi( params, options, @@ -552,6 +790,22 @@ IndicesApi.prototype.existsIndexTemplate = function indicesExistsIndexTemplateAp return this.transport.request(request, options, callback); }; +/** + * Returns information about whether a particular index template exists. (Deprecated. Use IndicesApi#existsIndexTemplate instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The comma separated names of the index templates + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.existsTemplate = function indicesExistsTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -579,6 +833,7 @@ IndicesApi.prototype.existsTemplate = function indicesExistsTemplateApi(params, return this.transport.request(request, options, callback); }; +// TODO: Remove. Experimental feature added in ES 7.15 IndicesApi.prototype.fieldUsageStats = function indicesFieldUsageStatsApi( params, options, @@ -610,6 +865,24 @@ IndicesApi.prototype.fieldUsageStats = function indicesFieldUsageStatsApi( return this.transport.request(request, options, callback); }; +/** + * Performs the flush operation on one or more indices. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string for all indices + * @param {boolean} [params.force] - Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal) + * @param {boolean} [params.wait_if_ongoing=true] - If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. If set to false the flush will be skipped iff if another flush operation is already running. + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.flush = function indicesFlushApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -636,6 +909,25 @@ IndicesApi.prototype.flush = function indicesFlushApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * Performs the force merge operation on one or more indices. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.flush=true] - Specify whether the index should be flushed after performing the operation + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {number} [params.max_num_segments] - The number of segments the index should be merged into (default: dynamic) + * @param {boolean} [params.only_expunge_deletes] - Specify whether the operation should only expunge deleted documents + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.forcemerge = function indicesForcemergeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -662,6 +954,27 @@ IndicesApi.prototype.forcemerge = function indicesForcemergeApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Returns information about one or more indices. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/get-index/ OpenSearch - Get Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * @param {boolean} [params.ignore_unavailable=false] - Ignore unavailable indexes + * @param {boolean} [params.allow_no_indices=false] - Ignore if a wildcard expression resolves to no concrete indices + * @param {string} [params.expand_wildcards=open] - Whether wildcard expressions should get expanded to open or closed indices (options: open, closed, hidden, none, all) + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {boolean} [params.include_defaults] - Whether to return all default setting for each of the indices. + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.get = function indicesGetApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -689,6 +1002,25 @@ IndicesApi.prototype.get = function indicesGetApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Returns an alias. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-alias/ OpenSearch - Index Aliases} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.name] - A comma-separated list of alias names to return + * @param {string} [params.index] - A comma-separated list of index names to filter aliases + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getAlias = function indicesGetAliasApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -721,6 +1053,26 @@ IndicesApi.prototype.getAlias = function indicesGetAliasApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Returns mapping for one or more fields. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/mappings/ OpenSearch - Mapping} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.fields - A comma-separated list of fields + * @param {string} [params.index] - A comma-separated list of index names + * @param {boolean} [params.include_defaults] - Whether the default mapping values should be returned as well + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getFieldMapping = function indicesGetFieldMappingApi( params, options, @@ -789,6 +1141,23 @@ IndicesApi.prototype.getFieldMapping = function indicesGetFieldMappingApi( return this.transport.request(request, options, callback); }; +/** + * Returns an index template. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-templates/ OpenSearch - Index Templates} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.name] - The comma separated names of the index templates + * @param {boolean} [params.flat_setting=false] - Return settings in flat format + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getIndexTemplate = function indicesGetIndexTemplateApi( params, options, @@ -819,6 +1188,25 @@ IndicesApi.prototype.getIndexTemplate = function indicesGetIndexTemplateApi( return this.transport.request(request, options, callback); }; +/** + * Returns mappings for one or more indices. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/mappings/ OpenSearch - Mapping} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node (Deprecated) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getMapping = function indicesGetMappingApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -851,6 +1239,28 @@ IndicesApi.prototype.getMapping = function indicesGetMappingApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Returns settings for one or more indices. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/get-settings/ OpenSearch - Get Settings} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.name] - The name of the settings that should be included + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * @param {boolean} [params.include_defaults] - Whether to return all default setting for each of the indices. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getSettings = function indicesGetSettingsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -883,6 +1293,22 @@ IndicesApi.prototype.getSettings = function indicesGetSettingsApi(params, option return this.transport.request(request, options, callback); }; +/** + * Returns an index template. (Deprecated. Use IndicesApi#getIndexTemplate instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.name] - The comma separated names of the index templates + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.local=false] - Return local information, do not retrieve the state from cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getTemplate = function indicesGetTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -909,6 +1335,22 @@ IndicesApi.prototype.getTemplate = function indicesGetTemplateApi(params, option return this.transport.request(request, options, callback); }; +/** + * Returns a progress status of current upgrade. (Deprecated. Use API-Document#reindex instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.getUpgrade = function indicesGetUpgradeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -930,6 +1372,26 @@ IndicesApi.prototype.getUpgrade = function indicesGetUpgradeApi(params, options, return this.transport.request(request, options, callback); }; +/** + * ROpens an index. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/open-index/ OpenSearch - Open Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma separated list of indices to open + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.wait_for_active_shards] - Sets the number of active shards to wait for before the operation returns. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.open = function indicesOpenApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -957,6 +1419,24 @@ IndicesApi.prototype.open = function indicesOpenApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Creates or updates an alias. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-alias/ OpenSearch - Index Aliases} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices. + * @param {string} params.name - The name of the alias to be created or updated + * @param {string} [params.timeout] - Explicit timestamp for the document + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {Object} [params.body] - The settings for the alias, such as `routing` or `filter` + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.putAlias = function indicesPutAliasApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -999,6 +1479,24 @@ IndicesApi.prototype.putAlias = function indicesPutAliasApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Creates or updates an index template. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-templates/ OpenSearch - Index Templates} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the template + * @param {Object} params.body - The template definition + * @param {boolean} [params.create] - Whether the index template should only be added if new or can also replace an existing one + * @param {string} [params.cause] - User defined reason for creating/updating the index template + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.putIndexTemplate = function indicesPutIndexTemplateApi( params, options, @@ -1034,6 +1532,27 @@ IndicesApi.prototype.putIndexTemplate = function indicesPutIndexTemplateApi( return this.transport.request(request, options, callback); }; +/** + * Updates index mappings. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/put-mapping/ OpenSearch - Create or Update Mapping} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices. + * @param {Object} params.body - The mapping definition + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.write_index_only] - When true, applies mappings only to the write index of an alias or data stream + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.putMapping = function indicesPutMappingApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1084,6 +1603,28 @@ IndicesApi.prototype.putMapping = function indicesPutMappingApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Updates the index settings. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/update-settings/ OpenSearch - Update Settings} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {Object} params.body - The index settings to be updated + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {string} [params.timeout] - Explicit operation timeout + * @param {boolean} [params.preserve_existing=false] - Whether to update existing settings. If set to `true` existing settings on an index remain unchanged + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.flat_settings=false] - Return settings in flat format + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.putSettings = function indicesPutSettingsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1116,6 +1657,23 @@ IndicesApi.prototype.putSettings = function indicesPutSettingsApi(params, option return this.transport.request(request, options, callback); }; +/** + * Creates or updates an index template. (Deprecated. Use IndicesApi#putIndexTemplate instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the template + * @param {Object} params.body - The template definition + * @param {number} [params.order] - The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers) + * @param {boolean} [params.create] - Whether the index template should only be added if new or can also replace an existing one + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.putTemplate = function indicesPutTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1147,6 +1705,21 @@ IndicesApi.prototype.putTemplate = function indicesPutTemplateApi(params, option return this.transport.request(request, options, callback); }; +/** + * Returns information about ongoing index shard recoveries. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.detailed] - Whether to display detailed information about shard recovery + * @param {boolean} [params.active_only] - Display only those recoveries that are currently on-going + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.recovery = function indicesRecoveryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1173,6 +1746,22 @@ IndicesApi.prototype.recovery = function indicesRecoveryApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Performs the refresh operation in one or more indices. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.refresh = function indicesRefreshApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1199,6 +1788,20 @@ IndicesApi.prototype.refresh = function indicesRefreshApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Returns information about any matching indices, aliases, and data streams + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.name] - A comma-separated list of names or wildcard expressions + * @param {string} [params.expand_wildcards=open] - Whether wildcard expressions should get expanded to open or closed indices (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.resolveIndex = function indicesResolveIndexApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1226,6 +1829,26 @@ IndicesApi.prototype.resolveIndex = function indicesResolveIndexApi(params, opti return this.transport.request(request, options, callback); }; +/** + * Updates an alias to point to a new index when the existing index is considered to be too large or too old. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/data-streams/#step-5-rollover-a-data-stream OpenSearch - Rollover a data stream} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.alias - The name of the alias to rollover + * @param {string} [params.new_index] - The name of the rollover index + * @param {string} [params.timeout] - Explicit operation timeout + * @param {boolean} [params.dry_run=false] - If set to true the rollover action will only be validated but not actually performed even if a condition matches. + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {string} [params.wait_for_active_shards] - Set the number of active shards to wait for on the newly created rollover index before the operation returns. + * @param {Object} [params.body] - The conditions that needs to be met for executing rollover + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.rollover = function indicesRolloverApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1270,6 +1893,23 @@ IndicesApi.prototype.rollover = function indicesRolloverApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Provides low-level information about segments in a Lucene index. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.verbose] - Includes detailed memory usage by Lucene. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.segments = function indicesSegmentsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1296,6 +1936,23 @@ IndicesApi.prototype.segments = function indicesSegmentsApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Provides store information for shard copies of indices. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.status] - A comma-separated list of statuses used to filter on shards to get store information for (options: green, yellow, red, all) + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.shardStores = function indicesShardStoresApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1322,6 +1979,26 @@ IndicesApi.prototype.shardStores = function indicesShardStoresApi(params, option return this.transport.request(request, options, callback); }; +/** + * Allow to shrink an existing index into a new index with fewer primary shards. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/shrink-index/ OpenSearch - Shrink Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - The name of the source index to shrink + * @param {string} params.target - The name of the target index to shrink into + * @param {boolean} [params.copy_settings] - whether or not to copy settings from the source index (defaults to false) + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {string} [params.wait_for_active_shards] - Set the number of active shards to wait for on the shrunken index before the operation returns. + * @param {Object} [params.body] - The configuration for the target index (`settings` and `aliases`) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.shrink = function indicesShrinkApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1359,6 +2036,23 @@ IndicesApi.prototype.shrink = function indicesShrinkApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Simulate matching the given index name against the index templates in the system + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.name - The name of the index (it must be a concrete index name) + * @param {Object} [params.body] - New index template definition, which will be included in the simulation, as if it already exists in the system + * @param {boolean} [params.create] - Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one + * @param {string} [params.cause] - User defined reason for dry-run creating the new template for simulation purposes + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.simulateIndexTemplate = function indicesSimulateIndexTemplateApi( params, options, @@ -1390,6 +2084,23 @@ IndicesApi.prototype.simulateIndexTemplate = function indicesSimulateIndexTempla return this.transport.request(request, options, callback); }; +/** + * Simulate resolving the given template name or body (Deprecated. Use IndicesApi#simulateIndexTemplate instead) + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.name] - The name of the index template + * @param {boolean} [params.create] - Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one + * @param {string} [params.cause] - User defined reason for dry-run creating the new template for simulation purposes + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {Object} [params.body] - New index template definition to be simulated, if no index template name is specified + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.simulateTemplate = function indicesSimulateTemplateApi( params, options, @@ -1420,6 +2131,26 @@ IndicesApi.prototype.simulateTemplate = function indicesSimulateTemplateApi( return this.transport.request(request, options, callback); }; +/** + * Allows you to split an existing index into a new index with more primary shards. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/index-apis/split/ OpenSearch - Split Index} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - The name of the source index to split + * @param {string} params.target - The name of the target index to split into + * @param {boolean} [params.copy_settings] - whether or not to copy settings from the source index (defaults to false) + * @param {string} [params.timeout] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * @param {string} [params.wait_for_active_shards] - Set the number of active shards to wait for on the shrunken index before the operation returns. + * @param {Object} [params.body] - The configuration for the target index (`settings` and `aliases`) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.split = function indicesSplitApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1457,6 +2188,30 @@ IndicesApi.prototype.split = function indicesSplitApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * Provides statistics on operations happening in an index. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.metric] - Limit the information returned the specific metrics. (options: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest) + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.completion_fields] - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + * @param {string} [params.fielddata_fields] - A comma-separated list of fields for `fielddata` index metric (supports wildcards) + * @param {string} [params.fields] - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) + * @param {string} [params.groups] - A comma-separated list of search groups for `search` index metric + * @param {string} [params.level] - Return stats aggregated at cluster, index or shard level (options: cluster, indices, shards) + * @param {string} [params.types] - A comma-separated list of document types for the `indexing` index metric + * @param {boolean} [params.include_segment_file_sizes] - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * @param {boolean} [params.include_unloaded_segments] - If set to true segment stats will include stats for segments that are not currently loaded into memory + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.forbid_closed_indices] - If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.stats = function indicesStatsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1489,6 +2244,22 @@ IndicesApi.prototype.stats = function indicesStatsApi(params, options, callback) return this.transport.request(request, options, callback); }; +/** + * Update an alias. + *
See Also: {@link https://opensearch.org/docs/latest/opensearch/index-alias/ OpenSearch - Index Aliases} + * + * @memberOf API-Index + * + * @param {Object} params + * @param {Object} params.body - The definition of `actions` to perform + * @param {string} [params.timeout] - Request timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1516,6 +2287,24 @@ IndicesApi.prototype.updateAliases = function indicesUpdateAliasesApi(params, op return this.transport.request(request, options, callback); }; +/** + * Upgrades to the current version of Lucene. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.wait_for_completion=false] - Specify whether the request should block until the all segments are upgraded + * @param {boolean} [params.only_ancient_segments] - If true, only ancient (an older Lucene major release) segments will be upgraded + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.upgrade = function indicesUpgradeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -1537,6 +2326,32 @@ IndicesApi.prototype.upgrade = function indicesUpgradeApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Allows a user to validate a potentially expensive query without executing it. + * + * @memberOf API-Index + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices + * @param {boolean} [params.explain] - Return detailed information about the error + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.q] - Query in the Lucene query string syntax + * @param {string} [params.analyzer] - The analyzer to use for the query string + * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed + * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR) + * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string + * @param {boolean} [params.lenient] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * @param {boolean} [params.rewrite] - Provide a more detailed explanation showing the actual Lucene query that will be executed. + * @param {boolean} [params.all_shards] - Execute validation on all shards instead of one random shard per index + * @param {Object} [params.body] - The query definition specified with the Query DSL + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IndicesApi.prototype.validateQuery = function indicesValidateQueryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/info.js b/api/api/info.js index ceade39c9..1eec14383 100644 --- a/api/api/info.js +++ b/api/api/info.js @@ -36,6 +36,17 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Returns basic information about the cluster. + * + * @memberOf API-Cluster + * + * @param {Object} params - (Unused) + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function infoApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/ingest.js b/api/api/ingest.js index 0a86ea36a..70c303c3b 100644 --- a/api/api/ingest.js +++ b/api/api/ingest.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Ingest */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'cluster_manager_timeout', @@ -57,6 +59,22 @@ function IngestApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Deletes a pipeline. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/delete-ingest/ OpenSearch - Delete a pipeline} + * + * @memberOf API-Ingest + * + * @param {Object} params + * @param {string} params.id - Pipeline ID + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/delete-ingest/#response Delete Pipeline Response} + */ IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -84,6 +102,17 @@ IngestApi.prototype.deletePipeline = function ingestDeletePipelineApi(params, op return this.transport.request(request, options, callback); }; +/** + * Returns statistical information about geoip databases + * + * @memberOf API-Ingest + * + * @param {Object} params - (Unused) + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -105,6 +134,22 @@ IngestApi.prototype.geoIpStats = function ingestGeoIpStatsApi(params, options, c return this.transport.request(request, options, callback); }; +/** + * Returns a pipeline. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/get-ingest/ OpenSearch - Get pipeline} + * + * @memberOf API-Ingest + * + * @param {Object} params + * @param {string} [params.id] - Comma separated list of pipeline ids. Wildcards supported + * @param {boolean} [params.summary=false] - Return pipelines without their definitions + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/get-ingest/#response Get Pipeline Response} + */ IngestApi.prototype.getPipeline = function ingestGetPipelineApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -131,6 +176,17 @@ IngestApi.prototype.getPipeline = function ingestGetPipelineApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Returns a list of the built-in patterns. + * + * @memberOf API-Ingest + * + * @param {Object} params - (Unused) + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IngestApi.prototype.processorGrok = function ingestProcessorGrokApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -152,6 +208,23 @@ IngestApi.prototype.processorGrok = function ingestProcessorGrokApi(params, opti return this.transport.request(request, options, callback); }; +/** + * Creates or updates a pipeline. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/create-update-ingest/ OpenSearch - Create/Update pipeline} + * + * @memberOf API-Ingest + * + * @param {Object} params + * @param {string} params.id - Pipeline ID + * @param {Object} params.body - Ingest definition + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/create-update-ingest/#response Create/Update Pipeline Response} + */ IngestApi.prototype.putPipeline = function ingestPutPipelineApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -183,6 +256,22 @@ IngestApi.prototype.putPipeline = function ingestPutPipelineApi(params, options, return this.transport.request(request, options, callback); }; +/** + * Allows to simulate a pipeline with example documents. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/ingest-apis/simulate-ingest/ OpenSearch - Simulate Pipeline} + * + * @memberOf API-Ingest + * + * @param {Object} params + * @param {string} [params.id] - Pipeline ID + * @param {boolean} [params.verbose] - Verbose mode. Display data output for each processor in executed pipeline + * @param {Object} params.body - Simulate definition + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ IngestApi.prototype.simulate = function ingestSimulateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/mget.js b/api/api/mget.js index ad9c34d5b..344ffd655 100644 --- a/api/api/mget.js +++ b/api/api/mget.js @@ -60,6 +60,30 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Retrieve multiple documents + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/multi-get/ OpenSearch - Multi-get Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - Document ID. + * @param {string} params.body - {@link https://opensearch.org/docs/2.4/api-reference/document-apis/multi-get/#request-body Multi-get Request Body} + * @param {string} [params.preference] - Specifies a preference of which shard to retrieve results from. Available options are '_local', which tells the operation to retrieve results from a locally allocated shard replica, and a custom string value assigned to a specific shard replica. By default, OpenSearch executes get document operations on random shards. + * @param {boolean} [params.realtime=true] - Specifies whether the operation should run in realtime. If false, the operation waits for the index to refresh to analyze the source to retrieve data, which makes the operation near-realtime. + * @param {boolean} [params.refresh=false] - If true, OpenSearch refreshes shards to make the get operation available to search results. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {string} [params.routing] - A value used to route the operation to a specific shard. + * @param {boolean} [params.stored_fields=false] - Whether the get operation should retrieve fields stored in the index. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/multi-get/#response Multi-get Response} + */ function mgetApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/msearch.js b/api/api/msearch.js index 3c2ac6163..06e3e4c75 100644 --- a/api/api/msearch.js +++ b/api/api/msearch.js @@ -59,6 +59,28 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to execute several search operations in one request. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/multi-search/ OpenSearch - Multi-Search} + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to use as default + * @param {Object} params.body - The request definitions (metadata-search request definition pairs), separated by newlines + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {number} [params.max_concurrent_searches] - Controls the maximum number of concurrent searches the multi search api will execute + * @param {boolean} [params.typed_keys] - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * @param {number} [params.pre_filter_shard_size] - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. + * @param {number} [params.max_concurrent_shard_requests] - The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {boolean} [params.ccs_minimize_roundtrips] - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/multi-search/#response Multi-search Response} + */ function msearchApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/msearch_template.js b/api/api/msearch_template.js index 3b5ef8512..89313e660 100644 --- a/api/api/msearch_template.js +++ b/api/api/msearch_template.js @@ -55,6 +55,25 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to execute several search template operations in one request. + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to use as default + * @param {Object} params.body - The request definitions (metadata-search request definition pairs), separated by newlines + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {boolean} [params.typed_keys] - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * @param {number} [params.max_concurrent_searches] - Controls the maximum number of concurrent searches the multi search api will execute + * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {boolean} [params.ccs_minimize_roundtrips] - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function msearchTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/nodes.js b/api/api/nodes.js index adf99382e..c6cb83a9c 100644 --- a/api/api/nodes.js +++ b/api/api/nodes.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Nodes */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'pretty', @@ -155,6 +157,25 @@ NodesApi.prototype.getMeteringInfo = function nodesGetMeteringInfoApi(params, op return this.transport.request(request, options, callback); }; +/** + * Returns information about hot threads on each node in the cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-hot-threads/ OpenSearch - Nodes Hot Threads} + * @memberOf API-Nodes + * + * @param {Object} params + * @param {string} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.interval] - The interval for the second sampling of threads + * @param {number} [params.snapshots] - Number of samples of thread stacktrace (default: 10) + * @param {number} [params.threads] - Specify the number of threads to provide information for (default: 3) + * @param {boolean} [params.ignore_idle_threads] - Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) + * @param {string} [params.type] - The type to sample (default: cpu) (options: cpu, wait, block) + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ NodesApi.prototype.hotThreads = function nodesHotThreadsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -206,6 +227,22 @@ NodesApi.prototype.hotThreads = function nodesHotThreadsApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Returns information about hot threads on each node in the cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-info/ OpenSearch - Nodes Info} + * @memberOf API-Nodes + * + * @param {Object} params + * @param {string} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.metric] - A comma-separated list of metrics you wish returned. Leave empty to return all. (options: settings, os, process, jvm, thread_pool, transport, http, plugins, ingest) + * @param {boolean} [params.flat_settings] - Return settings in flat format (default: false) + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ NodesApi.prototype.info = function nodesInfoApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -244,6 +281,21 @@ NodesApi.prototype.info = function nodesInfoApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Reloads secure settings. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-reload-secure/ OpenSearch - Nodes Reload Security Settings} + * @memberOf API-Nodes + * + * @param {Object} params + * @param {string} [params.node_id] - A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. + * @param {string} [params.timeout] - Explicit operation timeout + * @param {Object} [params.body] - An object containing the password for the opensearch keystore + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi( params, options, @@ -275,6 +327,30 @@ NodesApi.prototype.reloadSecureSettings = function nodesReloadSecureSettingsApi( return this.transport.request(request, options, callback); }; +/** + * Returns statistical information about nodes in the cluster. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-stats/ OpenSearch - Nodes Stats} + * @memberOf API-Nodes + * + * @param {Object} params + * @param {string} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.metric] - Limit the information returned to the specified metrics (options: _all, breaker, fs, http, indices, jvm, os, process, thread_pool, transport, discovery, indexing_pressure) + * @param {string} [params.index_metric] - Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. (options: _all, completion, docs, fielddata, query_cache, flush, get, indexing, merge, request_cache, refresh, search, segments, store, warmer, suggest) + * @param {string} [params.completion_fields] - A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) + * @param {string} [params.fielddata_fields] - A comma-separated list of fields for `fielddata` index metric (supports wildcards) + * @param {string} [params.fields] - A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) + * @param {boolean} [params.groups] - A comma-separated list of search groups for `search` index metric + * @param {string} [params.level] - Return indices stats aggregated at index, node or shard level (options: indices, node, shards) + * @param {string} [params.types] - A comma-separated list of document types for the `indexing` index metric + * @param {string} [params.timeout] - Explicit operation timeout + * @param {boolean} [params.include_segment_file_sizes] - Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) + * @param {boolean} [params.include_unloaded_segments] - If set to true segment stats will include stats for segments that are not currently loaded into memory + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ NodesApi.prototype.stats = function nodesStatsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -339,6 +415,21 @@ NodesApi.prototype.stats = function nodesStatsApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Returns low-level information about REST actions usage on nodes. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/nodes-apis/nodes-usage/ OpenSearch - Nodes Usage} + * @memberOf API-Nodes + * + * @param {Object} params + * @param {string} [params.node_id] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.metric] - Limit the information returned to the specified metrics (options: _all, rest_actions) + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ NodesApi.prototype.usage = function nodesUsageApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/ping.js b/api/api/ping.js index 6b64d634b..0c617f26c 100644 --- a/api/api/ping.js +++ b/api/api/ping.js @@ -36,6 +36,17 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Returns whether the cluster is running. + * + * @memberOf API-Cluster + * + * @param {Object} params - (Unused) + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function pingApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/put_script.js b/api/api/put_script.js index 917b8ce50..e2c8453fe 100644 --- a/api/api/put_script.js +++ b/api/api/put_script.js @@ -51,6 +51,23 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Creates or updates a script. + *
See also: {@link https://opensearch.org/docs/latest/api-reference/script-apis/create-stored-script/ OpenSearch - Create or update stored script} + * @memberOf API-Script + * + * @param {Object} params + * @param {string} params.id - Stored script or search template name + * @param {string} params.body - The script + * @param {string} [params.context] - Context in which the script or search template is to run. To prevent errors, the API immediately compiles the script or template in this context. + * @param {string} [params.timeout=30s] - Explicit operation timeout + * @param {string} [params.cluster_manager_timeout] - Specify timeout for connection to cluster_manager + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function putScriptApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/rank_eval.js b/api/api/rank_eval.js index 5739b4cc7..0648fcce9 100644 --- a/api/api/rank_eval.js +++ b/api/api/rank_eval.js @@ -53,6 +53,25 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to evaluate the quality of ranked search results over a set of typical search queries + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/rank-eval/ OpenSearch - Ranking evaluation} + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {Object} params.body - The ranking evaluation search definition, including search requests, document ratings and ranking metric definition + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/rank-eval/#sample-response Ranking Evaluation Response} + */ function rankEvalApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/reindex.js b/api/api/reindex.js index 4cdc08b58..ffbc66de5 100644 --- a/api/api/reindex.js +++ b/api/api/reindex.js @@ -57,6 +57,28 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Copy all or a subset of your data from a source index into a destination index. + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/reindex/ OpenSearch - Reindex Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {Object} params.body The search definition using the Query DSL and the prototype for the index request. + * @param {boolean} [params.refresh=false] Should the affected indexes be refreshed? + * @param {string} [params.timeout=30s] Time each individual bulk request should wait for shards that are unavailable. + * @param {string} [params.wait_for_active_shards] Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * @param {boolean} [params.wait_for_completion=false] Should the request should block until the reindex is complete. + * @param {number} [params.requests_per_second=-1] The throttle to set on this request in sub-requests per second. -1 means no throttle. + * @param {string} [params.scroll=5m] Control how long to keep the search context alive + * @param {number|string} [params.slices=1] The number of slices this task should be divided into. 1 means the task isn't sliced into subtasks. Can be set to `auto`. + * @param {number} [params.max_docs] Maximum number of documents to process (default: all documents) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/reindex/#response Reindex Document Response} + */ function reindexApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/reindex_rethrottle.js b/api/api/reindex_rethrottle.js index 71df5c289..dfab5d02c 100644 --- a/api/api/reindex_rethrottle.js +++ b/api/api/reindex_rethrottle.js @@ -47,6 +47,20 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Changes the number of requests per second for a particular Reindex operation. + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.task_id - The task id to rethrottle + * @param {number} params.requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function reindexRethrottleApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/render_search_template.js b/api/api/render_search_template.js index 4f8a5e788..6353ef760 100644 --- a/api/api/render_search_template.js +++ b/api/api/render_search_template.js @@ -36,6 +36,20 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Allows to use the Mustache language to pre-render a search definition. + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.id] - The id of the stored search template + * @param {Object} [params.body] - The search definition template and its params + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function renderSearchTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/scripts_painless_execute.js b/api/api/scripts_painless_execute.js index bd2805519..9ec8a894b 100644 --- a/api/api/scripts_painless_execute.js +++ b/api/api/scripts_painless_execute.js @@ -36,6 +36,19 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +/** + * Execute Painless script + *
See also: {@link https://opensearch.org/docs/latest/api-reference/script-apis/exec-script/ OpenSearch - Execute Painless script} + * @memberOf API-Script + * + * @param {Object} params + * @param {string} params.body - The painless script + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function scriptsPainlessExecuteApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/scroll.js b/api/api/scroll.js index 03510b2db..045b22dbe 100644 --- a/api/api/scroll.js +++ b/api/api/scroll.js @@ -50,6 +50,23 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to retrieve a large numbers of results from a single search request. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/scroll/ OpenSearch - Scroll } + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.scroll_id] - The scroll ID *Deprecated* + * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {Object} [params.body] - The scroll ID if not passed by URL or query parameter. + * + * @param {Object} [options] - Options for {@link Transport#request} + * @param {function} [callback] - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function scrollApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/search.js b/api/api/search.js index 94ef28885..f8e9fc2d9 100644 --- a/api/api/search.js +++ b/api/api/search.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Search */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'analyzer', @@ -120,6 +122,64 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to execute several search operations in one request. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/search/ OpenSearch - Search} + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.analyzer] - The analyzer to use for the query string + * @param {boolean} [params.analyze_wildcard] - Specify whether wildcard and prefix queries should be analyzed (default: false) + * @param {boolean} [params.ccs_minimize_roundtrips] - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * @param {string} [params.default_operator] - The default operator for query string query (AND or OR) (options: AND, OR) + * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string + * @param {boolean} [params.explain] - Specify whether to return detailed information about score computation as part of a hit + * @param {string} [params.stored_fields] - A comma-separated list of stored fields to return as part of a hit + * @param {string} [params.docvalue_fields] - A comma-separated list of fields to return as the docvalue representation of a field for each hit + * @param {number} [params.from] - Starting offset (default: 0) + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.ignore_throttled] - Whether specified concrete, expanded or aliased indices should be ignored when throttled + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.lenient] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.q] - Query in the Lucene query string syntax + * @param {string} [params.routing] - A comma-separated list of specific routing values + * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {number} [params.size] - Number of hits to return (default: 10) + * @param {string} [params.sort] - A comma-separated list of : pairs + * @param {string} [params._source] - True or false to return the _source field or not, or a list of fields to return + * @param {string} [params._source_excludes] - A list of fields to exclude from the returned _source field + * @param {string} [params._source_includes] - A list of fields to extract and return from the _source field + * @param {number} [params.terminate_after] - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * @param {string} [params.stats] - Specific 'tag' of the request for logging and statistical purposes + * @param {string} [params.suggest_field] - Specify which field to use for suggestions + * @param {string} [params.suggest_mode] - Specify suggest mode (options: missing, popular, always) + * @param {number} [params.suggest_size] - How many suggestions to return in response + * @param {string} [params.suggest_text] - The source text for which the suggestions should be returned + * @param {string} [params.timeout] - Explicit operation timeout + * @param {boolean} [params.track_scores] - Whether to calculate and return scores even if they are not used for sorting + * @param {boolean} [params.track_total_hits] - Indicate if the number of documents that match the query should be tracked + * @param {boolean} [params.allow_partial_search_results] - Indicate if an error should be returned if there is a partial search failure or timeout + * @param {boolean} [params.typed_keys] - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * @param {boolean} [params.version] - Specify whether to return document version as part of a hit + * @param {boolean} [params.seq_no_primary_term] - Specify whether to return sequence number and primary term of the last modification of each hit + * @param {boolean} [params.request_cache] - Specify if request cache should be used for this request or not, defaults to index level setting + * @param {number} [params.batched_reduce_size] - The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large. + * @param {number} [params.max_concurrent_shard_requests] - The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests + * @param {number} [params.pre_filter_shard_size] - A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. + * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {string} [params.min_compatible_shard_node] - The minimum compatible version that all shards involved in search should have for this request to be successful + * @param {Object} [params.body] - The search definition using the Query DSL + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/latest/api-reference/search/#response-body Search Response} + */ function searchApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/search_shards.js b/api/api/search_shards.js index be730ac9f..5190463c9 100644 --- a/api/api/search_shards.js +++ b/api/api/search_shards.js @@ -54,6 +54,25 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Returns information about the indices and shards that a search request would be executed against. + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} [params.index] - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.routing] - Specific routing value + * @param {boolean} [params.local] - Return local information, do not retrieve the state from cluster_manager node (default: false) + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function searchShardsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/search_template.js b/api/api/search_template.js index aae968398..c45c6ef16 100644 --- a/api/api/search_template.js +++ b/api/api/search_template.js @@ -66,6 +66,33 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Allows to use the Mustache language to pre-render a search definition. + * + * @memberOf API-Search + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices + * @param {Object} params.body - The search definition template and its params + * @param {boolean} [params.ignore_unavailable] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.ignore_throttled] - Whether specified concrete, expanded or aliased indices should be ignored when throttled + * @param {boolean} [params.allow_no_indices] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) + * @param {string} [params.expand_wildcards] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.routing] - A comma-separated list of specific routing values + * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {string} [params.search_type] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {boolean} [params.explain] - Specify whether to return detailed information about score computation as part of a hit + * @param {boolean} [params.profile] - Specify whether to profile the query execution + * @param {boolean} [params.typed_keys] - Specify whether aggregation and suggester names should be prefixed by their respective types in the response + * @param {boolean} [params.rest_total_hits_as_int] - Indicates whether hits.total should be rendered as an integer or an object in the rest search response + * @param {boolean} [params.ccs_minimize_roundtrips] - Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function searchTemplateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/shutdown.js b/api/api/shutdown.js index 2a4695999..6f1d5e213 100644 --- a/api/api/shutdown.js +++ b/api/api/shutdown.js @@ -41,6 +41,7 @@ function ShutdownApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +// TODO: Remove. Added in ES 7.15 ShutdownApi.prototype.deleteNode = function shutdownDeleteNodeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -68,6 +69,7 @@ ShutdownApi.prototype.deleteNode = function shutdownDeleteNodeApi(params, option return this.transport.request(request, options, callback); }; +// TODO: Remove. Added in ES 7.15 ShutdownApi.prototype.getNode = function shutdownGetNodeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -94,6 +96,7 @@ ShutdownApi.prototype.getNode = function shutdownGetNodeApi(params, options, cal return this.transport.request(request, options, callback); }; +// TODO: Remove. Added in ES 7.15 ShutdownApi.prototype.putNode = function shutdownPutNodeApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/snapshot.js b/api/api/snapshot.js index 6fee69364..aa5c2b18f 100644 --- a/api/api/snapshot.js +++ b/api/api/snapshot.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Snapshot */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'cluster_manager_timeout', @@ -83,6 +85,21 @@ function SnapshotApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Removes stale data from repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} params.repository - A repository name + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi( params, options, @@ -114,6 +131,23 @@ SnapshotApi.prototype.cleanupRepository = function snapshotCleanupRepositoryApi( return this.transport.request(request, options, callback); }; +/** + * Clones indices from one snapshot into another snapshot in the same repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} params.repository - A repository name + * @param {string} params.snapshot - The name of the snapshot to clone from + * @param {Object} params.body - The snapshot clone definition + * @param {string} [params.target_snapshot] - The name of the cloned snapshot to create + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.clone = function snapshotCloneApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -180,6 +214,23 @@ SnapshotApi.prototype.clone = function snapshotCloneApi(params, options, callbac return this.transport.request(request, options, callback); }; +/** + * Creates a snapshot in a repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} params.repository - A repository name + * @param {string} params.snapshot - A snapshot name + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.wait_for_completion] - Should this request wait until the operation has completed before returning + * @param {Object} [params.body] - The snapshot definition + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.create = function snapshotCreateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -218,6 +269,23 @@ SnapshotApi.prototype.create = function snapshotCreateApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Creates a repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} params.repository - A repository name + * @param {Object} params.body - The repository definition + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * @param {boolean} [params.verify] - Whether to verify the repository after creation + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.createRepository = function snapshotCreateRepositoryApi( params, options, @@ -253,6 +321,22 @@ SnapshotApi.prototype.createRepository = function snapshotCreateRepositoryApi( return this.transport.request(request, options, callback); }; +/** + * Deletes a snapshot. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {string} [params.snapshot] - A snapshot name + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.delete = function snapshotDeleteApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -291,6 +375,22 @@ SnapshotApi.prototype.delete = function snapshotDeleteApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Deletes a repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported. + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.deleteRepository = function snapshotDeleteRepositoryApi( params, options, @@ -322,6 +422,26 @@ SnapshotApi.prototype.deleteRepository = function snapshotDeleteRepositoryApi( return this.transport.request(request, options, callback); }; +/** + * Returns information about a snapshot. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {string} [params.snapshot] - A comma-separated list of snapshot names + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.ignore_unavailable] - Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + * @param {boolean} [params.index_details] - Whether to include details of each index in the snapshot, if those details are available. Defaults to false. + * @param {boolean} [params.include_repository] - Whether to include the repository name in the snapshot info. Defaults to true. + * @param {boolean} [params.verbose] - Whether to show verbose snapshot info or only show the basic info found in the repository index blob + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.get = function snapshotGetApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -360,6 +480,21 @@ SnapshotApi.prototype.get = function snapshotGetApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Returns information about a snapshot. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A comma-separated list of repository names + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.local] - Return local information, do not retrieve the state from cluster_manager node (default: false) + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -386,6 +521,30 @@ SnapshotApi.prototype.getRepository = function snapshotGetRepositoryApi(params, return this.transport.request(request, options, callback); }; +/** + * Analyzes a repository for correctness and performance + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {number} [params.blob_count] - Number of blobs to create during the test. Defaults to 100. + * @param {number} [params.concurrency] - Number of operations to run concurrently during the test. Defaults to 10. + * @param {number} [params.read_node_count] - Number of nodes on which to read a blob after writing. Defaults to 10. + * @param {number} [params.early_read_node_count] - 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. + * @param {number} [params.seed] - Seed for the random number generator used to create the test workload. Defaults to a random value. + * @param {number} [params.rare_action_probability] - Probability of taking a rare action such as an early read or an overwrite. Defaults to 0.02. + * @param {string} [params.max_blob_size] - Maximum size of a blob to create during the test, e.g '1gb' or '100mb'. Defaults to '10mb'. + * @param {string} [params.max_total_data_size] - Maximum total size of all blobs to create during the test, e.g '1tb' or '100gb'. Defaults to '1gb'. + * @param {string} [params.timeout] - Explicit operation timeout. Defaults to '30s'. + * @param {boolean} [params.detailed] - Whether to return detailed results or a summary. Defaults to 'false' so that only the summary is returned. + * @param {boolean} [params.rarely_abort_writes] - Whether to rarely abort writes before they complete. Defaults to 'true'. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi( params, options, @@ -417,6 +576,24 @@ SnapshotApi.prototype.repositoryAnalyze = function snapshotRepositoryAnalyzeApi( return this.transport.request(request, options, callback); }; +/** + * Restores a snapshot. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {string} [params.snapshot] - A snapshot name + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.wait_for_completion] - Should this request wait until the operation has completed before returning + * @param {Object} [params.body] - Details of what to restore + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.restore = function snapshotRestoreApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -462,6 +639,23 @@ SnapshotApi.prototype.restore = function snapshotRestoreApi(params, options, cal return this.transport.request(request, options, callback); }; +/** + * Returns information about the status of a snapshot. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {string} [params.snapshot] - A comma-separated list of snapshot names + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {boolean} [params.ignore_unavailable] - Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.status = function snapshotStatusApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -505,6 +699,22 @@ SnapshotApi.prototype.status = function snapshotStatusApi(params, options, callb return this.transport.request(request, options, callback); }; +/** + * Verifies a repository. + * + * @memberOf API-Snapshot + * + * @param {Object} params + * @param {string} [params.repository] - A repository name + * @param {string} [params.master_timeout] - (DEPRECATED: use cluster_manager_timeout instead) Explicit operation timeout for connection to master node + * @param {string} [params.cluster_manager_timeout] - Explicit operation timeout for connection to cluster_manager node + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ SnapshotApi.prototype.verifyRepository = function snapshotVerifyRepositoryApi( params, options, diff --git a/api/api/tasks.js b/api/api/tasks.js index 407baa2a1..a57df45cf 100644 --- a/api/api/tasks.js +++ b/api/api/tasks.js @@ -32,6 +32,8 @@ /* eslint camelcase: 0 */ /* eslint no-unused-vars: 0 */ +/** @namespace API-Tasks */ + const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = require('../utils'); const acceptedQuerystring = [ 'nodes', @@ -60,6 +62,24 @@ function TasksApi(transport, ConfigurationError) { this[kConfigurationError] = ConfigurationError; } +/** + * Cancels a task, if it can be cancelled through an API. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks/#task-canceling OpenSearch - Task Cancelling} + * + * @memberOf API-Tasks + * + * @param {Object} params + * @param {string} [params.task_id] - Cancel the task with specified task id (node_id:task_number) + * @param {string} [params.nodes] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.actions] - A comma-separated list of actions that should be cancelled. Leave empty to cancel all. + * @param {string} [params.parent_task_id] - Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all. + * @param {boolean} [params.wait_for_completion] - Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ TasksApi.prototype.cancel = function tasksCancelApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -86,6 +106,22 @@ TasksApi.prototype.cancel = function tasksCancelApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Returns information about a task. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks OpenSearch - Tasks} + * + * @memberOf API-Tasks + * + * @param {Object} params + * @param {string} [params.task_id] - Return the task with specified id (node_id:task_number) + * @param {boolean} [params.wait_for_completion] - Wait for the matching tasks to complete (default: false) + * @param {string} [params.timeout] - Explicit operation timeoutompletion] - Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ TasksApi.prototype.get = function tasksGetApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); @@ -113,6 +149,26 @@ TasksApi.prototype.get = function tasksGetApi(params, options, callback) { return this.transport.request(request, options, callback); }; +/** + * Returns a list of tasks. + *
See Also: {@link https://opensearch.org/docs/latest/api-reference/tasks OpenSearch - Tasks} + * + * @memberOf API-Tasks + * + * @param {Object} params + * @param {string} [params.nodes] - A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes + * @param {string} [params.actions] - A comma-separated list of actions that should be returned. Leave empty to return all. + * @param {boolean} [params.detailed] - Return detailed task information (default: false) + * @param {string} [params.parent_task_id] - Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all. + * @param {boolean} [params.wait_for_completion] - Wait for the matching tasks to complete (default: false) + * @param {string} [params.group_by] - Group tasks by nodes or parent/child relationships (options: nodes, parents, none) + * @param {string} [params.timeout] - Explicit operation timeout + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ TasksApi.prototype.list = function tasksListApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/terms_enum.js b/api/api/terms_enum.js index 5c0ad538e..847f3229f 100644 --- a/api/api/terms_enum.js +++ b/api/api/terms_enum.js @@ -36,6 +36,7 @@ const { handleError, snakeCaseKeys, normalizeArguments, kConfigurationError } = const acceptedQuerystring = ['pretty', 'human', 'error_trace', 'source', 'filter_path']; const snakeCase = { errorTrace: 'error_trace', filterPath: 'filter_path' }; +// TODO: Remove. Added in ES 7.14 function termsEnumApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/termvectors.js b/api/api/termvectors.js index e2ec981b7..e08c623b3 100644 --- a/api/api/termvectors.js +++ b/api/api/termvectors.js @@ -59,6 +59,32 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Returns information and statistics about terms in the fields of a particular document. + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - The index in which the document resides. + * @param {string} [params.id] - The id of the document, when not specified a doc param should be supplied. + * @param {boolean} [params.term_statistics] - Specifies if total term frequency and document frequency should be returned. + * @param {boolean} [params.field_statistics] - Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. + * @param {string} [params.fields] - A comma-separated list of fields to return. + * @param {boolean} [params.offsets] - Specifies if term offsets should be returned. + * @param {boolean} [params.positions] - Specifies if term positions should be returned. + * @param {boolean} [params.payloads] - Specifies if term payloads should be returned. + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random). + * @param {string} [params.routing] - Specific routing value. + * @param {boolean} [params.realtime] - Specifies if request is real-time as opposed to near-real-time (default: true). + * @param {number} [params.version] - Explicit version number for concurrency control + * @param {string} [params.version_type] - Specific version type (options: internal, external, external_gte, force) + * @param {Object} [params.body] - Define parameters and or supply a document to get termvectors for. See documentation. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function termvectorsApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/update.js b/api/api/update.js index ff9437d1d..8f8f361b1 100644 --- a/api/api/update.js +++ b/api/api/update.js @@ -68,6 +68,34 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Update an existing document + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/ OpenSearch - Update Document} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - Name of the index. + * @param {string} params.id - A unique identifier to attach to the document. + * @param {Object} params.body - The request definition requires either `script` or partial `doc`. + * @param {number} [params.if_seq_no] - Only perform the update operation if the document has the specified sequence number. + * @param {number} [params.if_primary_term] - Only perform the update operation if the document has the specified primary term. + * @param {string} [params.lang=painless] - Language of the script. + * @param {string} [params.routing] - Value used to assign the index operation to a specific shard. + * @param {string} [params._source=true] - Whether to include the '_source' field in the response body. + * @param {string} [params._source_excludes] - A comma-separated list of source fields to exclude in the query response. + * @param {string} [params._source_includes] - A comma-separated list of source fields to include in the query response. + * @param {string} [params.refresh=false] - If true, OpenSearch refreshes shards to make the operation visible to searching. Valid options are 'true', 'false', and 'wait_for', which tells OpenSearch to wait for a refresh before executing the operation. + * @param {number} [params.retry_on_conflict=0] - The amount of times OpenSearch should retry the operation if there’s a document conflict. + * @param {string} [params.timeout=1m] - How long to wait for a response from the cluster. + * @param {string} [params.wait_for_active_shards] - The number of active shards that must be available before OpenSearch processes the request. Default is 1 (only the primary shard). Set to all or a positive integer. Values greater than 1 require replicas. For example, if you specify a value of 3, the index must have two replicas distributed across two additional nodes for the operation to succeed. + * @param {boolean} [params.require_alias=false] - Specifies whether the target index must be an index alias. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-document/#response Update Response} + */ function updateApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/update_by_query.js b/api/api/update_by_query.js index 60f37fb89..682516d61 100644 --- a/api/api/update_by_query.js +++ b/api/api/update_by_query.js @@ -101,6 +101,56 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Run a script to update all documents that match the query. + *
See Also: {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-by-query/ OpenSearch - Update by query} + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.index - A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices + * @param {Object} [params.body] - The search definition using the Query DSL + * @param {string} [params.analyzer] - The analyzer to use for the query string + * @param {boolean} [params.analyze_wildcard=false] - Specify whether wildcard and prefix queries should be analyzed (default: false) + * @param {string} [params.default_operator=OR] - The default operator for query string query (options: AND, OR) + * @param {string} [params.df] - The field to use as default where no field prefix is given in the query string + * @param {number} [params.from=0] - Starting offset + * @param {boolean} [params.ignore_unavailable=false] - Whether specified concrete indices should be ignored when unavailable (missing or closed) + * @param {boolean} [params.allow_no_indices=true] - Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes '_all' string or when no indices have been specified) + * @param {string} [params.conflicts=abort] - What to do when the update by query hits version conflicts? (options: abort, proceed) + * @param {string} [params.expand_wildcards=open] - Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all) + * @param {boolean} [params.lenient=false] - Specify whether format-based query failures (such as providing text to a numeric field) should be ignored + * @param {string} [params.pipeline] - Ingest pipeline to set on index requests made by this action. (default: none) + * @param {string} [params.preference] - Specify the node or shard the operation should be performed on (default: random) + * @param {string} [params.q] - Query in the Lucene query string syntax + * @param {string} [params.routing] - A comma-separated list of specific routing values + * @param {string} [params.scroll] - Specify how long a consistent view of the index should be maintained for scrolled search + * @param {string} [params.search_type=query_then_fetch] - Search operation type (options: query_then_fetch, dfs_query_then_fetch) + * @param {string} [params.search_timeout] - Explicit timeout for each search request. Defaults to no timeout. + * @param {number} [params.size] - Deprecated, please use 'max_docs' instead + * @param {number} [params.max_docs] - Maximum number of documents to process (default: all documents) + * @param {string} [params.sort] - A comma-separated list of : pairs + * @param {string} [params._source] - True or false to return the _source field or not, or a list of fields to return + * @param {string} [params._source_excludes] - A list of fields to exclude from the returned _source field + * @param {string} [params._source_includes] - A list of fields to extract and return from the _source field + * @param {number} [params.terminate_after] - The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early. + * @param {string} [params.stats] - Specific 'tag' of the request for logging and statistical purposes + * @param {boolean} [params.version] - Specify whether to return document version as part of a hit + * @param {boolean} [params.version_type] - Should the document increment the version number (internal) on hit or not (reindex) + * @param {boolean} [params.request_cache] - Specify if request cache should be used for this request or not, defaults to index level setting + * @param {boolean} [params.refresh=false] - Should the affected indexes be refreshed? + * @param {string} [params.timeout] - Time each individual bulk request should wait for shards that are unavailable. + * @param {string} [params.wait_for_active_shards=1] - Sets the number of shard copies that must be active before proceeding with the update by query operation. 1 means the primary shard only. Set to 'all' for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1) + * @param {number} [params.scroll_size=1000] - Size on the scroll request powering the update by query + * @param {boolean} [params.wait_for_completion=true] - Should the request should block until the update by query operation is complete. + * @param {number} [params.requests_per_second=-1] - The throttle to set on this request in sub-requests per second. -1 means no throttle. + * @param {string} [params.slices=1] - The number of slices this task should be divided into. 1 means the task isn't sliced into subtasks. Can be set to 'auto'. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} {@link https://opensearch.org/docs/2.4/api-reference/document-apis/update-by-query/#response Update by query Response} + */ function updateByQueryApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/api/api/update_by_query_rethrottle.js b/api/api/update_by_query_rethrottle.js index 7da9f6486..24e295904 100644 --- a/api/api/update_by_query_rethrottle.js +++ b/api/api/update_by_query_rethrottle.js @@ -47,6 +47,20 @@ const snakeCase = { filterPath: 'filter_path', }; +/** + * Changes the number of requests per second for a particular Update By Query operation. + * + * @memberOf API-Document + * + * @param {Object} params + * @param {string} params.task_id - The task id to rethrottle + * @param {number} params.requests_per_second - The throttle to set on this request in floating sub-requests per second. -1 means set no throttle. + * + * @param {Object} options - Options for {@link Transport#request} + * @param {function} callback - Callback that handles errors and response + * + * @returns {{abort: function(), then: function(), catch: function()}|Promise|*} + */ function updateByQueryRethrottleApi(params, options, callback) { [params, options, callback] = normalizeArguments(params, options, callback); diff --git a/lib/Serializer.js b/lib/Serializer.js index 224a5bd4b..aaf162256 100644 --- a/lib/Serializer.js +++ b/lib/Serializer.js @@ -90,7 +90,7 @@ class Serializer { const keys = Object.keys(object); for (let i = 0, len = keys.length; i < len; i++) { const key = keys[i]; - // OpenSearch will complain for keys without a value + // OpenSearch will complain about keys without a value if (object[key] === undefined) { delete object[key]; } else if (Array.isArray(object[key]) === true) { diff --git a/lib/Transport.js b/lib/Transport.js index 9e1c4f3cb..399d2641f 100644 --- a/lib/Transport.js +++ b/lib/Transport.js @@ -56,6 +56,7 @@ const HEAP_SIZE_LIMIT = require('v8').getHeapStatistics().heap_size_limit; const kCompatibleCheck = Symbol('compatible check'); const kApiVersioning = Symbol('api versioning'); +/** Default Transport Layer */ class Transport { constructor(opts) { if (typeof opts.compression === 'string' && opts.compression !== 'gzip') { @@ -110,6 +111,27 @@ class Transport { } } + /** + * @param {Object} params + * @param {string} params.method - HTTP Method (e.g. HEAD, GET, POST...) + * @param {string} params.path - Relative URL path + * @param {Object | string} [params.body] - Body of a standard request. + * @param {Object[] | string} [params.bulkBody] - Body of a bulk request. + * @param {Object[] | string} [params.querystring] - Querystring params. + * + * @param {Object} options + * @param {number} [options.id] - Request ID + * @param {Object} [options.context] - Object used for observability + * @param {number} [options.maxRetries] - Max number of retries + * @param {false | 'gzip'} [options.compression] - Request body compression, if any + * @param {boolean} [options.asStream] - Whether to emit the response as stream + * @param {number[]} [options.ignore] - Response's Error Status Codes to ignore + * @param {Object} [options.headers] - Request headers + * @param {Object | string} [options.querystring] - Request's query string + * @param {number} [options.requestTimeout] - Max request timeout in milliseconds + * + * @param {function} callback - Callback that handles errors and response + */ request(params, options, callback) { options = options || {}; if (typeof options === 'function') { @@ -386,7 +408,7 @@ class Transport { // if the statusCode is 502/3/4 we should run our retry strategy // and mark the connection as dead this.connectionPool.markDead(meta.connection); - // retry logic (we shoukd not retry on "429 - Too Many Requests") + // retry logic (we should not retry on "429 - Too Many Requests") if (meta.attempts < maxRetries && result.statusCode !== 429) { meta.attempts++; debug(`Retrying request, there are still ${maxRetries - meta.attempts} attempts`, params); diff --git a/package.json b/package.json index 6e70572f4..6ac9bf634 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "fast-deep-equal": "^3.1.3", "into-stream": "^6.0.0", "js-yaml": "^4.1.0", + "jsdoc": "^4.0.0", "license-checker": "^25.0.1", "minimist": "^1.2.5", "node-fetch": "^3.2.10", @@ -80,14 +81,14 @@ "proxy": "^1.0.2", "rimraf": "^3.0.2", "semver": "^7.3.5", - "simple-git": "^3.5.0", + "simple-git": "^3.15.0", "simple-statistics": "^7.7.0", "split2": "^3.2.2", "stoppable": "^1.1.0", "tap": "^16.3.0", "tsd": "^0.24.1", "workq": "^3.0.0", - "xmlbuilder2": "^2.4.1" + "xmlbuilder2": "^3.0.2" }, "dependencies": { "aws4": "^1.11.0", diff --git a/yarn.lock b/yarn.lock index 6b6032b84..ffdabfe25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -257,6 +257,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.0.tgz#10a8d4e656bc01128d299a787aa006ce1a91e112" integrity sha512-AqDccGC+m5O/iUStSJy3DGRIUFu7WbY/CppZYwrEUB4N0tZlnI8CSTsgL7v5fHVFmUbRv2sd+yy27o8Ydt4MGg== +"@babel/parser@^7.9.4": + version "7.20.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.20.5.tgz#7f3c7335fe417665d929f34ae5dceae4c04015e8" + integrity sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA== + "@babel/plugin-proposal-object-rest-spread@^7.5.5": version "7.14.7" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.14.7.tgz#5920a2b3df7f7901df0205974c0641b13fd9d363" @@ -464,6 +469,13 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jsdoc/salty@^0.2.1": + version "0.2.2" + resolved "https://registry.yarnpkg.com/@jsdoc/salty/-/salty-0.2.2.tgz#567017ddda2048c5ff921aeffd38564a0578fdca" + integrity sha512-A1FrVnc7L9qI2gUGsfN0trTiJNK72Y0CL/VAyrmYEmeKI3pnHDawP64CEev31XLyAAOx2xmDo3tbadPxC0CSbw== + dependencies: + lodash "^4.17.21" + "@kwsites/file-exists@^1.1.1": version "1.1.1" resolved "https://registry.yarnpkg.com/@kwsites/file-exists/-/file-exists-1.1.1.tgz#ad1efcac13e1987d8dbaf235ef3be5b0d96faa99" @@ -497,10 +509,10 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@oozcitak/dom@1.15.8": - version "1.15.8" - resolved "https://registry.yarnpkg.com/@oozcitak/dom/-/dom-1.15.8.tgz#0c0c7bb54cfdaadc07fd637913e706101721d15d" - integrity sha512-MoOnLBNsF+ok0HjpAvxYxR4piUhRDCEWK0ot3upwOOHYudJd30j6M+LNcE8RKpwfnclAX9T66nXXzkytd29XSw== +"@oozcitak/dom@1.15.10": + version "1.15.10" + resolved "https://registry.yarnpkg.com/@oozcitak/dom/-/dom-1.15.10.tgz#dca7289f2b292cff2a901ea4fbbcc0a1ab0b05c2" + integrity sha512-0JT29/LaxVgRcGKvHmSrUTEvZ8BXvZhGl2LASRUgHqDTC1M5g1pLmVv56IYNyt3bG2CUjDkc67wnyZC14pbQrQ== dependencies: "@oozcitak/infra" "1.0.8" "@oozcitak/url" "1.0.4" @@ -562,6 +574,24 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.9.tgz#97edc9037ea0c38585320b28964dde3b39e4660d" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== +"@types/linkify-it@*": + version "3.0.2" + resolved "https://registry.yarnpkg.com/@types/linkify-it/-/linkify-it-3.0.2.tgz#fd2cd2edbaa7eaac7e7f3c1748b52a19143846c9" + integrity sha512-HZQYqbiFVWufzCwexrvh694SOim8z2d+xJl5UNamcvQFejLY/2YUtzXHYi3cHdI7PMlS8ejH2slRAOJQ32aNbA== + +"@types/markdown-it@^12.2.3": + version "12.2.3" + resolved "https://registry.yarnpkg.com/@types/markdown-it/-/markdown-it-12.2.3.tgz#0d6f6e5e413f8daaa26522904597be3d6cd93b51" + integrity sha512-GKMHFfv3458yYy+v/N8gjufHO6MSZKCOXpZc5GXIWWy8uldwfmPn98vp81gZ5f9SVw8YYBctgfJ22a2d7AOMeQ== + dependencies: + "@types/linkify-it" "*" + "@types/mdurl" "*" + +"@types/mdurl@*": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@types/mdurl/-/mdurl-1.0.2.tgz#e2ce9d83a613bacf284c7be7d491945e39e1f8e9" + integrity sha512-eC4U9MlIcu2q0KQmXszyn5Akca/0jrQmwDRgpAMJai7qBWq4amIQhZyNau4VYGtCeALvW1/NtjzJJ567aZxfKA== + "@types/minimist@^1.2.0": version "1.2.2" resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" @@ -813,6 +843,11 @@ bl@^4.1.0: inherits "^2.0.4" readable-stream "^3.4.0" +bluebird@^3.7.2: + version "3.7.2" + resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.7.2.tgz#9f229c15be272454ffa973ace0dbee79a1b0c36f" + integrity sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg== + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -913,6 +948,13 @@ cardinal@^2.1.1: ansicolors "~0.3.2" redeyed "~2.1.0" +catharsis@^0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/catharsis/-/catharsis-0.9.0.tgz#40382a168be0e6da308c277d3a2b3eb40c7d2121" + integrity sha512-prMTQVpcns/tzFgFVkVp6ak6RykZyWb3gu8ckUpd6YkTlacOd3DXGJjIpD4Q6zJirizvaiAjSSHlOsA+6sNh2A== + dependencies: + lodash "^4.17.15" + chalk@2.4.2, chalk@^2.0.0, chalk@^2.4.1: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -1060,7 +1102,7 @@ commondir@^1.0.1: concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" - integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= + integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg== convert-hrtime@^5.0.0: version "5.0.0" @@ -1213,6 +1255,11 @@ enquirer@^2.3.5: dependencies: ansi-colors "^4.1.1" +entities@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/entities/-/entities-2.1.0.tgz#992d3129cf7df6870b96c57858c249a120f8b8b5" + integrity sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w== + error-ex@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" @@ -1611,6 +1658,11 @@ graceful-fs@^4.1.15, graceful-fs@^4.1.2: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== +graceful-fs@^4.1.9: + version "4.2.10" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" + integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== + hard-rejection@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/hard-rejection/-/hard-rejection-2.1.0.tgz#1c6eda5c1685c63942766d79bb40ae773cecd883" @@ -1949,6 +2001,34 @@ js-yaml@^4.1.0: dependencies: argparse "^2.0.1" +js2xmlparser@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/js2xmlparser/-/js2xmlparser-4.0.2.tgz#2a1fdf01e90585ef2ae872a01bc169c6a8d5e60a" + integrity sha512-6n4D8gLlLf1n5mNLQPRfViYzu9RATblzPEtm1SthMX1Pjao0r9YI9nw7ZIfRxQMERS87mcswrg+r/OYrPRX6jA== + dependencies: + xmlcreate "^2.0.4" + +jsdoc@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsdoc/-/jsdoc-4.0.0.tgz#9569f79ea5b14ba4bc726da1a48fe6a241ad7893" + integrity sha512-tzTgkklbWKrlaQL2+e3NNgLcZu3NaK2vsHRx7tyHQ+H5jcB9Gx0txSd2eJWlMC/xU1+7LQu4s58Ry0RkuaEQVg== + dependencies: + "@babel/parser" "^7.9.4" + "@jsdoc/salty" "^0.2.1" + "@types/markdown-it" "^12.2.3" + bluebird "^3.7.2" + catharsis "^0.9.0" + escape-string-regexp "^2.0.0" + js2xmlparser "^4.0.2" + klaw "^3.0.0" + markdown-it "^12.3.2" + markdown-it-anchor "^8.4.1" + marked "^4.0.10" + mkdirp "^1.0.4" + requizzle "^0.2.3" + strip-json-comments "^3.1.0" + underscore "~1.13.2" + jsesc@^2.5.1: version "2.5.2" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4" @@ -1986,6 +2066,13 @@ kind-of@^6.0.3: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.3.tgz#07c05034a6c349fa06e24fa35aa76db4580ce4dd" integrity sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw== +klaw@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/klaw/-/klaw-3.0.0.tgz#b11bec9cf2492f06756d6e809ab73a2910259146" + integrity sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g== + dependencies: + graceful-fs "^4.1.9" + leven@2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" @@ -2039,6 +2126,13 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= +linkify-it@^3.0.1: + version "3.0.3" + resolved "https://registry.yarnpkg.com/linkify-it/-/linkify-it-3.0.3.tgz#a98baf44ce45a550efb4d49c769d07524cc2fa2e" + integrity sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ== + dependencies: + uc.micro "^1.0.1" + locate-path@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" @@ -2061,7 +2155,7 @@ lodash.truncate@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.truncate/-/lodash.truncate-4.4.2.tgz#5a350da0b1113b837ecfffd5812cbe58d6eae193" integrity sha1-WjUNoLERO4N+z//VgSy+WNbq4ZM= -lodash@^4.17.20: +lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -2105,6 +2199,32 @@ map-obj@^4.0.0: resolved "https://registry.yarnpkg.com/map-obj/-/map-obj-4.2.1.tgz#e4ea399dbc979ae735c83c863dd31bdf364277b7" integrity sha512-+WA2/1sPmDj1dlvvJmB5G6JKfY9dpn7EVBUL06+y6PoljPkh+6V1QihwxNkbcGxCRjt2b0F9K0taiCuo7MbdFQ== +markdown-it-anchor@^8.4.1: + version "8.6.6" + resolved "https://registry.yarnpkg.com/markdown-it-anchor/-/markdown-it-anchor-8.6.6.tgz#4a12e358c9c2167ee28cb7a5f10e29d6f1ffd7ca" + integrity sha512-jRW30YGywD2ESXDc+l17AiritL0uVaSnWsb26f+68qaW9zgbIIr1f4v2Nsvc0+s0Z2N3uX6t/yAw7BwCQ1wMsA== + +markdown-it@^12.3.2: + version "12.3.2" + resolved "https://registry.yarnpkg.com/markdown-it/-/markdown-it-12.3.2.tgz#bf92ac92283fe983fe4de8ff8abfb5ad72cd0c90" + integrity sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg== + dependencies: + argparse "^2.0.1" + entities "~2.1.0" + linkify-it "^3.0.1" + mdurl "^1.0.1" + uc.micro "^1.0.5" + +marked@^4.0.10: + version "4.2.4" + resolved "https://registry.yarnpkg.com/marked/-/marked-4.2.4.tgz#5a4ce6c7a1ae0c952601fce46376ee4cf1797e1c" + integrity sha512-Wcc9ikX7Q5E4BYDPvh1C6QNSxrjC9tBgz+A/vAhp59KXUgachw++uMvMKiSW8oA85nopmPZcEvBoex/YLMsiyA== + +mdurl@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e" + integrity sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g== + meow@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/meow/-/meow-9.0.0.tgz#cd9510bc5cac9dee7d03c73ee1f9ad959f4ea364" @@ -2147,9 +2267,9 @@ min-indent@^1.0.0: integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== minimatch@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" - integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" @@ -2710,6 +2830,13 @@ require-main-filename@^2.0.0: resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg== +requizzle@^0.2.3: + version "0.2.4" + resolved "https://registry.yarnpkg.com/requizzle/-/requizzle-0.2.4.tgz#319eb658b28c370f0c20f968fa8ceab98c13d27c" + integrity sha512-JRrFk1D4OQ4SqovXOgdav+K8EAhSB/LJZqCz8tbX0KObcdeM15Ss59ozWMBWmmINMagCwmqn4ZNryUGpBsl6Jw== + dependencies: + lodash "^4.17.21" + resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" @@ -2841,10 +2968,10 @@ signal-exit@^3.0.4, signal-exit@^3.0.6: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -simple-git@^3.5.0: - version "3.13.0" - resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.13.0.tgz#36589e201c28cecaca6f3a898e7257c6610e8588" - integrity sha512-VYrs3joeHvWGcN3K135RpGpPjm4AHYeOrclwew6LlfHgq6ozQYIW2yMnmjf4PCgVOuSYCbXkdUjyiFawuJz8MA== +simple-git@^3.15.0: + version "3.15.1" + resolved "https://registry.yarnpkg.com/simple-git/-/simple-git-3.15.1.tgz#57f595682cb0c2475d5056da078a05c8715a25ef" + integrity sha512-73MVa5984t/JP4JcQt0oZlKGr42ROYWC3BcUZfuHtT3IHKPspIvL0cZBnvPXF7LL3S/qVeVHVdYYmJ3LOTw4Rg== dependencies: "@kwsites/file-exists" "^1.1.1" "@kwsites/promise-deferred" "^1.1.1" @@ -3272,6 +3399,16 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" +uc.micro@^1.0.1, uc.micro@^1.0.5: + version "1.0.6" + resolved "https://registry.yarnpkg.com/uc.micro/-/uc.micro-1.0.6.tgz#9c411a802a409a91fc6cf74081baba34b24499ac" + integrity sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA== + +underscore@~1.13.2: + version "1.13.6" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.13.6.tgz#04786a1f589dc6c09f761fc5f45b89e935136441" + integrity sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A== + unicode-length@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/unicode-length/-/unicode-length-2.0.2.tgz#e5eb4c0d523fdf7bebb59ca261c9ca1cf732da96" @@ -3396,17 +3533,22 @@ ws@^7, ws@^7.5.5: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -xmlbuilder2@^2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/xmlbuilder2/-/xmlbuilder2-2.4.1.tgz#899c783a833188c5a5aa6f3c5428a3963f3e479d" - integrity sha512-vliUplZsk5vJnhxXN/mRcij/AE24NObTUm/Zo4vkLusgayO6s3Et5zLEA14XZnY1c3hX5o1ToR0m0BJOPy0UvQ== +xmlbuilder2@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/xmlbuilder2/-/xmlbuilder2-3.0.2.tgz#fc499688b35a916f269e7b459c2fa02bb5c0822a" + integrity sha512-h4MUawGY21CTdhV4xm3DG9dgsqyhDkZvVJBx88beqX8wJs3VgyGQgAn5VreHuae6unTQxh115aMK5InCVmOIKw== dependencies: - "@oozcitak/dom" "1.15.8" + "@oozcitak/dom" "1.15.10" "@oozcitak/infra" "1.0.8" "@oozcitak/util" "8.3.8" "@types/node" "*" js-yaml "3.14.0" +xmlcreate@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/xmlcreate/-/xmlcreate-2.0.4.tgz#0c5ab0f99cdd02a81065fa9cd8f8ae87624889be" + integrity sha512-nquOebG4sngPmGPICTS5EnxqhKbCmz5Ox5hsszI2T6U5qdrJizBc+0ilYSEjTSzU0yZcmvppztXe/5Al5fUwdg== + y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf"