# SEARCH.LISTINDEXES

> List search indexes in the database.

Use `SEARCH.LISTINDEXES` to list search indexes in the database.

`MATCH` filters index names with a glob-style pattern, while `LIMIT` and `OFFSET` page through the reply, which keeps the command usable on a database with many indexes. Only index names are returned; use [`SEARCH.DESCRIBE`](/redis/commands/search/search-describe) to see an index's schema and settings.

See [Listing Indexes](/redis/search/index-management#listing-indexes) for the feature guide.

## Syntax

```redis
SEARCH.LISTINDEXES [MATCH <pattern>] [LIMIT <count>] [OFFSET <offset>]
```

## Arguments

| Argument | Description | Default |
| --- | --- | --- |
| `MATCH` | Filter index names by a glob-style pattern, such as `product*`. | All indexes |
| `LIMIT` | Maximum number of indexes to return. `0` returns all indexes. | `0` (all indexes) |
| `OFFSET` | Number of indexes to skip for pagination. | `0` |

## Response

Returns one entry per index, sorted by index name. Each entry is a map containing the index `name` and its backing `type` (`HASH`, `JSON`, `STRING`, or `STREAM`). With RESP2, each map is encoded as an array of alternating keys and values.

```text
[
  ["name", "productIdx", "type", "HASH"],
  ["name", "profileIdx", "type", "JSON"],
  ["name", "sessionIdx", "type", "STRING"],
  ["name", "eventIdx", "type", "STREAM"]
]
```

## Examples

<Note>
  The high-level Search APIs do not currently expose `SEARCH.LISTINDEXES`. Use each client's generic command method for this command.
</Note>

<AccordionGroup>

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

```bash
SEARCH.LISTINDEXES MATCH 'product*' LIMIT 10 OFFSET 0
```

</Accordion>

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

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

const redis = Redis.fromEnv();
const indexes = await redis.exec<string[][]>([
  "SEARCH.LISTINDEXES",
  "MATCH",
  "product*",
  "LIMIT",
  10,
  "OFFSET",
  0,
]);
```

</Accordion>

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

```python
from upstash_redis import Redis

redis = Redis.from_env()
indexes = redis.execute([
    "SEARCH.LISTINDEXES",
    "MATCH",
    "product*",
    "LIMIT",
    10,
    "OFFSET",
    0,
])
```

</Accordion>

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

```ts
import IORedis from "ioredis";

const redis = new IORedis(process.env.REDIS_URL!);
const indexes = await redis.call(
  "SEARCH.LISTINDEXES",
  "MATCH",
  "product*",
  "LIMIT",
  10,
  "OFFSET",
  0,
);
```

</Accordion>

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

```ts
import { createClient } from "redis";

const client = await createClient({ url: process.env.REDIS_URL })
  .on("error", console.error)
  .connect();
const indexes = await client.sendCommand([
  "SEARCH.LISTINDEXES",
  "MATCH",
  "product*",
  "LIMIT",
  "10",
  "OFFSET",
  "0",
]);
```

</Accordion>

<Accordion title="redis-py" icon="python" iconType="brands">

```python
import os
import redis

client = redis.from_url(os.environ["REDIS_URL"])
result = client.execute_command(
    "SEARCH.LISTINDEXES",
    "MATCH",
    "product*",
    "LIMIT",
    "10",
    "OFFSET",
    "0",
)
print(result)
```

</Accordion>

<Accordion title="go-redis" icon="golang" iconType="brands">

```go
package main

import (
    "context"
    "fmt"
    "os"

    "github.com/redis/go-redis/v9"
)

func main() {
    opts, err := redis.ParseURL(os.Getenv("REDIS_URL"))
    if err != nil {
        panic(err)
    }
    client := redis.NewClient(opts)
    result, err := client.Do(
        context.Background(),
        "SEARCH.LISTINDEXES",
        "MATCH",
        "product*",
        "LIMIT",
        "10",
        "OFFSET",
        "0",
    ).Result()
    if err != nil {
        panic(err)
    }
    fmt.Println(result)
}
```

</Accordion>

<Accordion title="jedis" icon="java" iconType="brands">

```java
import java.net.URI;

import redis.clients.jedis.Jedis;

try (Jedis jedis = new Jedis(new URI(System.getenv("REDIS_URL")))) {
  Object result = jedis.sendCommand(
      () -> "SEARCH.LISTINDEXES".getBytes(),
      "MATCH",
      "product*",
      "LIMIT",
      "10",
      "OFFSET",
      "0"
  );
  System.out.println(result);
}
```

</Accordion>

<Accordion title="redis-rs" icon="rust" iconType="brands">

```rust
fn main() -> redis::RedisResult<()> {
    let url = std::env::var("REDIS_URL").expect("REDIS_URL is not set");
    let client = redis::Client::open(url)?;
    let mut connection = client.get_connection()?;

    let mut command = redis::cmd("SEARCH.LISTINDEXES");
    command.arg("MATCH");
    command.arg("product*");
    command.arg("LIMIT");
    command.arg("10");
    command.arg("OFFSET");
    command.arg("0");
    let result: redis::Value = command.query(&mut connection)?;
    println!("{result:?}");
    Ok(())
}
```

</Accordion>

<Accordion title="curl">

```bash
curl -X POST https://YOUR_ENDPOINT.upstash.io \
  -H "Authorization: Bearer $UPSTASH_REDIS_REST_TOKEN" \
  -d '["SEARCH.LISTINDEXES", "MATCH", "product*", "LIMIT", "10", "OFFSET", "0"]'
```

</Accordion>

</AccordionGroup>
