[[reference-indices]]
== client.indices

////////
===========================================================================================================================
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
||        ██████╗ ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗                                                            ||
||        ██╔══██╗██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝                                                            ||
||        ██████╔╝█████╗  ███████║██║  ██║██╔████╔██║█████╗                                                              ||
||        ██╔══██╗██╔══╝  ██╔══██║██║  ██║██║╚██╔╝██║██╔══╝                                                              ||
||        ██║  ██║███████╗██║  ██║██████╔╝██║ ╚═╝ ██║███████╗                                                            ||
||        ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝╚═════╝ ╚═╝     ╚═╝╚══════╝                                                            ||
||                                                                                                                       ||
||                                                                                                                       ||
||    This file is autogenerated, DO NOT send pull requests that changes this file directly.                             ||
||    You should update the script that does the generation, which can be found in:                                      ||
||    https://github.com/elastic/elastic-client-generator-js                                                             ||
||                                                                                                                       ||
||    You can run the script with the following command:                                                                 ||
||       npm run elasticsearch -- --version <version>                                                                    ||
||                                                                                                                       ||
||                                                                                                                       ||
||                                                                                                                       ||
===========================================================================================================================
////////
++++
<style>
.lang-ts a.xref {
  text-decoration: underline !important;
}
</style>
++++


[discrete]
[[client.indices.addBlock]]
== `client.indices.addBlock()`

Add an index block. Limits the operations allowed on an index by blocking specific operation types.

{ref}/index-modules-blocks.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesAddBlockRequest, options?: TransportRequestOptions) => Promise<IndicesAddBlockResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesAddBlockRequest extends <<RequestBase>> {
  index: <<IndexName>>
  block: IndicesAddBlockIndicesBlockOptions
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesAddBlockResponse {
  acknowledged: boolean
  shards_acknowledged: boolean
  indices: IndicesAddBlockIndicesBlockStatus[]
}

----


[discrete]
[[client.indices.analyze]]
== `client.indices.analyze()`

Get tokens from text analysis. The analyze API performs [analysis](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis.html) on a text string and returns the resulting tokens.

{ref}/indices-analyze.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesAnalyzeRequest, options?: TransportRequestOptions) => Promise<IndicesAnalyzeResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesAnalyzeRequest extends <<RequestBase>> {
  index?: <<IndexName>>
  analyzer?: string
  attributes?: string[]
  char_filter?: <<AnalysisCharFilter>>[]
  explain?: boolean
  field?: <<Field>>
  filter?: <<AnalysisTokenFilter>>[]
  normalizer?: string
  text?: IndicesAnalyzeTextToAnalyze
  tokenizer?: <<AnalysisTokenizer>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesAnalyzeResponse {
  detail?: IndicesAnalyzeAnalyzeDetail
  tokens?: IndicesAnalyzeAnalyzeToken[]
}

----


[discrete]
[[client.indices.clearCache]]
== `client.indices.clearCache()`

Clears the caches of one or more indices. For data streams, the API clears the caches of the stream’s backing indices.

{ref}/indices-clearcache.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesClearCacheRequest, options?: TransportRequestOptions) => Promise<IndicesClearCacheResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesClearCacheRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  fielddata?: boolean
  fields?: <<Fields>>
  ignore_unavailable?: boolean
  query?: boolean
  request?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesClearCacheResponse = <<ShardsOperationResponseBase>>

----


[discrete]
[[client.indices.clone]]
== `client.indices.clone()`

Clones an existing index.

{ref}/indices-clone-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesCloneRequest, options?: TransportRequestOptions) => Promise<IndicesCloneResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesCloneRequest extends <<RequestBase>> {
  index: <<IndexName>>
  target: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  aliases?: Record<<<IndexName>>, <<IndicesAlias>>>
  settings?: Record<string, any>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesCloneResponse {
  acknowledged: boolean
  index: <<IndexName>>
  shards_acknowledged: boolean
}

----


[discrete]
[[client.indices.close]]
== `client.indices.close()`

Closes an index.

{ref}/indices-close.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesCloseRequest, options?: TransportRequestOptions) => Promise<IndicesCloseResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesCloseRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesCloseResponse {
  acknowledged: boolean
  indices: Record<<<IndexName>>, IndicesCloseCloseIndexResult>
  shards_acknowledged: boolean
}

----


[discrete]
[[client.indices.create]]
== `client.indices.create()`

Create an index. Creates a new index.

{ref}/indices-create-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesCreateRequest, options?: TransportRequestOptions) => Promise<IndicesCreateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesCreateRequest extends <<RequestBase>> {
  index: <<IndexName>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  aliases?: Record<<<Name>>, <<IndicesAlias>>>
  mappings?: <<MappingTypeMapping>>
  settings?: <<IndicesIndexSettings>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesCreateResponse {
  index: <<IndexName>>
  shards_acknowledged: boolean
  acknowledged: boolean
}

----


[discrete]
[[client.indices.createDataStream]]
== `client.indices.createDataStream()`

Create a data stream. Creates a data stream. You must have a matching index template with data stream enabled.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesCreateDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesCreateDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesCreateDataStreamRequest extends <<RequestBase>> {
  name: <<DataStreamName>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesCreateDataStreamResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.dataStreamsStats]]
== `client.indices.dataStreamsStats()`

Get data stream stats. Retrieves statistics for one or more data streams.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDataStreamsStatsRequest, options?: TransportRequestOptions) => Promise<IndicesDataStreamsStatsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDataStreamsStatsRequest extends <<RequestBase>> {
  name?: <<IndexName>>
  expand_wildcards?: <<ExpandWildcards>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesDataStreamsStatsResponse {
  _shards: <<ShardStatistics>>
  backing_indices: <<integer>>
  data_stream_count: <<integer>>
  data_streams: IndicesDataStreamsStatsDataStreamsStatsItem[]
  total_store_sizes?: <<ByteSize>>
  total_store_size_bytes: <<long>>
}

----


[discrete]
[[client.indices.delete]]
== `client.indices.delete()`

Delete indices. Deletes one or more indices.

{ref}/indices-delete-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteResponse = <<IndicesResponseBase>>

----


[discrete]
[[client.indices.deleteAlias]]
== `client.indices.deleteAlias()`

Delete an alias. Removes a data stream or index from an alias.

{ref}/indices-aliases.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteAliasRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteAliasResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteAliasRequest extends <<RequestBase>> {
  index: <<Indices>>
  name: <<Names>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteAliasResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.deleteDataLifecycle]]
== `client.indices.deleteDataLifecycle()`

Delete data stream lifecycles. Removes the data stream lifecycle from a data stream, rendering it not managed by the data stream lifecycle.

{ref}/data-streams-delete-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteDataLifecycleRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteDataLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteDataLifecycleRequest extends <<RequestBase>> {
  name: <<DataStreamNames>>
  expand_wildcards?: <<ExpandWildcards>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteDataLifecycleResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.deleteDataStream]]
== `client.indices.deleteDataStream()`

Delete data streams. Deletes one or more data streams and their backing indices.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteDataStreamRequest extends <<RequestBase>> {
  name: <<DataStreamNames>>
  master_timeout?: <<Duration>>
  expand_wildcards?: <<ExpandWildcards>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteDataStreamResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.deleteIndexTemplate]]
== `client.indices.deleteIndexTemplate()`

Delete an index template. The provided <index-template> may contain multiple template names separated by a comma. If multiple template names are specified then there is no wildcard support and the provided names should match completely with existing templates.

{ref}/indices-delete-template.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteIndexTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteIndexTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteIndexTemplateRequest extends <<RequestBase>> {
  name: <<Names>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteIndexTemplateResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.deleteTemplate]]
== `client.indices.deleteTemplate()`

Deletes a legacy index template.

{ref}/indices-delete-template-v1.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDeleteTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesDeleteTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDeleteTemplateRequest extends <<RequestBase>> {
  name: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDeleteTemplateResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.diskUsage]]
== `client.indices.diskUsage()`

Analyzes the disk usage of each field of an index or data stream.

{ref}/indices-disk-usage.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDiskUsageRequest, options?: TransportRequestOptions) => Promise<IndicesDiskUsageResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDiskUsageRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flush?: boolean
  ignore_unavailable?: boolean
  run_expensive_tasks?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDiskUsageResponse = any

----


[discrete]
[[client.indices.downsample]]
== `client.indices.downsample()`

Aggregates a time series (TSDS) index and stores pre-computed statistical summaries (`min`, `max`, `sum`, `value_count` and `avg`) for each metric field grouped by a configured time interval.

{ref}/indices-downsample-data-stream.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesDownsampleRequest, options?: TransportRequestOptions) => Promise<IndicesDownsampleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesDownsampleRequest extends <<RequestBase>> {
  index: <<IndexName>>
  target_index: <<IndexName>>
  config?: <<IndicesDownsampleConfig>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesDownsampleResponse = any

----


[discrete]
[[client.indices.exists]]
== `client.indices.exists()`

Check indices. Checks if one or more indices, index aliases, or data streams exist.

{ref}/indices-exists.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesExistsRequest, options?: TransportRequestOptions) => Promise<IndicesExistsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesExistsRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flat_settings?: boolean
  ignore_unavailable?: boolean
  include_defaults?: boolean
  local?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesExistsResponse = boolean

----


[discrete]
[[client.indices.existsAlias]]
== `client.indices.existsAlias()`

Check aliases. Checks if one or more data stream or index aliases exist.

{ref}/indices-aliases.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesExistsAliasRequest, options?: TransportRequestOptions) => Promise<IndicesExistsAliasResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesExistsAliasRequest extends <<RequestBase>> {
  name: <<Names>>
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  local?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesExistsAliasResponse = boolean

----


[discrete]
[[client.indices.existsIndexTemplate]]
== `client.indices.existsIndexTemplate()`

Returns information about whether a particular index template exists.

{ref}/index-templates.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesExistsIndexTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesExistsIndexTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesExistsIndexTemplateRequest extends <<RequestBase>> {
  name: <<Name>>
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesExistsIndexTemplateResponse = boolean

----


[discrete]
[[client.indices.existsTemplate]]
== `client.indices.existsTemplate()`

Check existence of index templates. Returns information about whether a particular index template exists.

{ref}/indices-template-exists-v1.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesExistsTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesExistsTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesExistsTemplateRequest extends <<RequestBase>> {
  name: <<Names>>
  flat_settings?: boolean
  local?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesExistsTemplateResponse = boolean

----


[discrete]
[[client.indices.explainDataLifecycle]]
== `client.indices.explainDataLifecycle()`

Get the status for a data stream lifecycle. Retrieves information about an index or data stream’s current data stream lifecycle status, such as time since index creation, time since rollover, the lifecycle configuration managing the index, or any errors encountered during lifecycle execution.

{ref}/data-streams-explain-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesExplainDataLifecycleRequest, options?: TransportRequestOptions) => Promise<IndicesExplainDataLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesExplainDataLifecycleRequest extends <<RequestBase>> {
  index: <<Indices>>
  include_defaults?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesExplainDataLifecycleResponse {
  indices: Record<<<IndexName>>, IndicesExplainDataLifecycleDataStreamLifecycleExplain>
}

----


[discrete]
[[client.indices.fieldUsageStats]]
== `client.indices.fieldUsageStats()`

Returns field usage information for each shard and field of an index.

{ref}/field-usage-stats.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesFieldUsageStatsRequest, options?: TransportRequestOptions) => Promise<IndicesFieldUsageStatsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesFieldUsageStatsRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  fields?: <<Fields>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesFieldUsageStatsResponse = IndicesFieldUsageStatsFieldsUsageBody

----


[discrete]
[[client.indices.flush]]
== `client.indices.flush()`

Flushes one or more data streams or indices.

{ref}/indices-flush.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesFlushRequest, options?: TransportRequestOptions) => Promise<IndicesFlushResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesFlushRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  force?: boolean
  ignore_unavailable?: boolean
  wait_if_ongoing?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesFlushResponse = <<ShardsOperationResponseBase>>

----


[discrete]
[[client.indices.forcemerge]]
== `client.indices.forcemerge()`

Performs the force merge operation on one or more indices.

{ref}/indices-forcemerge.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesForcemergeRequest, options?: TransportRequestOptions) => Promise<IndicesForcemergeResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesForcemergeRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flush?: boolean
  ignore_unavailable?: boolean
  max_num_segments?: <<long>>
  only_expunge_deletes?: boolean
  wait_for_completion?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesForcemergeResponse = IndicesForcemergeForceMergeResponseBody

----


[discrete]
[[client.indices.get]]
== `client.indices.get()`

Get index information. Returns information about one or more indices. For data streams, the API returns information about the stream’s backing indices.

{ref}/indices-get-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetRequest, options?: TransportRequestOptions) => Promise<IndicesGetResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flat_settings?: boolean
  ignore_unavailable?: boolean
  include_defaults?: boolean
  local?: boolean
  master_timeout?: <<Duration>>
  features?: IndicesGetFeatures
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetResponse = Record<<<IndexName>>, <<IndicesIndexState>>>

----


[discrete]
[[client.indices.getAlias]]
== `client.indices.getAlias()`

Get aliases. Retrieves information for one or more data stream or index aliases.

{ref}/indices-aliases.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetAliasRequest, options?: TransportRequestOptions) => Promise<IndicesGetAliasResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetAliasRequest extends <<RequestBase>> {
  name?: <<Names>>
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  local?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetAliasResponse = Record<<<IndexName>>, IndicesGetAliasIndexAliases>

----


[discrete]
[[client.indices.getDataLifecycle]]
== `client.indices.getDataLifecycle()`

Get data stream lifecycles. Retrieves the data stream lifecycle configuration of one or more data streams.

{ref}/data-streams-get-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetDataLifecycleRequest, options?: TransportRequestOptions) => Promise<IndicesGetDataLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetDataLifecycleRequest extends <<RequestBase>> {
  name: <<DataStreamNames>>
  expand_wildcards?: <<ExpandWildcards>>
  include_defaults?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesGetDataLifecycleResponse {
  data_streams: IndicesGetDataLifecycleDataStreamWithLifecycle[]
}

----


[discrete]
[[client.indices.getDataStream]]
== `client.indices.getDataStream()`

Get data streams. Retrieves information about one or more data streams.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesGetDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetDataStreamRequest extends <<RequestBase>> {
  name?: <<DataStreamNames>>
  expand_wildcards?: <<ExpandWildcards>>
  include_defaults?: boolean
  master_timeout?: <<Duration>>
  verbose?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesGetDataStreamResponse {
  data_streams: <<IndicesDataStream>>[]
}

----


[discrete]
[[client.indices.getFieldMapping]]
== `client.indices.getFieldMapping()`

Get mapping definitions. Retrieves mapping definitions for one or more fields. For data streams, the API retrieves field mappings for the stream’s backing indices.

{ref}/indices-get-field-mapping.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetFieldMappingRequest, options?: TransportRequestOptions) => Promise<IndicesGetFieldMappingResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetFieldMappingRequest extends <<RequestBase>> {
  fields: <<Fields>>
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  include_defaults?: boolean
  local?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetFieldMappingResponse = Record<<<IndexName>>, IndicesGetFieldMappingTypeFieldMappings>

----


[discrete]
[[client.indices.getIndexTemplate]]
== `client.indices.getIndexTemplate()`

Get index templates. Returns information about one or more index templates.

{ref}/indices-get-template.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetIndexTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesGetIndexTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetIndexTemplateRequest extends <<RequestBase>> {
  name?: <<Name>>
  local?: boolean
  flat_settings?: boolean
  master_timeout?: <<Duration>>
  include_defaults?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesGetIndexTemplateResponse {
  index_templates: IndicesGetIndexTemplateIndexTemplateItem[]
}

----


[discrete]
[[client.indices.getMapping]]
== `client.indices.getMapping()`

Get mapping definitions. Retrieves mapping definitions for one or more indices. For data streams, the API retrieves mappings for the stream’s backing indices.

{ref}/indices-get-mapping.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetMappingRequest, options?: TransportRequestOptions) => Promise<IndicesGetMappingResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetMappingRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  local?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetMappingResponse = Record<<<IndexName>>, IndicesGetMappingIndexMappingRecord>

----


[discrete]
[[client.indices.getSettings]]
== `client.indices.getSettings()`

Get index settings. Returns setting information for one or more indices. For data streams, returns setting information for the stream’s backing indices.

{ref}/indices-get-settings.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetSettingsRequest, options?: TransportRequestOptions) => Promise<IndicesGetSettingsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetSettingsRequest extends <<RequestBase>> {
  index?: <<Indices>>
  name?: <<Names>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flat_settings?: boolean
  ignore_unavailable?: boolean
  include_defaults?: boolean
  local?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetSettingsResponse = Record<<<IndexName>>, <<IndicesIndexState>>>

----


[discrete]
[[client.indices.getTemplate]]
== `client.indices.getTemplate()`

Get index templates. Retrieves information about one or more index templates.

{ref}/indices-get-template-v1.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesGetTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesGetTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesGetTemplateRequest extends <<RequestBase>> {
  name?: <<Names>>
  flat_settings?: boolean
  local?: boolean
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesGetTemplateResponse = Record<string, <<IndicesTemplateMapping>>>

----


[discrete]
[[client.indices.migrateToDataStream]]
== `client.indices.migrateToDataStream()`

Convert an index alias to a data stream. Converts an index alias to a data stream. You must have a matching index template that is data stream enabled. The alias must meet the following criteria: The alias must have a write index; All indices for the alias must have a `@timestamp` field mapping of a `date` or `date_nanos` field type; The alias must not have any filters; The alias must not use custom routing. If successful, the request removes the alias and creates a data stream with the same name. The indices for the alias become hidden backing indices for the stream. The write index for the alias becomes the write index for the stream.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesMigrateToDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesMigrateToDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesMigrateToDataStreamRequest extends <<RequestBase>> {
  name: <<IndexName>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesMigrateToDataStreamResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.modifyDataStream]]
== `client.indices.modifyDataStream()`

Update data streams. Performs one or more data stream modification actions in a single atomic operation.

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesModifyDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesModifyDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesModifyDataStreamRequest extends <<RequestBase>> {
  actions: IndicesModifyDataStreamAction[]
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesModifyDataStreamResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.open]]
== `client.indices.open()`

Opens a closed index. For data streams, the API opens any closed backing indices.

{ref}/indices-open-close.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesOpenRequest, options?: TransportRequestOptions) => Promise<IndicesOpenResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesOpenRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesOpenResponse {
  acknowledged: boolean
  shards_acknowledged: boolean
}

----


[discrete]
[[client.indices.promoteDataStream]]
== `client.indices.promoteDataStream()`

Promotes a data stream from a replicated data stream managed by CCR to a regular data stream

{ref}/data-streams.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPromoteDataStreamRequest, options?: TransportRequestOptions) => Promise<IndicesPromoteDataStreamResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPromoteDataStreamRequest extends <<RequestBase>> {
  name: <<IndexName>>
  master_timeout?: <<Duration>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPromoteDataStreamResponse = any

----


[discrete]
[[client.indices.putAlias]]
== `client.indices.putAlias()`

Create or update an alias. Adds a data stream or index to an alias.

{ref}/indices-aliases.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutAliasRequest, options?: TransportRequestOptions) => Promise<IndicesPutAliasResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutAliasRequest extends <<RequestBase>> {
  index: <<Indices>>
  name: <<Name>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  filter?: <<QueryDslQueryContainer>>
  index_routing?: <<Routing>>
  is_write_index?: boolean
  routing?: <<Routing>>
  search_routing?: <<Routing>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutAliasResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.putDataLifecycle]]
== `client.indices.putDataLifecycle()`

Update data stream lifecycles. Update the data stream lifecycle of the specified data streams.

{ref}/data-streams-put-lifecycle.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutDataLifecycleRequest, options?: TransportRequestOptions) => Promise<IndicesPutDataLifecycleResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutDataLifecycleRequest extends <<RequestBase>> {
  name: <<DataStreamNames>>
  expand_wildcards?: <<ExpandWildcards>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  data_retention?: <<Duration>>
  downsampling?: <<IndicesDataStreamLifecycleDownsampling>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutDataLifecycleResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.putIndexTemplate]]
== `client.indices.putIndexTemplate()`

Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

{ref}/indices-put-template.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutIndexTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesPutIndexTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutIndexTemplateRequest extends <<RequestBase>> {
  name: <<Name>>
  create?: boolean
  master_timeout?: <<Duration>>
  cause?: string
  index_patterns?: <<Indices>>
  composed_of?: <<Name>>[]
  template?: IndicesPutIndexTemplateIndexTemplateMapping
  data_stream?: <<IndicesDataStreamVisibility>>
  priority?: <<long>>
  version?: <<VersionNumber>>
  _meta?: <<Metadata>>
  allow_auto_create?: boolean
  ignore_missing_component_templates?: string[]
  deprecated?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutIndexTemplateResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.putMapping]]
== `client.indices.putMapping()`

Update field mappings. Adds new fields to an existing data stream or index. You can also use this API to change the search settings of existing fields. For data streams, these changes are applied to all backing indices by default.

{ref}/indices-put-mapping.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutMappingRequest, options?: TransportRequestOptions) => Promise<IndicesPutMappingResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutMappingRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  write_index_only?: boolean
  date_detection?: boolean
  dynamic?: <<MappingDynamicMapping>>
  dynamic_date_formats?: string[]
  dynamic_templates?: Record<string, <<MappingDynamicTemplate>>> | Record<string, <<MappingDynamicTemplate>>>[]
  _field_names?: <<MappingFieldNamesField>>
  _meta?: <<Metadata>>
  numeric_detection?: boolean
  properties?: Record<<<PropertyName>>, <<MappingProperty>>>
  _routing?: <<MappingRoutingField>>
  _source?: <<MappingSourceField>>
  runtime?: <<MappingRuntimeFields>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutMappingResponse = <<IndicesResponseBase>>

----


[discrete]
[[client.indices.putSettings]]
== `client.indices.putSettings()`

Update index settings. Changes dynamic index settings in real time. For data streams, index setting changes are applied to all backing indices by default.

{ref}/indices-update-settings.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutSettingsRequest, options?: TransportRequestOptions) => Promise<IndicesPutSettingsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutSettingsRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  flat_settings?: boolean
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  preserve_existing?: boolean
  timeout?: <<Duration>>
  settings?: <<IndicesIndexSettings>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutSettingsResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.putTemplate]]
== `client.indices.putTemplate()`

Create or update an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices.

{ref}/indices-templates-v1.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesPutTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesPutTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesPutTemplateRequest extends <<RequestBase>> {
  name: <<Name>>
  create?: boolean
  master_timeout?: <<Duration>>
  cause?: string
  aliases?: Record<<<IndexName>>, <<IndicesAlias>>>
  index_patterns?: string | string[]
  mappings?: <<MappingTypeMapping>>
  order?: <<integer>>
  settings?: <<IndicesIndexSettings>>
  version?: <<VersionNumber>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesPutTemplateResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.recovery]]
== `client.indices.recovery()`

Returns information about ongoing and completed shard recoveries for one or more indices. For data streams, the API returns information for the stream’s backing indices.

{ref}/indices-recovery.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesRecoveryRequest, options?: TransportRequestOptions) => Promise<IndicesRecoveryResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesRecoveryRequest extends <<RequestBase>> {
  index?: <<Indices>>
  active_only?: boolean
  detailed?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesRecoveryResponse = Record<<<IndexName>>, IndicesRecoveryRecoveryStatus>

----


[discrete]
[[client.indices.refresh]]
== `client.indices.refresh()`

Refresh an index. A refresh makes recent operations performed on one or more indices available for search. For data streams, the API runs the refresh operation on the stream’s backing indices.

{ref}/indices-refresh.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesRefreshRequest, options?: TransportRequestOptions) => Promise<IndicesRefreshResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesRefreshRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesRefreshResponse = <<ShardsOperationResponseBase>>

----


[discrete]
[[client.indices.reloadSearchAnalyzers]]
== `client.indices.reloadSearchAnalyzers()`

Reloads an index's search analyzers and their resources.

{ref}/indices-reload-analyzers.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesReloadSearchAnalyzersRequest, options?: TransportRequestOptions) => Promise<IndicesReloadSearchAnalyzersResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesReloadSearchAnalyzersRequest extends <<RequestBase>> {
  index: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesReloadSearchAnalyzersResponse = IndicesReloadSearchAnalyzersReloadResult

----


[discrete]
[[client.indices.resolveCluster]]
== `client.indices.resolveCluster()`

Resolves the specified index expressions to return information about each cluster, including the local cluster, if included. Multiple patterns and remote clusters are supported.

{ref}/indices-resolve-cluster-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesResolveClusterRequest, options?: TransportRequestOptions) => Promise<IndicesResolveClusterResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesResolveClusterRequest extends <<RequestBase>> {
  name: <<Names>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_throttled?: boolean
  ignore_unavailable?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesResolveClusterResponse = Record<<<ClusterAlias>>, IndicesResolveClusterResolveClusterInfo>

----


[discrete]
[[client.indices.resolveIndex]]
== `client.indices.resolveIndex()`

Resolves the specified name(s) and/or index patterns for indices, aliases, and data streams. Multiple patterns and remote clusters are supported.

{ref}/indices-resolve-index-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesResolveIndexRequest, options?: TransportRequestOptions) => Promise<IndicesResolveIndexResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesResolveIndexRequest extends <<RequestBase>> {
  name: <<Names>>
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  allow_no_indices?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesResolveIndexResponse {
  indices: IndicesResolveIndexResolveIndexItem[]
  aliases: IndicesResolveIndexResolveIndexAliasItem[]
  data_streams: IndicesResolveIndexResolveIndexDataStreamsItem[]
}

----


[discrete]
[[client.indices.rollover]]
== `client.indices.rollover()`

Roll over to a new index. Creates a new index for a data stream or index alias.

{ref}/indices-rollover-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesRolloverRequest, options?: TransportRequestOptions) => Promise<IndicesRolloverResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesRolloverRequest extends <<RequestBase>> {
  alias: <<IndexAlias>>
  new_index?: <<IndexName>>
  dry_run?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  aliases?: Record<<<IndexName>>, <<IndicesAlias>>>
  conditions?: IndicesRolloverRolloverConditions
  mappings?: <<MappingTypeMapping>>
  settings?: Record<string, any>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesRolloverResponse {
  acknowledged: boolean
  conditions: Record<string, boolean>
  dry_run: boolean
  new_index: string
  old_index: string
  rolled_over: boolean
  shards_acknowledged: boolean
}

----


[discrete]
[[client.indices.segments]]
== `client.indices.segments()`

Returns low-level information about the Lucene segments in index shards. For data streams, the API returns information about the stream’s backing indices.

{ref}/indices-segments.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesSegmentsRequest, options?: TransportRequestOptions) => Promise<IndicesSegmentsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesSegmentsRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  verbose?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesSegmentsResponse {
  indices: Record<string, IndicesSegmentsIndexSegment>
  _shards: <<ShardStatistics>>
}

----


[discrete]
[[client.indices.shardStores]]
== `client.indices.shardStores()`

Retrieves store information about replica shards in one or more indices. For data streams, the API retrieves store information for the stream’s backing indices.

{ref}/indices-shards-stores.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesShardStoresRequest, options?: TransportRequestOptions) => Promise<IndicesShardStoresResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesShardStoresRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  status?: IndicesShardStoresShardStoreStatus | IndicesShardStoresShardStoreStatus[]
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesShardStoresResponse {
  indices: Record<<<IndexName>>, IndicesShardStoresIndicesShardStores>
}

----


[discrete]
[[client.indices.shrink]]
== `client.indices.shrink()`

Shrinks an existing index into a new index with fewer primary shards.

{ref}/indices-shrink-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesShrinkRequest, options?: TransportRequestOptions) => Promise<IndicesShrinkResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesShrinkRequest extends <<RequestBase>> {
  index: <<IndexName>>
  target: <<IndexName>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  aliases?: Record<<<IndexName>>, <<IndicesAlias>>>
  settings?: Record<string, any>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesShrinkResponse {
  acknowledged: boolean
  shards_acknowledged: boolean
  index: <<IndexName>>
}

----


[discrete]
[[client.indices.simulateIndexTemplate]]
== `client.indices.simulateIndexTemplate()`

Simulate an index. Returns the index configuration that would be applied to the specified index from an existing index template.

{ref}/indices-simulate-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesSimulateIndexTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesSimulateIndexTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesSimulateIndexTemplateRequest extends <<RequestBase>> {
  name: <<Name>>
  master_timeout?: <<Duration>>
  include_defaults?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesSimulateIndexTemplateResponse {
  overlapping?: IndicesSimulateTemplateOverlapping[]
  template: IndicesSimulateTemplateTemplate
}

----


[discrete]
[[client.indices.simulateTemplate]]
== `client.indices.simulateTemplate()`

Simulate an index template. Returns the index configuration that would be applied by a particular index template.

{ref}/indices-simulate-template.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesSimulateTemplateRequest, options?: TransportRequestOptions) => Promise<IndicesSimulateTemplateResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesSimulateTemplateRequest extends <<RequestBase>> {
  name?: <<Name>>
  create?: boolean
  master_timeout?: <<Duration>>
  include_defaults?: boolean
  allow_auto_create?: boolean
  index_patterns?: <<Indices>>
  composed_of?: <<Name>>[]
  template?: IndicesPutIndexTemplateIndexTemplateMapping
  data_stream?: <<IndicesDataStreamVisibility>>
  priority?: <<long>>
  version?: <<VersionNumber>>
  _meta?: <<Metadata>>
  ignore_missing_component_templates?: string[]
  deprecated?: boolean
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesSimulateTemplateResponse {
  overlapping?: IndicesSimulateTemplateOverlapping[]
  template: IndicesSimulateTemplateTemplate
}

----


[discrete]
[[client.indices.split]]
== `client.indices.split()`

Splits an existing index into a new index with more primary shards.

{ref}/indices-split-index.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesSplitRequest, options?: TransportRequestOptions) => Promise<IndicesSplitResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesSplitRequest extends <<RequestBase>> {
  index: <<IndexName>>
  target: <<IndexName>>
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: <<WaitForActiveShards>>
  aliases?: Record<<<IndexName>>, <<IndicesAlias>>>
  settings?: Record<string, any>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesSplitResponse {
  acknowledged: boolean
  shards_acknowledged: boolean
  index: <<IndexName>>
}

----


[discrete]
[[client.indices.stats]]
== `client.indices.stats()`

Returns statistics for one or more indices. For data streams, the API retrieves statistics for the stream’s backing indices.

{ref}/indices-stats.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesStatsRequest, options?: TransportRequestOptions) => Promise<IndicesStatsResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesStatsRequest extends <<RequestBase>> {
  metric?: <<Metrics>>
  index?: <<Indices>>
  completion_fields?: <<Fields>>
  expand_wildcards?: <<ExpandWildcards>>
  fielddata_fields?: <<Fields>>
  fields?: <<Fields>>
  forbid_closed_indices?: boolean
  groups?: string | string[]
  include_segment_file_sizes?: boolean
  include_unloaded_segments?: boolean
  level?: <<Level>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesStatsResponse {
  indices?: Record<string, IndicesStatsIndicesStats>
  _shards: <<ShardStatistics>>
  _all: IndicesStatsIndicesStats
}

----


[discrete]
[[client.indices.unfreeze]]
== `client.indices.unfreeze()`

Unfreezes an index.

{ref}/unfreeze-index-api.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesUnfreezeRequest, options?: TransportRequestOptions) => Promise<IndicesUnfreezeResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesUnfreezeRequest extends <<RequestBase>> {
  index: <<IndexName>>
  allow_no_indices?: boolean
  expand_wildcards?: <<ExpandWildcards>>
  ignore_unavailable?: boolean
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  wait_for_active_shards?: string
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesUnfreezeResponse {
  acknowledged: boolean
  shards_acknowledged: boolean
}

----


[discrete]
[[client.indices.updateAliases]]
== `client.indices.updateAliases()`

Create or update an alias. Adds a data stream or index to an alias.

{ref}/indices-aliases.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesUpdateAliasesRequest, options?: TransportRequestOptions) => Promise<IndicesUpdateAliasesResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesUpdateAliasesRequest extends <<RequestBase>> {
  master_timeout?: <<Duration>>
  timeout?: <<Duration>>
  actions?: IndicesUpdateAliasesAction[]
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
type IndicesUpdateAliasesResponse = <<AcknowledgedResponseBase>>

----


[discrete]
[[client.indices.validateQuery]]
== `client.indices.validateQuery()`

Validate a query. Validates a query without running it.

{ref}/search-validate.html[{es} documentation]
[discrete]
=== Function signature

[source,ts]
----
(request: IndicesValidateQueryRequest, options?: TransportRequestOptions) => Promise<IndicesValidateQueryResponse>
----

[discrete]
=== Request

[source,ts,subs=+macros]
----
interface IndicesValidateQueryRequest extends <<RequestBase>> {
  index?: <<Indices>>
  allow_no_indices?: boolean
  all_shards?: boolean
  analyzer?: string
  analyze_wildcard?: boolean
  default_operator?: <<QueryDslOperator>>
  df?: string
  expand_wildcards?: <<ExpandWildcards>>
  explain?: boolean
  ignore_unavailable?: boolean
  lenient?: boolean
  rewrite?: boolean
  q?: string
  query?: <<QueryDslQueryContainer>>
}

----


[discrete]
=== Response

[source,ts,subs=+macros]
----
interface IndicesValidateQueryResponse {
  explanations?: IndicesValidateQueryIndicesValidationExplanation[]
  _shards?: <<ShardStatistics>>
  valid: boolean
  error?: string
}

----


