# SEARCH.REINDEX

> Rebuild a search index from the current matching data.

Use `SEARCH.REINDEX` to rebuild an existing index from the current Redis keys that match its data type and prefixes. It is especially useful after creating an index with `SKIPINITIALSCAN`.

See [Index Management](/redis/search/index-management) for the feature guide to creating and managing indexes.

`SEARCH.REINDEX` accepts an index name or alias. The index definition is preserved while its searchable contents are replaced with a fresh scan.

<Warning>
  Reindexing scans all matching keys and can be expensive for large datasets.
</Warning>

## Syntax

```redis
SEARCH.REINDEX <name>
```

## Response

Returns `1` when the index is rebuilt or `0` if the index does not exist.

## Examples

<AccordionGroup>

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

```bash
SEARCH.REINDEX products
```

</Accordion>

<Accordion title="curl">

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

</Accordion>

</AccordionGroup>
