Namespace: API-Document

API-Document

Methods

(static) bulkApi(params, options, callback) → {Object|Promise.<never>|*}

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: OpenSearch - Bulk
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
body Array.<Object> Request Body
index string <optional>
Specifying the index means you don’t need to include it in the request body.
pipeline string <optional>
The pipeline ID for preprocessing documents.
routing string <optional>
Routes the request to the specified shard.
refresh string <optional>
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.
timeout string <optional>
1m How long to wait for a response from the cluster.
wait_for_active_shards string <optional>
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.
require_alias boolean <optional>
false Specifies whether the target index must be an index alias.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) createApi(params, options, callback) → {Object|Promise.<never>|*}

Adds a document with a predefined ID to an index.
See Also: OpenSearch - Index Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string A unique identifier to attach to the document.
body Object The content of the document.
if_seq_no number <optional>
Only perform the index operation if the document has the specified sequence number.
if_primary_term number <optional>
Only perform the index operation if the document has the specified primary term.
pipeline string <optional>
Route the index operation to a certain pipeline.
routing string <optional>
value used to assign the index operation to a specific shard.
refresh string <optional>
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.
timeout string <optional>
1m How long to wait for a response from the cluster.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
wait_for_active_shards string <optional>
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.
require_alias boolean <optional>
false Specifies whether the target index must be an index alias.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) deleteApi(params, options, callback) → {Object|Promise.<never>|*}

Delete a document
See Also: OpenSearch - Update Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string A unique identifier to attach to the document.
if_seq_no number <optional>
Only perform the delete operation if the document has the specified sequence number.
if_primary_term number <optional>
Only perform the delete operation if the document has the specified primary term.
routing string <optional>
Value used to assign the index operation to a specific shard.
refresh string <optional>
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.
timeout string <optional>
1m How long to wait for a response from the cluster.
wait_for_active_shards string <optional>
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.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) deleteByQueryApi(params, options, callback) → {Object|Promise.<never>|*}

Deletes documents matching the provided query.
See Also: OpenSearch - Delete by query
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
body Object The search definition using the Query DSL
analyzer string <optional>
The analyzer to use for the query string
analyze_wildcard boolean <optional>
false Specify whether wildcard and prefix queries should be analyzed
default_operator string <optional>
OR The default operator for query string query (options: AND, OR)
df string <optional>
The field to use as default where no field prefix is given in the query string
from number <optional>
0 Starting offset
ignore_unavailable boolean <optional>
false Whether specified concrete indices should be ignored when unavailable (missing or closed)
allow_no_indices boolean <optional>
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)
conflicts string <optional>
What to do when the delete-by-query hits version conflicts? (options: abort, proceed)
expand_wildcards string <optional>
open Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
lenient boolean <optional>
false Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
preference string <optional>
Specify the node or shard the operation should be performed on (default: random)
q string <optional>
Query in the Lucene query string syntax
routing string <optional>
A comma-separated list of specific routing values
scroll string <optional>
Specify how long a consistent view of the index should be maintained for scrolled search
search_type string <optional>
Search operation type (options: query_then_fetch, dfs_query_then_fetch)
search_timeout string <optional>
Explicit timeout for each search request. Defaults to no timeout.
size number <optional>
Deprecated, please use 'max_docs' instead
max_docs number <optional>
Maximum number of documents to process (default: all documents)
sort string <optional>
A comma-separated list of : pairs
_source string <optional>
True or false to return the _source field or not, or a list of fields to return
_source_excludes string <optional>
A list of fields to exclude from the returned _source field
_source_includes string <optional>
A list of fields to extract and return from the _source field
terminate_after number <optional>
The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
stats string <optional>
Specific 'tag' of the request for logging and statistical purposes
version boolean <optional>
Specify whether to return document version as part of a hit
request_cache boolean <optional>
Specify if request cache should be used for this request or not, defaults to index level setting
refresh boolean <optional>
false Should the effected indexes be refreshed?
timeout string <optional>
1m time each individual bulk request should wait for shards that are unavailable.
wait_for_active_shards string <optional>
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)
scroll_size number <optional>
1000 Size on the scroll request powering the delete-by-query
wait_for_completion boolean <optional>
Should the request should block until the delete-by-query is complete.
requests_per_second number <optional>
-1 The throttle for this request in sub-requests per second. -1 means no throttle.
slices string <optional>
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'.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) deleteByQueryRethrottleApi(params, options, callback) → {Object|Promise.<never>|*}

Changes the number of requests per second for a particular Delete By Query operation.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
task_id string The task id to rethrottle
requests_per_second number The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) existsApi(params, options, callback) → {Object|Promise.<never>|*}

Check whether a document exists
See Also: OpenSearch - Get Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string Document ID.
preference string <optional>
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.
realtime boolean <optional>
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.
refresh boolean <optional>
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.
routing string <optional>
A value used to route the operation to a specific shard.
stored_fields boolean <optional>
false Whether the get operation should retrieve fields stored in the index.
_source string <optional>
true Whether to include the '_source' field in the response body.
_source_excludes string <optional>
A comma-separated list of source fields to exclude in the query response.
_source_includes string <optional>
A comma-separated list of source fields to include in the query response.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) getApi(params, options, callback) → {Object|Promise.<never>|*}

Retrieve a document
See Also: OpenSearch - Get Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string Document ID.
preference string <optional>
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.
realtime boolean <optional>
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.
refresh boolean <optional>
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.
routing string <optional>
A value used to route the operation to a specific shard.
stored_fields boolean <optional>
false Whether the get operation should retrieve fields stored in the index.
_source string <optional>
true Whether to include the '_source' field in the response body.
_source_excludes string <optional>
A comma-separated list of source fields to exclude in the query response.
_source_includes string <optional>
A comma-separated list of source fields to include in the query response.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) getSourceApi(params, options, callback) → {Object|Promise.<never>|*}

Retrieve the source of a document
See Also: OpenSearch - Get Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string Document ID.
preference string <optional>
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.
realtime boolean <optional>
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.
refresh boolean <optional>
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.
routing string <optional>
A value used to route the operation to a specific shard.
stored_fields boolean <optional>
false Whether the get operation should retrieve fields stored in the index.
_source string <optional>
true Whether to include the '_source' field in the response body.
_source_excludes string <optional>
A comma-separated list of source fields to exclude in the query response.
_source_includes string <optional>
A comma-separated list of source fields to include in the query response.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) indexApi(params, options, callback) → {Object|Promise.<never>|*}

Adds a document to an index.
See Also: OpenSearch - Index Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
body Object The content of the document.
id string <optional>
A unique identifier to attach to the document.
if_seq_no number <optional>
Only perform the index operation if the document has the specified sequence number.
if_primary_term number <optional>
Only perform the index operation if the document has the specified primary term.
pipeline string <optional>
Route the index operation to a certain pipeline.
routing string <optional>
value used to assign the index operation to a specific shard.
refresh string <optional>
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.
timeout string <optional>
1m How long to wait for a response from the cluster.
version number <optional>
The document’s version number.
version_type number <optional>
Specific version type (options: 'external' and 'external_gte')
wait_for_active_shards string <optional>
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.
require_alias boolean <optional>
false Specifies whether the target index must be an index alias.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) mgetApi(params, options, callback) → {Object|Promise.<never>|*}

Retrieve multiple documents
See Also: OpenSearch - Multi-get Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string Document ID.
body string Multi-get Request Body
preference string <optional>
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.
realtime boolean <optional>
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.
refresh boolean <optional>
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.
routing string <optional>
A value used to route the operation to a specific shard.
stored_fields boolean <optional>
false Whether the get operation should retrieve fields stored in the index.
_source string <optional>
true Whether to include the '_source' field in the response body.
_source_excludes string <optional>
A comma-separated list of source fields to exclude in the query response.
_source_includes string <optional>
A comma-separated list of source fields to include in the query response.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) reindexApi(params, options, callback) → {Object|Promise.<never>|*}

Copy all or a subset of your data from a source index into a destination index.
See Also: OpenSearch - Reindex Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
body Object The search definition using the Query DSL and the prototype for the index request.
refresh boolean <optional>
false Should the affected indexes be refreshed?
timeout string <optional>
30s Time each individual bulk request should wait for shards that are unavailable.
wait_for_active_shards string <optional>
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)
wait_for_completion boolean <optional>
false Should the request should block until the reindex is complete.
requests_per_second number <optional>
-1 The throttle to set on this request in sub-requests per second. -1 means no throttle.
scroll string <optional>
5m Control how long to keep the search context alive
slices number | string <optional>
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`.
max_docs number <optional>
Maximum number of documents to process (default: all documents)
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) reindexRethrottleApi(params, options, callback) → {Object|Promise.<never>|*}

Changes the number of requests per second for a particular Reindex operation.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
task_id string The task id to rethrottle
requests_per_second number The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) termvectorsApi(params, options, callback) → {Object|Promise.<never>|*}

Returns information and statistics about terms in the fields of a particular document.
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
index string The index in which the document resides.
id string <optional>
The id of the document, when not specified a doc param should be supplied.
term_statistics boolean <optional>
Specifies if total term frequency and document frequency should be returned.
field_statistics boolean <optional>
Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.
fields string <optional>
A comma-separated list of fields to return.
offsets boolean <optional>
Specifies if term offsets should be returned.
positions boolean <optional>
Specifies if term positions should be returned.
payloads boolean <optional>
Specifies if term payloads should be returned.
preference string <optional>
Specify the node or shard the operation should be performed on (default: random).
routing string <optional>
Specific routing value.
realtime boolean <optional>
Specifies if request is real-time as opposed to near-real-time (default: true).
version number <optional>
Explicit version number for concurrency control
version_type string <optional>
Specific version type (options: internal, external, external_gte, force)
body Object <optional>
Define parameters and or supply a document to get termvectors for. See documentation.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) updateApi(params, options, callback) → {Object|Promise.<never>|*}

Update an existing document
See Also: OpenSearch - Update Document
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string Name of the index.
id string A unique identifier to attach to the document.
body Object The request definition requires either `script` or partial `doc`.
if_seq_no number <optional>
Only perform the update operation if the document has the specified sequence number.
if_primary_term number <optional>
Only perform the update operation if the document has the specified primary term.
lang string <optional>
painless Language of the script.
routing string <optional>
Value used to assign the index operation to a specific shard.
_source string <optional>
true Whether to include the '_source' field in the response body.
_source_excludes string <optional>
A comma-separated list of source fields to exclude in the query response.
_source_includes string <optional>
A comma-separated list of source fields to include in the query response.
refresh string <optional>
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.
retry_on_conflict number <optional>
0 The amount of times OpenSearch should retry the operation if there’s a document conflict.
timeout string <optional>
1m How long to wait for a response from the cluster.
wait_for_active_shards string <optional>
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.
require_alias boolean <optional>
false Specifies whether the target index must be an index alias.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) updateByQueryApi(params, options, callback) → {Object|Promise.<never>|*}

Run a script to update all documents that match the query.
See Also: OpenSearch - Update by query
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
index string A comma-separated list of index names to search; use '_all' or empty string to perform the operation on all indices
body Object <optional>
The search definition using the Query DSL
analyzer string <optional>
The analyzer to use for the query string
analyze_wildcard boolean <optional>
false Specify whether wildcard and prefix queries should be analyzed (default: false)
default_operator string <optional>
OR The default operator for query string query (options: AND, OR)
df string <optional>
The field to use as default where no field prefix is given in the query string
from number <optional>
0 Starting offset
ignore_unavailable boolean <optional>
false Whether specified concrete indices should be ignored when unavailable (missing or closed)
allow_no_indices boolean <optional>
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)
conflicts string <optional>
abort What to do when the update by query hits version conflicts? (options: abort, proceed)
expand_wildcards string <optional>
open Whether to expand wildcard expression to concrete indices that are open, closed or both. (options: open, closed, hidden, none, all)
lenient boolean <optional>
false Specify whether format-based query failures (such as providing text to a numeric field) should be ignored
pipeline string <optional>
Ingest pipeline to set on index requests made by this action. (default: none)
preference string <optional>
Specify the node or shard the operation should be performed on (default: random)
q string <optional>
Query in the Lucene query string syntax
routing string <optional>
A comma-separated list of specific routing values
scroll string <optional>
Specify how long a consistent view of the index should be maintained for scrolled search
search_type string <optional>
query_then_fetch Search operation type (options: query_then_fetch, dfs_query_then_fetch)
search_timeout string <optional>
Explicit timeout for each search request. Defaults to no timeout.
size number <optional>
Deprecated, please use 'max_docs' instead
max_docs number <optional>
Maximum number of documents to process (default: all documents)
sort string <optional>
A comma-separated list of : pairs
_source string <optional>
True or false to return the _source field or not, or a list of fields to return
_source_excludes string <optional>
A list of fields to exclude from the returned _source field
_source_includes string <optional>
A list of fields to extract and return from the _source field
terminate_after number <optional>
The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early.
stats string <optional>
Specific 'tag' of the request for logging and statistical purposes
version boolean <optional>
Specify whether to return document version as part of a hit
version_type boolean <optional>
Should the document increment the version number (internal) on hit or not (reindex)
request_cache boolean <optional>
Specify if request cache should be used for this request or not, defaults to index level setting
refresh boolean <optional>
false Should the affected indexes be refreshed?
timeout string <optional>
Time each individual bulk request should wait for shards that are unavailable.
wait_for_active_shards string <optional>
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)
scroll_size number <optional>
1000 Size on the scroll request powering the update by query
wait_for_completion boolean <optional>
true Should the request should block until the update by query operation is complete.
requests_per_second number <optional>
-1 The throttle to set on this request in sub-requests per second. -1 means no throttle.
slices string <optional>
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'.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *

(static) updateByQueryRethrottleApi(params, options, callback) → {Object|Promise.<never>|*}

Changes the number of requests per second for a particular Update By Query operation.
Parameters:
Name Type Description
params Object
Properties
Name Type Description
task_id string The task id to rethrottle
requests_per_second number The throttle to set on this request in floating sub-requests per second. -1 means set no throttle.
options Object Options for Transport#request
callback function Callback that handles errors and response
Source:
Returns:
Type
Object | Promise.<never> | *