<commit_before>[[indices-resolve-index-api]]
=== Resolve index API
++++
<titleabbrev>Resolve index</titleabbrev>
++++

Resolves the specified name(s) and/or wildcard expression(s) to indices, index
aliases, and data streams. Multiple expressions and remote clusters are
supported.


[source,console]
----
GET /_resolve/index/twitter*
----

[[resolve-index-api-request]]
==== {api-request-title}

`GET /_resolve/index/<name>`


[[resolve-index-api-path-params]]
==== {api-path-parms-title}

`<name>`::
+
--
(Required, string) Comma-separated name(s) or wildcard expression(s) of the
indices, index aliases, and data streams to resolve. Resources on
<<modules-remote-clusters,remote clusters>> can be specified using the
`<cluster>:<name>` syntax.
--

[[resolve-index-api-query-params]]
==== {api-query-parms-title}

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
+
Defaults to `open`.

[[resolve-index-api-example]]
==== {api-examples-title}

[[resolve-index-basic-example]]
===== Basic example

[source,console]
--------------------------------------------------
GET /_resolve/index/f*,remoteCluster1:bar*
--------------------------------------------------
// TEST[skip_shard_failures]

The API returns the following response:

[source,console-result]
--------------------------------------------------
{
  "indices" : [ <1>
    {
      "name" : "foo_closed",
      "attributes" : [
        "closed"
      ]
    },
    {
      "name" : "remoteCluster1:bar-01",
      "attributes" : [
        "open"
      ]
    },
    {
      "name" : "freeze-index",
      "aliases" : [
        "f-alias"
      ],
      "attributes" : [
        "open",
        "frozen"
      ]
    }
  ],
  "aliases" : [ <2>
    {
      "name" : "f-alias",
      "indices" : [
        "freeze-index",
        "my-index"
      ]
    }
  ],
  "data_streams" : [ <3>
    {
      "name" : "foo",
      "backing_indices" : [
        ".ds-foo-000001"
      ],
      "timestamp_field" : "@timestamp"
    }
  ]
}
--------------------------------------------------
// TESTRESPONSE[skip:unable to assert responses with top level array]

<1> All indices matching the supplied names or expressions
<2> All aliases matching the supplied names or expressions
<3> All data streams matching the supplied names or expressions
<commit_msg>[DOCS] Fix snippet tests for resolve API docs (#58908)<commit_after>[[indices-resolve-index-api]]
=== Resolve index API
++++
<titleabbrev>Resolve index</titleabbrev>
++++

Resolves the specified name(s) and/or wildcard expression(s) to indices, index
aliases, and data streams. Multiple expressions and remote clusters are
supported.

////
[source,console]
----
PUT /foo_closed

POST /foo_closed/_close

PUT /remotecluster-bar-01

PUT /freeze-index

POST /freeze-index/_freeze

PUT /my-index

PUT /freeze-index/_alias/f-alias

PUT /my-index/_alias/f-alias

PUT /_index_template/foo_data_stream
{
  "index_patterns": [ "foo" ],
  "data_stream": {
    "timestamp_field": "@timestamp"
  },
  "template": {
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        }
      }
    }
  }
}

PUT /_data_stream/foo
----
// TESTSETUP

[source,console]
----
DELETE /_data_stream/*

DELETE /_index_template/foo_data_stream
----
// TEARDOWN
////

[source,console]
----
GET /_resolve/index/twitter*
----

[[resolve-index-api-request]]
==== {api-request-title}

`GET /_resolve/index/<name>`


[[resolve-index-api-path-params]]
==== {api-path-parms-title}

`<name>`::
+
--
(Required, string) Comma-separated name(s) or wildcard expression(s) of the
indices, index aliases, and data streams to resolve. Resources on
<<modules-remote-clusters,remote clusters>> can be specified using the
`<cluster>:<name>` syntax.
--

[[resolve-index-api-query-params]]
==== {api-query-parms-title}

include::{es-repo-dir}/rest-api/common-parms.asciidoc[tag=expand-wildcards]
+
Defaults to `open`.

[[resolve-index-api-example]]
==== {api-examples-title}

[source,console]
----
GET /_resolve/index/f*,remoteCluster1:bar*?expand_wildcards=all
----
// TEST[continued]
// TEST[s/remoteCluster1:/remotecluster-/]

The API returns the following response:

[source,console-result]
----
{
  "indices": [                                 <1>
    {
      "name": "foo_closed",
      "attributes": [
        "closed"
      ]
    },
    {
      "name": "freeze-index",
      "aliases": [
        "f-alias"
      ],
      "attributes": [
        "frozen",
        "open"
      ]
    },
    {
      "name": "remoteCluster1:bar-01",
      "attributes": [
        "open"
      ]
    }
  ],
  "aliases": [                                 <2>
    {
      "name": "f-alias",
      "indices": [
        "freeze-index",
        "my-index"
      ]
    }
  ],
  "data_streams": [                            <3>
    {
      "name": "foo",
      "backing_indices": [
        ".ds-foo-000001"
      ],
      "timestamp_field": "@timestamp"
    }
  ]
}
----
// TESTRESPONSE[s/remoteCluster1:/remotecluster-/]
<1> All indices matching the supplied names or expressions
<2> All aliases matching the supplied names or expressions
<3> All data streams matching the supplied names or expressions

{'fraction_non_alphanumeric': 0.20088683246577985, 'fraction_numerical': 0.007904376325428958, 'mean_word_length': 2.2960609911054637, 'pattern_counts': {'":': 23, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3939337', 'n_tokens_mistral': 1733, 'n_tokens_neox': 1688, 'n_words': 348}