UNPKG

@elastic/elasticsearch

Version:
1,052 lines 1.98 MB
/** * We are still working on this type, it will arrive soon. * If it's critical for you, please open an issue. * https://github.com/elastic/elasticsearch-js */ export type TODO = Record<string, any>; export interface BulkCreateOperation extends BulkWriteOperation { } export interface BulkDeleteOperation extends BulkOperationBase { } export type BulkFailureStoreStatus = 'not_applicable_or_unknown' | 'used' | 'not_enabled' | 'failed'; export interface BulkIndexOperation extends BulkWriteOperation { } export interface BulkOperationBase { /** The document ID. */ _id?: Id; /** The name of the index or index alias to perform the action on. */ _index?: IndexName; /** A custom value used to route operations to a specific shard. */ routing?: Routing; if_primary_term?: long; if_seq_no?: SequenceNumber; version?: VersionNumber; version_type?: VersionType; } export interface BulkOperationContainer { /** Index the specified document. * If the document exists, it replaces the document and increments the version. * The following line must contain the source data to be indexed. */ index?: BulkIndexOperation; /** Index the specified document if it does not already exist. * The following line must contain the source data to be indexed. */ create?: BulkCreateOperation; /** Perform a partial document update. * The following line must contain the partial document and update options. */ update?: BulkUpdateOperation; /** Remove the specified document from the index. */ delete?: BulkDeleteOperation; } export type BulkOperationType = 'index' | 'create' | 'update' | 'delete'; export interface BulkRequest<TDocument = unknown, TPartialDocument = unknown> extends RequestBase { /** The name of the data stream, index, or index alias to perform bulk actions on. */ index?: IndexName; /** True or false if to include the document source in the error message in case of parsing errors. */ include_source_on_error?: boolean; /** If `true`, the response will include the ingest pipelines that were run for each index or create. */ list_executed_pipelines?: boolean; /** The pipeline identifier to use to preprocess incoming documents. * If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. * If a final pipeline is configured, it will always run regardless of the value of this parameter. */ pipeline?: string; /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. * If `wait_for`, wait for a refresh to make this operation visible to search. * If `false`, do nothing with refreshes. * Valid values: `true`, `false`, `wait_for`. */ refresh?: Refresh; /** A custom value that is used to route operations to a specific shard. */ routing?: Routing; /** Indicates whether to return the `_source` field (`true` or `false`) or contains a list of fields to return. */ _source?: SearchSourceConfigParam; /** A comma-separated list of source fields to exclude from the response. * You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_excludes?: Fields; /** A comma-separated list of source fields to include in the response. * If this parameter is specified, only these source fields are returned. * You can exclude fields from this subset using the `_source_excludes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields; /** The period each action waits for the following operations: automatic index creation, dynamic mapping updates, and waiting for active shards. * The default is `1m` (one minute), which guarantees Elasticsearch waits for at least the timeout before failing. * The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration; /** The number of shard copies that must be active before proceeding with the operation. * Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * The default is `1`, which waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards; /** If `true`, the request's actions must target an index alias. */ require_alias?: boolean; /** If `true`, the request's actions must target a data stream (existing or to be created). */ require_data_stream?: boolean; operations?: (BulkOperationContainer | BulkUpdateAction<TDocument, TPartialDocument> | TDocument)[]; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { index?: never; include_source_on_error?: never; list_executed_pipelines?: never; pipeline?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; timeout?: never; wait_for_active_shards?: never; require_alias?: never; require_data_stream?: never; operations?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { index?: never; include_source_on_error?: never; list_executed_pipelines?: never; pipeline?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; timeout?: never; wait_for_active_shards?: never; require_alias?: never; require_data_stream?: never; operations?: never; }; } export interface BulkResponse { /** If `true`, one or more of the operations in the bulk request did not complete successfully. */ errors: boolean; /** The result of each operation in the bulk request, in the order they were submitted. */ items: Partial<Record<BulkOperationType, BulkResponseItem>>[]; /** The length of time, in milliseconds, it took to process the bulk request. */ took: long; ingest_took?: long; } export interface BulkResponseItem { /** The document ID associated with the operation. */ _id?: string | null; /** The name of the index associated with the operation. * If the operation targeted a data stream, this is the backing index into which the document was written. */ _index: string; /** The HTTP status code returned for the operation. */ status: integer; failure_store?: BulkFailureStoreStatus; /** Additional information about the failed operation. * The property is returned only for failed operations. */ error?: ErrorCause; /** The primary term assigned to the document for the operation. * This property is returned only for successful operations. */ _primary_term?: long; /** The result of the operation. * Successful values are `created`, `deleted`, and `updated`. */ result?: string; /** The sequence number assigned to the document for the operation. * Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version. */ _seq_no?: SequenceNumber; /** Shard information for the operation. */ _shards?: ShardStatistics; /** The document version associated with the operation. * The document version is incremented each time the document is updated. * This property is returned only for successful actions. */ _version?: VersionNumber; forced_refresh?: boolean; get?: InlineGet<Record<string, any>>; } export interface BulkUpdateAction<TDocument = unknown, TPartialDocument = unknown> { /** If true, the `result` in the response is set to 'noop' when no changes to the document occur. */ detect_noop?: boolean; /** A partial update to an existing document. */ doc?: TPartialDocument; /** Set to `true` to use the contents of `doc` as the value of `upsert`. */ doc_as_upsert?: boolean; /** The script to run to update the document. */ script?: Script | ScriptSource; /** Set to `true` to run the script whether or not the document exists. */ scripted_upsert?: boolean; /** If `false`, source retrieval is turned off. * You can also specify a comma-separated list of the fields you want to retrieve. */ _source?: SearchSourceConfig; /** If the document does not already exist, the contents of `upsert` are inserted as a new document. * If the document exists, the `script` is run. */ upsert?: TDocument; } export interface BulkUpdateOperation extends BulkOperationBase { /** If `true`, the request's actions must target an index alias. */ require_alias?: boolean; /** The number of times an update should be retried in the case of a version conflict. */ retry_on_conflict?: integer; } export interface BulkWriteOperation extends BulkOperationBase { /** A map from the full name of fields to the name of dynamic templates. * It defaults to an empty map. * If a name matches a dynamic template, that template will be applied regardless of other match predicates defined in the template. * If a field is already defined in the mapping, then this parameter won't be used. */ dynamic_templates?: Record<string, string>; /** The ID of the pipeline to use to preprocess incoming documents. * If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. * If a final pipeline is configured, it will always run regardless of the value of this parameter. */ pipeline?: string; /** If `true`, the request's actions must target an index alias. */ require_alias?: boolean; } export interface ClearScrollRequest extends RequestBase { /** A comma-separated list of scroll IDs to clear. * To clear all scroll IDs, use `_all`. * IMPORTANT: Scroll IDs can be long. It is recommended to specify scroll IDs in the request body parameter. */ scroll_id?: ScrollIds; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { scroll_id?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { scroll_id?: never; }; } export interface ClearScrollResponse { /** If `true`, the request succeeded. * This does not indicate whether any scrolling search requests were cleared. */ succeeded: boolean; /** The number of scrolling search requests cleared. */ num_freed: integer; } export interface ClosePointInTimeRequest extends RequestBase { /** The ID of the point-in-time. */ id: Id; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; }; } export interface ClosePointInTimeResponse { /** If `true`, all search contexts associated with the point-in-time ID were successfully closed. */ succeeded: boolean; /** The number of search contexts that were successfully closed. */ num_freed: integer; } export interface CountRequest extends RequestBase { /** A comma-separated list of data streams, indices, and aliases to search. * It supports wildcards (`*`). * To search all data streams and indices, omit this parameter or use `*` or `_all`. */ index?: Indices; /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. * This behavior applies even if the request targets other open indices. * For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean; /** The analyzer to use for the query string. * This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string; /** If `true`, wildcard and prefix queries are analyzed. * This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean; /** The default operator for query string query: `AND` or `OR`. * This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator; /** The field to use as a default when no field prefix is given in the query string. * This parameter can be used only when the `q` query string parameter is specified. */ df?: string; /** The type of index that wildcard patterns can match. * If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. * It supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards; /** If `true`, concrete, expanded, or aliased indices are ignored when frozen. */ ignore_throttled?: boolean; /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean; /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. * This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean; /** The minimum `_score` value that documents must have to be included in the result. */ min_score?: double; /** The node or shard the operation should be performed on. * By default, it is random. */ preference?: string; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** The maximum number of documents to collect for each shard. * If a query reaches this limit, Elasticsearch terminates the query early. * Elasticsearch collects documents before sorting. * * IMPORTANT: Use with caution. * Elasticsearch applies this parameter to each shard handling the request. * When possible, let Elasticsearch perform early termination automatically. * Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. */ terminate_after?: long; /** The query in Lucene query string syntax. This parameter cannot be used with a request body. */ q?: string; /** Defines the search query using Query DSL. A request body query cannot be used * with the `q` query string parameter. */ query?: QueryDslQueryContainer; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { index?: never; allow_no_indices?: never; analyzer?: never; analyze_wildcard?: never; default_operator?: never; df?: never; expand_wildcards?: never; ignore_throttled?: never; ignore_unavailable?: never; lenient?: never; min_score?: never; preference?: never; routing?: never; terminate_after?: never; q?: never; query?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { index?: never; allow_no_indices?: never; analyzer?: never; analyze_wildcard?: never; default_operator?: never; df?: never; expand_wildcards?: never; ignore_throttled?: never; ignore_unavailable?: never; lenient?: never; min_score?: never; preference?: never; routing?: never; terminate_after?: never; q?: never; query?: never; }; } export interface CountResponse { count: long; _shards: ShardStatistics; } export interface CreateRequest<TDocument = unknown> extends RequestBase { /** A unique identifier for the document. * To automatically generate a document ID, use the `POST /<target>/_doc/` request format. */ id: Id; /** The name of the data stream or index to target. * If the target doesn't exist and matches the name or wildcard (`*`) pattern of an index template with a `data_stream` definition, this request creates the data stream. * If the target doesn't exist and doesn’t match a data stream template, this request creates the index. */ index: IndexName; /** Only perform the operation if the document has this primary term. */ if_primary_term?: long; /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber; /** True or false if to include the document source in the error message in case of parsing errors. */ include_source_on_error?: boolean; /** Set to `create` to only index the document if it does not already exist (put if absent). * If a document with the specified `_id` already exists, the indexing operation will fail. * The behavior is the same as using the `<index>/_create` endpoint. * If a document ID is specified, this paramater defaults to `index`. * Otherwise, it defaults to `create`. * If the request targets a data stream, an `op_type` of `create` is required. */ op_type?: OpType; /** The ID of the pipeline to use to preprocess incoming documents. * If the index has a default ingest pipeline specified, setting the value to `_none` turns off the default ingest pipeline for this request. * If a final pipeline is configured, it will always run regardless of the value of this parameter. */ pipeline?: string; /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. * If `wait_for`, it waits for a refresh to make this operation visible to search. * If `false`, it does nothing with refreshes. */ refresh?: Refresh; /** If `true`, the destination must be an index alias. */ require_alias?: boolean; /** If `true`, the request's actions must target a data stream (existing or to be created). */ require_data_stream?: boolean; /** A custom value that is used to route operations to a specific shard. */ routing?: Routing; /** The period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards. * Elasticsearch waits for at least the specified timeout period before failing. * The actual wait time could be longer, particularly when multiple waits occur. * * This parameter is useful for situations where the primary shard assigned to perform the operation might not be available when the operation runs. * Some reasons for this might be that the primary shard is currently recovering from a gateway or undergoing relocation. * By default, the operation will wait on the primary shard to become available for at least 1 minute before failing and responding with an error. * The actual wait time could be longer, particularly when multiple waits occur. */ timeout?: Duration; /** The explicit version number for concurrency control. * It must be a non-negative long number. */ version?: VersionNumber; /** The version type. */ version_type?: VersionType; /** The number of shard copies that must be active before proceeding with the operation. * You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards; document?: TDocument; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; index?: never; if_primary_term?: never; if_seq_no?: never; include_source_on_error?: never; op_type?: never; pipeline?: never; refresh?: never; require_alias?: never; require_data_stream?: never; routing?: never; timeout?: never; version?: never; version_type?: never; wait_for_active_shards?: never; document?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; index?: never; if_primary_term?: never; if_seq_no?: never; include_source_on_error?: never; op_type?: never; pipeline?: never; refresh?: never; require_alias?: never; require_data_stream?: never; routing?: never; timeout?: never; version?: never; version_type?: never; wait_for_active_shards?: never; document?: never; }; } export type CreateResponse = WriteResponseBase; export interface DeleteRequest extends RequestBase { /** A unique identifier for the document. */ id: Id; /** The name of the target index. */ index: IndexName; /** Only perform the operation if the document has this primary term. */ if_primary_term?: long; /** Only perform the operation if the document has this sequence number. */ if_seq_no?: SequenceNumber; /** If `true`, Elasticsearch refreshes the affected shards to make this operation visible to search. * If `wait_for`, it waits for a refresh to make this operation visible to search. * If `false`, it does nothing with refreshes. */ refresh?: Refresh; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** The period to wait for active shards. * * This parameter is useful for situations where the primary shard assigned to perform the delete operation might not be available when the delete operation runs. * Some reasons for this might be that the primary shard is currently recovering from a store or undergoing relocation. * By default, the delete operation will wait on the primary shard to become available for up to 1 minute before failing and responding with an error. */ timeout?: Duration; /** An explicit version number for concurrency control. * It must match the current version of the document for the request to succeed. */ version?: VersionNumber; /** The version type. */ version_type?: VersionType; /** The minimum number of shard copies that must be active before proceeding with the operation. * You can set it to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * The default value of `1` means it waits for each primary shard to be active. */ wait_for_active_shards?: WaitForActiveShards; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; index?: never; if_primary_term?: never; if_seq_no?: never; refresh?: never; routing?: never; timeout?: never; version?: never; version_type?: never; wait_for_active_shards?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; index?: never; if_primary_term?: never; if_seq_no?: never; refresh?: never; routing?: never; timeout?: never; version?: never; version_type?: never; wait_for_active_shards?: never; }; } export type DeleteResponse = WriteResponseBase; export interface DeleteByQueryRequest extends RequestBase { /** A comma-separated list of data streams, indices, and aliases to search. * It supports wildcards (`*`). * To search all data streams or indices, omit this parameter or use `*` or `_all`. */ index: Indices; /** If `false`, the request returns an error if any wildcard expression, index alias, or `_all` value targets only missing or closed indices. * This behavior applies even if the request targets other open indices. * For example, a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. */ allow_no_indices?: boolean; /** Analyzer to use for the query string. * This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string; /** If `true`, wildcard and prefix queries are analyzed. * This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean; /** What to do if delete by query hits version conflicts: `abort` or `proceed`. */ conflicts?: Conflicts; /** The default operator for query string query: `AND` or `OR`. * This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator; /** The field to use as default where no field prefix is given in the query string. * This parameter can be used only when the `q` query string parameter is specified. */ df?: string; /** The type of index that wildcard patterns can match. * If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. * It supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards; /** Skips the specified number of documents. */ from?: long; /** If `false`, the request returns an error if it targets a missing or closed index. */ ignore_unavailable?: boolean; /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. * This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean; /** The node or shard the operation should be performed on. * It is random by default. */ preference?: string; /** If `true`, Elasticsearch refreshes all shards involved in the delete by query after the request completes. * This is different than the delete API's `refresh` parameter, which causes just the shard that received the delete request to be refreshed. * Unlike the delete API, it does not support `wait_for`. */ refresh?: boolean; /** If `true`, the request cache is used for this request. * Defaults to the index-level setting. */ request_cache?: boolean; /** The throttle for this request in sub-requests per second. */ requests_per_second?: float; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** A query in the Lucene query string syntax. */ q?: string; /** The period to retain the search context for scrolling. */ scroll?: Duration; /** The size of the scroll request that powers the operation. */ scroll_size?: long; /** The explicit timeout for each search request. * It defaults to no timeout. */ search_timeout?: Duration; /** The type of the search operation. * Available options include `query_then_fetch` and `dfs_query_then_fetch`. */ search_type?: SearchType; /** The number of slices this task should be divided into. */ slices?: Slices; /** A comma-separated list of `<field>:<direction>` pairs. */ sort?: string[]; /** The specific `tag` of the request for logging and statistical purposes. */ stats?: string[]; /** The maximum number of documents to collect for each shard. * If a query reaches this limit, Elasticsearch terminates the query early. * Elasticsearch collects documents before sorting. * * Use with caution. * Elasticsearch applies this parameter to each shard handling the request. * When possible, let Elasticsearch perform early termination automatically. * Avoid specifying this parameter for requests that target data streams with backing indices across multiple data tiers. */ terminate_after?: long; /** The period each deletion request waits for active shards. */ timeout?: Duration; /** If `true`, returns the document version as part of a hit. */ version?: boolean; /** The number of shard copies that must be active before proceeding with the operation. * Set to `all` or any positive integer up to the total number of shards in the index (`number_of_replicas+1`). * The `timeout` value controls how long each write request waits for unavailable shards to become available. */ wait_for_active_shards?: WaitForActiveShards; /** If `true`, the request blocks until the operation is complete. * If `false`, Elasticsearch performs some preflight checks, launches the request, and returns a task you can use to cancel or get the status of the task. Elasticsearch creates a record of this task as a document at `.tasks/task/${taskId}`. When you are done with a task, you should delete the task document so Elasticsearch can reclaim the space. */ wait_for_completion?: boolean; /** The maximum number of documents to delete. */ max_docs?: long; /** The documents to delete specified with Query DSL. */ query?: QueryDslQueryContainer; /** Slice the request manually using the provided slice ID and total number of slices. */ slice?: SlicedScroll; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { index?: never; allow_no_indices?: never; analyzer?: never; analyze_wildcard?: never; conflicts?: never; default_operator?: never; df?: never; expand_wildcards?: never; from?: never; ignore_unavailable?: never; lenient?: never; preference?: never; refresh?: never; request_cache?: never; requests_per_second?: never; routing?: never; q?: never; scroll?: never; scroll_size?: never; search_timeout?: never; search_type?: never; slices?: never; sort?: never; stats?: never; terminate_after?: never; timeout?: never; version?: never; wait_for_active_shards?: never; wait_for_completion?: never; max_docs?: never; query?: never; slice?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { index?: never; allow_no_indices?: never; analyzer?: never; analyze_wildcard?: never; conflicts?: never; default_operator?: never; df?: never; expand_wildcards?: never; from?: never; ignore_unavailable?: never; lenient?: never; preference?: never; refresh?: never; request_cache?: never; requests_per_second?: never; routing?: never; q?: never; scroll?: never; scroll_size?: never; search_timeout?: never; search_type?: never; slices?: never; sort?: never; stats?: never; terminate_after?: never; timeout?: never; version?: never; wait_for_active_shards?: never; wait_for_completion?: never; max_docs?: never; query?: never; slice?: never; }; } export interface DeleteByQueryResponse { /** The number of scroll responses pulled back by the delete by query. */ batches?: long; /** The number of documents that were successfully deleted. */ deleted?: long; /** An array of failures if there were any unrecoverable errors during the process. * If this array is not empty, the request ended abnormally because of those failures. * Delete by query is implemented using batches and any failures cause the entire process to end but all failures in the current batch are collected into the array. * You can use the `conflicts` option to prevent reindex from ending on version conflicts. */ failures?: BulkIndexByScrollFailure[]; /** This field is always equal to zero for delete by query. * It exists only so that delete by query, update by query, and reindex APIs return responses with the same structure. */ noops?: long; /** The number of requests per second effectively run during the delete by query. */ requests_per_second?: float; /** The number of retries attempted by delete by query. * `bulk` is the number of bulk actions retried. * `search` is the number of search actions retried. */ retries?: Retries; slice_id?: integer; task?: TaskId; throttled?: Duration; /** The number of milliseconds the request slept to conform to `requests_per_second`. */ throttled_millis?: DurationValue<UnitMillis>; throttled_until?: Duration; /** This field should always be equal to zero in a `_delete_by_query` response. * It has meaning only when using the task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be run again in order to conform to `requests_per_second`. */ throttled_until_millis?: DurationValue<UnitMillis>; /** If `true`, some requests run during the delete by query operation timed out. */ timed_out?: boolean; /** The number of milliseconds from start to end of the whole operation. */ took?: DurationValue<UnitMillis>; /** The number of documents that were successfully processed. */ total?: long; /** The number of version conflicts that the delete by query hit. */ version_conflicts?: long; } export interface DeleteByQueryRethrottleRequest extends RequestBase { /** The ID for the task. */ task_id: TaskId; /** The throttle for this request in sub-requests per second. * To disable throttling, set it to `-1`. */ requests_per_second?: float; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { task_id?: never; requests_per_second?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { task_id?: never; requests_per_second?: never; }; } export type DeleteByQueryRethrottleResponse = TasksTaskListResponseBase; export interface DeleteScriptRequest extends RequestBase { /** The identifier for the stored script or search template. */ id: Id; /** The period to wait for a connection to the master node. * If no response is received before the timeout expires, the request fails and returns an error. * It can also be set to `-1` to indicate that the request should never timeout. */ master_timeout?: Duration; /** The period to wait for a response. * If no response is received before the timeout expires, the request fails and returns an error. * It can also be set to `-1` to indicate that the request should never timeout. */ timeout?: Duration; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; master_timeout?: never; timeout?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; master_timeout?: never; timeout?: never; }; } export type DeleteScriptResponse = AcknowledgedResponseBase; export interface ExistsRequest extends RequestBase { /** A unique document identifier. */ id: Id; /** A comma-separated list of data streams, indices, and aliases. * It supports wildcards (`*`). */ index: IndexName; /** The node or shard the operation should be performed on. * By default, the operation is randomized between the shard replicas. * * If it is set to `_local`, the operation will prefer to be run on a local allocated shard when possible. * If it is set to a custom value, the value is used to guarantee that the same shards will be used for the same custom value. * This can help with "jumping values" when hitting different shards in different refresh states. * A sample value can be something like the web session ID or the user name. */ preference?: string; /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean; /** If `true`, the request refreshes the relevant shards before retrieving the document. * Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam; /** A comma-separated list of source fields to exclude from the response. * You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_excludes?: Fields; /** A comma-separated list of source fields to include in the response. * If this parameter is specified, only these source fields are returned. * You can exclude fields from this subset using the `_source_excludes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields; /** A comma-separated list of stored fields to return as part of a hit. * If no fields are specified, no stored fields are included in the response. * If this field is specified, the `_source` parameter defaults to `false`. */ stored_fields?: Fields; /** Explicit version number for concurrency control. * The specified version must match the current version of the document for the request to succeed. */ version?: VersionNumber; /** The version type. */ version_type?: VersionType; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; index?: never; preference?: never; realtime?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; stored_fields?: never; version?: never; version_type?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; index?: never; preference?: never; realtime?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; stored_fields?: never; version?: never; version_type?: never; }; } export type ExistsResponse = boolean; export interface ExistsSourceRequest extends RequestBase { /** A unique identifier for the document. */ id: Id; /** A comma-separated list of data streams, indices, and aliases. * It supports wildcards (`*`). */ index: IndexName; /** The node or shard the operation should be performed on. * By default, the operation is randomized between the shard replicas. */ preference?: string; /** If `true`, the request is real-time as opposed to near-real-time. */ realtime?: boolean; /** If `true`, the request refreshes the relevant shards before retrieving the document. * Setting it to `true` should be done after careful thought and verification that this does not cause a heavy load on the system (and slow down indexing). */ refresh?: boolean; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** Indicates whether to return the `_source` field (`true` or `false`) or lists the fields to return. */ _source?: SearchSourceConfigParam; /** A comma-separated list of source fields to exclude in the response. */ _source_excludes?: Fields; /** A comma-separated list of source fields to include in the response. */ _source_includes?: Fields; /** The version number for concurrency control. * It must match the current version of the document for the request to succeed. */ version?: VersionNumber; /** The version type. */ version_type?: VersionType; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; index?: never; preference?: never; realtime?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; version?: never; version_type?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; index?: never; preference?: never; realtime?: never; refresh?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; version?: never; version_type?: never; }; } export type ExistsSourceResponse = boolean; export interface ExplainExplanation { description: string; details: ExplainExplanationDetail[]; value: float; } export interface ExplainExplanationDetail { description: string; details?: ExplainExplanationDetail[]; value: float; } export interface ExplainRequest extends RequestBase { /** The document identifier. */ id: Id; /** Index names that are used to limit the request. * Only a single index name can be provided to this parameter. */ index: IndexName; /** The analyzer to use for the query string. * This parameter can be used only when the `q` query string parameter is specified. */ analyzer?: string; /** If `true`, wildcard and prefix queries are analyzed. * This parameter can be used only when the `q` query string parameter is specified. */ analyze_wildcard?: boolean; /** The default operator for query string query: `AND` or `OR`. * This parameter can be used only when the `q` query string parameter is specified. */ default_operator?: QueryDslOperator; /** The field to use as default where no field prefix is given in the query string. * This parameter can be used only when the `q` query string parameter is specified. */ df?: string; /** If `true`, format-based query failures (such as providing text to a numeric field) in the query string will be ignored. * This parameter can be used only when the `q` query string parameter is specified. */ lenient?: boolean; /** The node or shard the operation should be performed on. * It is random by default. */ preference?: string; /** A custom value used to route operations to a specific shard. */ routing?: Routing; /** `True` or `false` to return the `_source` field or not or a list of fields to return. */ _source?: SearchSourceConfigParam; /** A comma-separated list of source fields to exclude from the response. * You can also use this parameter to exclude fields from the subset specified in `_source_includes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_excludes?: Fields; /** A comma-separated list of source fields to include in the response. * If this parameter is specified, only these source fields are returned. * You can exclude fields from this subset using the `_source_excludes` query parameter. * If the `_source` parameter is `false`, this parameter is ignored. */ _source_includes?: Fields; /** A comma-separated list of stored fields to return in the response. */ stored_fields?: Fields; /** The query in the Lucene query string syntax. */ q?: string; /** Defines the search definition using the Query DSL. */ query?: QueryDslQueryContainer; /** All values in `body` will be added to the request body. */ body?: string | ({ [key: string]: any; } & { id?: never; index?: never; analyzer?: never; analyze_wildcard?: never; default_operator?: never; df?: never; lenient?: never; preference?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; stored_fields?: never; q?: never; query?: never; }); /** All values in `querystring` will be added to the request querystring. */ querystring?: { [key: string]: any; } & { id?: never; index?: never; analyzer?: never; analyze_wildcard?: never; default_operator?: never; df?: never; lenient?: never; preference?: never; routing?: never; _source?: never; _source_excludes?: never; _source_includes?: never; stored_fields?: never; q?: never; query?: never; }; } export interface ExplainResponse<TDocument = unknown> { _index: IndexName; _id: Id; matched: boolean; explanation?: ExplainExplanationDetail; get?: InlineGet<TDocument>; } export interface FieldCapsFieldCapability { /** Whether this field can be aggregated on all indices. */ aggregatable: boolean; /** The list of indices where this field has the same type family, or null if all indices have the same type family for the field. */ indices?: Indices; /** Merged metadata across all indices as a map of string keys to arrays of values. A value length of 1 indicates that all indices had the same value for this key, while a length of 2 or more indicates that not all indices had the same value for this key. */ meta?: Metadata; /** The list of indices where this field is not aggregatable, or null if all indices have the same definition for the field. */ non_aggregatable_indices?: Indices; /** The list of indices where this field is not searchable, or null if all indices have the same definition for the field. */ non_searchable_indices?: Indices; /** Whether this field is indexed for search on all indices. */ searchable: boolean; type: string; /** Whether this field is registered as a metadata field. */ metadata_field?: boolean; /** Whether this field is used as a time series dimension. * @experimental */ time_series_dimension?: boolean; /** Contains metric type if this fields is used as a time series * metrics, absent if the field is not used as metric. * @experimental */ time_series_metric?: MappingTimeSeriesMetricType; /** If this list is present in response then some indices have the * field marked as a dimension and other indices, the ones in this list, do not. * @experimental */ non_dimension_indices?: IndexName[]; /** The list of indices where this field is present if these indices * don’t have the same `time_series_metric` value for this field. * @experimental */ metric_conflicts_indices?: IndexName[]; } export interface FieldCapsRequest extends RequestBase { /** A comma-separated list of data streams, indices, and aliases used to limit the request. Supports wildcards (*). To target all data streams and indices, omit this parameter or use * or _all. */ index?: Indices; /** If false, the request returns an error if any wildcard expression, index alias, * or `_all` value targets only missing or closed indices. This behavior applies even if the request targets other open indices. For example, a request * targeting `foo*,bar*` returns an error if an index starts with foo but no index starts with bar. */ allow_no_indices?: boolean; /** The type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard expressions match hidden data streams. Supports comma-separated values, such as `open,hidden`. */ expand_wildcards?: ExpandWildcards; /** If `true`, missing or closed indices are not included in the response. */ ignore_unavailable?: boolean; /** If true, unmapped fields are included in the response. */ include_unmapped?: boolean; /** A comma-separated list of filters to apply to the response. */ filters?: string; /** A comma-separated list of field types to include. * Any fields that do not match one of these types will be excluded from the results. * It defaults to empty, meaning that all field types are returned. */ types?: string[]; /** If false, empty fields are not included in the response. */ include_empty_fields?: boolean; /** A list of fields to retr