> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SEARCH.WAITINDEXING

> Wait until pending index updates are visible.

Use `SEARCH.WAITINDEXING` to block until all pending index updates are processed and visible to queries.

See [Waiting for Indexing](/docs/redis/search/index-management#waiting-for-indexing) for guidance on when to wait for index updates.

The command accepts an index name or alias and waits for every update queued before the command began. Writes that arrive later may require another call.

## Syntax

```redis theme={"system"}
SEARCH.WAITINDEXING <name>
```

## Important points

> [!WARNING]
>
> Do not call `SEARCH.WAITINDEXING` after every write. Batch updates are necessary for optimal indexing performance. Use this command only when you need to ensure queries reflect recent changes, such as in tests or CI pipelines.

## Response

Returns `1` when indexing is complete or `0` if the index was not found.

## Examples

> **Redis CLI**
>
> ```bash theme={"system"}
> SEARCH.WAITINDEXING products
> ```

> **@upstash/redis**
>
> ```ts theme={"system"}
> import { Redis } from "@upstash/redis";
>
> const redis = Redis.fromEnv();
> const products = redis.search.index({ name: "products" });
> const result = await products.waitIndexing();
> ```

> **upstash\_redis**
>
> ```python theme={"system"}
> from upstash_redis import Redis
>
> redis = Redis.from_env()
> products = redis.search.index(name="products")
> result = products.wait_indexing()
> ```

> **ioredis**
>
> ```ts theme={"system"}
> import IORedis from "ioredis";
> import { createSearch } from "@upstash/search-ioredis";
>
> const redis = new IORedis(process.env.REDIS_URL!);
> const search = createSearch(redis);
> const products = search.index({ name: "products" });
> const result = await products.waitIndexing();
> ```

> **node-redis**
>
> ```ts theme={"system"}
> 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 products = search.index({ name: "products" });
> const result = await products.waitIndexing();
> ```

> **redis-py**
>
> ```python theme={"system"}
> import os
> import redis
>
> client = redis.from_url(os.environ["REDIS_URL"])
> result = client.execute_command("SEARCH.WAITINDEXING", "products")
> print(result)
> ```

> **go-redis**
>
> ```go theme={"system"}
> 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.WAITINDEXING", "products").Result()
>     if err != nil {
>         panic(err)
>     }
>     fmt.Println(result)
> }
> ```

> **jedis**
>
> ```java theme={"system"}
> 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.WAITINDEXING".getBytes(), "products");
>   System.out.println(result);
> }
> ```

> **redis-rs**
>
> ```rust theme={"system"}
> 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.WAITINDEXING");
>     command.arg("products");
>     let result: redis::Value = command.query(&mut connection)?;
>     println!("{result:?}");
>     Ok(())
> }
> ```

> **curl**
>
> ```bash theme={"system"}
> curl -X POST https://YOUR_ENDPOINT.upstash.io \
>   -H "Authorization: Bearer $UPSTASH_REDIS_REST_TOKEN" \
>   -d '["SEARCH.WAITINDEXING", "products"]'
> ```


## Related topics

- [Blog Search](/docs/redis/search/recipes/blog-search.md)
- [E-commerce Search](/docs/redis/search/recipes/e-commerce-search.md)
- [User Directory](/docs/redis/search/recipes/user-directory.md)
- [Document Updates](/docs/redis/search/document-updates.md)
- [Indices](/docs/redis/search/index-management.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.