---
type: api
title: Get aliases
description: **All methods and paths for this operation:**
url: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-cat-aliases
resource: https://www.elastic.co/elastic/docs-builder/docs/4493/api/doc/elasticsearch-serverless/operation/operation-cat-aliases
products:
  - Elasticsearch Serverless
---

# Get aliases


## Paths

- `GET` `/_cat/aliases/{name}`
- `GET` `/_cat/aliases`

#### Path parameters

- `name` (union string | string[]) — optional, leave it out to use `/_cat/aliases`
  A comma-separated list of aliases to retrieve. Supports wildcards (`*`).  To retrieve all aliases, omit this parameter or use `*` or `_all`.

## Description

Get the cluster's index aliases, including filter and routing information.
This API does not return data stream aliases.

IMPORTANT: CAT APIs are only intended for human consumption using the command line or the Kibana console. They are not intended for use by applications. For application consumption, use the aliases API.

## Required authorization

- Index privileges: `view_index_metadata`

## Authentication

- Api key: `Authorization: <value>`
  Elasticsearch APIs use key-based authentication.
  You must create an API key and use the encoded value in the request header.
  For example:
  
  
  ```
  curl -X GET "${ES_URL}/_cat/indices?v=true" \
    -H "Authorization: ApiKey ${API_KEY}"
  ```
  
  For more information about where to find API keys for the Elasticsearch endpoint (${ES_URL}) for a project, go to [Get started with Elasticsearch Serverless](https://www.elastic.co/docs/solutions/search/serverless-elasticsearch-get-started).

## Query string parameters

- `h` (union oneOf) — optional
  A comma-separated list of columns names to display. It supports simple wildcards.

Supported values include:
  - `alias` (or `a`): The name of the alias.
  - `index` (or `i`, `idx`): The name of the index the alias points to.
  - `filter` (or `f`, `fi`): The filter applied to the alias.
  - `routing.index` (or `ri`, `routingIndex`): Index routing value for the alias.
  - `routing.search` (or `rs`, `routingSearch`): Search routing value for the alias.
  - `is_write_index` (or `w`, `isWriteIndex`): Indicates if the index is the write index for the alias.
  Values: `alias`, `a`, `index`, `i`, `idx`, `filter`, `f`, `fi`, `routing.index`, `ri`, `routingIndex`, `routing.search`, `rs`, `routingSearch`, `is_write_index`, `w`, `isWriteIndex`
- `s` (union oneOf) — optional
  List of columns that determine how the table should be sorted.
Sorting defaults to ascending and can be changed by setting `:asc`
or `:desc` as a suffix to the column name.
  One of: `string[]` or `string`
- `expand_wildcards` (string · default: all) — optional
  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`.

Supported values include:
  - `all`: Match any data stream or index, including hidden ones.
  - `open`: Match open, non-hidden indices. Also matches any non-hidden data stream.
  - `closed`: Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
  - `hidden`: Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
  - `none`: Wildcard expressions are not accepted.
  Values: `all`, `open`, `closed`, `hidden`, `none`
- `master_timeout` (string · default: 30s) — optional
  The period to wait for a connection to the master node.
If the master node is not available before the timeout expires, the request fails and returns an error.
To indicated that the request should never timeout, you can set it to `-1`.
- `format` (string · default: text) — optional
  Specifies the format to return the columnar data in, can be set to
`text`, `json`, `cbor`, `yaml`, or `smile`.
- `help` (boolean · default: false) — optional
  When set to `true` will output available columns. This option
can't be combined with any other query string option.
- `v` (boolean · default: false) — optional
  When set to `true` will enable verbose output.
- `bytes` (enum) — optional
  Sets the units for columns that contain a byte-size value.
Note that byte-size value units work in terms of powers of 1024. For instance `1kb` means 1024 bytes, not 1000 bytes.
If omitted, byte-size values are rendered with a suffix such as `kb`, `mb`, or `gb`, chosen such that the numeric value of the column is as small as possible whilst still being at least `1.0`.
If given, byte-size values are rendered as an integer with no suffix, representing the value of the column in the chosen unit.
Values that are not an exact multiple of the chosen unit are rounded down.
  Values: `b`, `kb`, `mb`, `gb`, `tb`, `pb`
- `time` (enum) — optional
  Sets the units for columns that contain a time duration.
If omitted, time duration values are rendered with a suffix such as `ms`, `s`, `m` or `h`, chosen such that the numeric value of the column is as small as possible whilst still being at least `1.0`.
If given, time duration values are rendered as an integer with no suffix.
Values that are not an exact multiple of the chosen unit are rounded down.
  Values: `nanos`, `micros`, `ms`, `s`, `m`, `h`, `d`

## Response

`application/json`

Type: `object[]`

An array; each item has these fields:

- `alias` (string)
  alias name
- `index` (string)
  index alias points to
- `filter` (string)
  filter
- `routing.index` (string)
  index routing
- `routing.search` (string)
  search routing
- `is_write_index` (string)
  write index
## Code examples

#### Console

```console
GET _cat/aliases?format=json&v=true
```

#### JavaScript

```javascript
const response = await client.cat.aliases({
  format: "json",
  v: "true",
});
```

#### Python

```python
resp = client.cat.aliases(
    format="json",
    v=True,
)
```

#### curl

```curl
curl -X GET "$ELASTICSEARCH_URL/_cat/aliases?format=json&v=true" \
  -H "Authorization: ApiKey $ELASTIC_API_KEY"
```

#### Java

```java
client.cat().aliases(a -> a);
```

#### PHP

```php
$resp = $client->cat()->aliases([
    "format" => "json",
    "v" => "true",
]);
```

#### Ruby

```ruby
response = client.cat.aliases(
  format: "json",
  v: "true"
)
```

## Response examples

#### Cat aliases response example1

A successful response from `GET _cat/aliases?format=json&v=true`. This response shows that `alias2` has configured a filter and `alias3` and `alias4` have routing configurations.

```json
[
  {
    "alias": "alias1",
    "index": "test1",
    "filter": "-",
    "routing.index": "-",
    "routing.search": "-",
    "is_write_index": "true"
  },
  {
    "alias": "alias1",
    "index": "test1",
    "filter": "*",
    "routing.index": "-",
    "routing.search": "-",
    "is_write_index": "true"
  },
  {
    "alias": "alias3",
    "index": "test1",
    "filter": "-",
    "routing.index": "1",
    "routing.search": "1",
    "is_write_index": "true"
  },
  {
    "alias": "alias4",
    "index": "test1",
    "filter": "-",
    "routing.index": "2",
    "routing.search": "1,2",
    "is_write_index": "true"
  }
]
```

