# SEARCH.LISTALIASES

> List search index aliases.

Use `SEARCH.LISTALIASES` to return all aliases and the indexes they point to.

The reply pairs each alias with its target index name, which is how you check what an alias currently resolves to before or after swapping it. Aliases whose target no longer exists are still listed, since an alias may point at a name that has not been created yet.

See [Listing Aliases](/redis/search/aliases#listing-aliases) for the feature guide.

## Syntax

```redis
SEARCH.LISTALIASES
```

## Response

Returns an unordered array of `[alias, index_name]` pairs, or an empty array if no aliases exist. The response can include aliases whose target index no longer exists. To list every index in the database, use [`SEARCH.LISTINDEXES`](/redis/commands/search/search-listindexes).

The SDKs below decode the pairs into an object or dictionary that maps each alias to its index name.

## Examples

<AccordionGroup>

<Accordion title="Redis CLI" icon="terminal">

```bash
SEARCH.LISTALIASES
```

</Accordion>

<Accordion title="@upstash/redis" icon="node-js" iconType="brands">

```ts
import { Redis } from "@upstash/redis";

const redis = Redis.fromEnv();
const aliases = await redis.search.alias.list();
// { products: "products-v2" }
```

</Accordion>

<Accordion title="upstash_redis" icon="python" iconType="brands">

```python
from upstash_redis import Redis

redis = Redis.from_env()
aliases = redis.search.alias.list()
# {"products": "products-v2"}
```

</Accordion>

<Accordion title="ioredis" icon="node-js" iconType="brands">

```ts
import IORedis from "ioredis";
import { createSearch } from "@upstash/search-ioredis";

const redis = new IORedis(process.env.REDIS_URL!);
const search = createSearch(redis);
const aliases = await search.alias.list();
// { products: "products-v2" }
```

</Accordion>

<Accordion title="node-redis" icon="node-js" iconType="brands">

```ts
import { createClient } from "redis";
import { createSearch } from "@upstash/search-redis";

const client = await createClient({ url: process.env.REDIS_URL })
  .on("error", console.error)
  .connect();
const search = createSearch(client);
const aliases = await search.alias.list();
// { products: "products-v2" }
```

</Accordion>

<Accordion title="curl">

```bash
curl -X POST https://YOUR_ENDPOINT.upstash.io \
  -H "Authorization: Bearer $UPSTASH_REDIS_REST_TOKEN" \
  -d '["SEARCH.LISTALIASES"]'
```

</Accordion>

</AccordionGroup>
