From e17587773c656ec7479ea500a442081b2f8b2120 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 30 Oct 2026 11:38:26 +0100 Subject: [PATCH 1/6] fix(index): read cluster FT.INFO on RESP3 and initialise fresh async cluster clients The cluster branch of SearchIndex._info() and AsyncSearchIndex._info() sends a raw FT.INFO to one node, so redis-py's search parser never sees the reply. On RESP3, the redis-py 8 default, that reply is a map, and make_dict() raised KeyError: 1. Accept either shape. The async cluster client discovers its nodes on its first command, so on a fresh client get_random_node() raised IndexError and get_default_node() returned None. That broke create(), and delete() then failed with "'NoneType' object has no attribute 'connection_kwargs'". Initialise the client in _get_client(), and in _info() for callers that bypass it. --- redisvl/index/index.py | 14 ++- tests/unit/test_cluster_index_info.py | 143 ++++++++++++++++++++++++++ tests/unit/test_error_handling.py | 1 + tests/unit/test_index_exists.py | 1 + 4 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 tests/unit/test_cluster_index_info.py diff --git a/redisvl/index/index.py b/redisvl/index/index.py index 6a2451fcb..c6f69abb8 100644 --- a/redisvl/index/index.py +++ b/redisvl/index/index.py @@ -2370,7 +2370,8 @@ def _info(name: str, redis_client: SyncRedisClient) -> dict[str, Any]: values = redis_client.execute_command( "FT.INFO", name, target_nodes=node ) - info = make_dict(values) + # A raw reply is a flat list on RESP2 and a map on RESP3. + info = values if isinstance(values, dict) else make_dict(values) else: info = redis_client.ft(name).info() return convert_bytes(info) @@ -2639,17 +2640,26 @@ async def _get_client(self) -> AsyncRedisClient: self._lib_name, ) self._validated_client = True + if isinstance(self._redis_client, AsyncRedisCluster): + # The async cluster client discovers its nodes on first use, so + # get_default_node() and get_random_node() find nothing on a fresh + # client. This is a no-op once the client is initialised. + await self._redis_client.initialize() return self._redis_client @staticmethod async def _info(name: str, redis_client: AsyncRedisClient) -> dict[str, Any]: try: if isinstance(redis_client, AsyncRedisCluster): + # Callers such as from_existing() pass a client that has not + # been through _get_client(), so initialise it here too. + await redis_client.initialize() node = redis_client.get_random_node() values = await redis_client.execute_command( "FT.INFO", name, target_nodes=node ) - info = make_dict(values) + # A raw reply is a flat list on RESP2 and a map on RESP3. + info = values if isinstance(values, dict) else make_dict(values) else: info = await redis_client.ft(name).info() return convert_bytes(info) diff --git a/tests/unit/test_cluster_index_info.py b/tests/unit/test_cluster_index_info.py new file mode 100644 index 000000000..970b6aae3 --- /dev/null +++ b/tests/unit/test_cluster_index_info.py @@ -0,0 +1,143 @@ +""" +Unit tests for the Redis Cluster branch of SearchIndex._info() and +AsyncSearchIndex._info(). + +On a cluster, _info() sends a raw FT.INFO to one node, so redis-py's search +parser never sees the reply and its shape depends on the wire protocol: a flat +list on RESP2, a map on RESP3 (the redis-py 8 default). Both must produce the +same index information. + +The async cluster client also discovers its nodes lazily, on its first command, +so a freshly built client has no node to pick. The live cluster suite covers +both cases but only runs with --run-cluster-tests, which CI never passes. +""" + +from unittest.mock import create_autospec + +import pytest +from redis.asyncio.cluster import ClusterNode as AsyncClusterNode +from redis.asyncio.cluster import RedisCluster as AsyncRedisCluster +from redis.cluster import ClusterNode, RedisCluster + +from redisvl.index import AsyncSearchIndex, SearchIndex +from redisvl.redis.connection import convert_index_info_to_schema +from redisvl.schema import IndexSchema + +INDEX_NAME = "my_index" + +# The same index as FT.INFO returns it on each protocol, trimmed to the +# sections from_existing() reads. +RESP2_REPLY = [ + b"index_name", + INDEX_NAME.encode(), + b"index_definition", + [b"key_type", b"HASH", b"prefixes", [b"doc"]], + b"attributes", + [[b"identifier", b"title", b"attribute", b"title", b"type", b"TEXT"]], + b"num_docs", + b"0", +] +RESP3_REPLY = { + b"index_name": INDEX_NAME.encode(), + b"index_definition": {b"key_type": b"HASH", b"prefixes": [b"doc"]}, + b"attributes": [ + { + b"identifier": b"title", + b"attribute": b"title", + b"type": b"TEXT", + b"flags": [], + } + ], + b"num_docs": 0, +} +REPLIES = pytest.mark.parametrize( + "reply", [RESP2_REPLY, RESP3_REPLY], ids=["resp2", "resp3"] +) + + +def _schema(): + return IndexSchema.from_dict( + { + "index": {"name": INDEX_NAME, "prefix": "doc"}, + "fields": [{"name": "title", "type": "text"}], + } + ) + + +def _sync_cluster(reply): + client = create_autospec(RedisCluster, instance=True) + client.get_random_node.return_value = create_autospec(ClusterNode, instance=True) + client.execute_command.return_value = reply + return client + + +def _fresh_async_cluster(reply=None): + """An async cluster client that, like a real one, knows no nodes until + initialize() has run.""" + client = create_autospec(AsyncRedisCluster, instance=True) + node = create_autospec(AsyncClusterNode, instance=True) + initialized = False + + async def initialize(): + nonlocal initialized + initialized = True + return client + + def get_random_node(): + if not initialized: + raise IndexError("Cannot choose from an empty sequence") + return node + + client.initialize.side_effect = initialize + client.get_random_node.side_effect = get_random_node + client.get_default_node.side_effect = lambda: node if initialized else None + client.execute_command.return_value = reply + return client, node + + +class TestClusterInfoReplyShape: + @REPLIES + def test_sync_info_reads_either_protocol(self, reply): + info = SearchIndex._info(INDEX_NAME, _sync_cluster(reply)) + + assert info["index_name"] == INDEX_NAME + assert convert_index_info_to_schema(info) == convert_index_info_to_schema( + SearchIndex._info(INDEX_NAME, _sync_cluster(RESP2_REPLY)) + ) + + @REPLIES + @pytest.mark.asyncio + async def test_async_info_reads_either_protocol(self, reply): + client, _ = _fresh_async_cluster(reply) + reference, _ = _fresh_async_cluster(RESP2_REPLY) + + info = await AsyncSearchIndex._info(INDEX_NAME, client) + + assert info["index_name"] == INDEX_NAME + assert convert_index_info_to_schema(info) == convert_index_info_to_schema( + await AsyncSearchIndex._info(INDEX_NAME, reference) + ) + + +class TestFreshAsyncClusterClient: + @pytest.mark.asyncio + async def test_info_initialises_before_choosing_a_node(self): + client, node = _fresh_async_cluster(RESP2_REPLY) + + info = await AsyncSearchIndex._info(INDEX_NAME, client) + + assert info["index_name"] == INDEX_NAME + client.execute_command.assert_awaited_once_with( + "FT.INFO", INDEX_NAME, target_nodes=node + ) + + @pytest.mark.asyncio + async def test_delete_targets_a_node_not_none(self): + client, node = _fresh_async_cluster() + index = AsyncSearchIndex(schema=_schema(), redis_client=client) + + await index.delete(drop=False) + + client.execute_command.assert_awaited_once_with( + "FT.DROPINDEX", INDEX_NAME, target_nodes=[node] + ) diff --git a/tests/unit/test_error_handling.py b/tests/unit/test_error_handling.py index 09b768a05..a1dc3da56 100644 --- a/tests/unit/test_error_handling.py +++ b/tests/unit/test_error_handling.py @@ -414,6 +414,7 @@ async def test_async_drop_documents_cluster_validation(self, mock_validate): # Create a mock that properly inherits from RedisCluster for isinstance check mock_cluster_client = Mock() mock_cluster_client.__class__ = AsyncRedisCluster + mock_cluster_client.initialize = AsyncMock() mock_cluster_client.delete = AsyncMock(return_value=2) index = AsyncSearchIndex(schema=schema, redis_client=mock_cluster_client) diff --git a/tests/unit/test_index_exists.py b/tests/unit/test_index_exists.py index b7bf30192..5a5b3105a 100644 --- a/tests/unit/test_index_exists.py +++ b/tests/unit/test_index_exists.py @@ -171,6 +171,7 @@ async def test_async_ft_info_is_routed_to_a_node(self): node = Mock() client = MagicMock() client.__class__ = AsyncRedisCluster # isinstance drives the branch + client.initialize = AsyncMock() client.get_random_node.return_value = node client.execute_command = AsyncMock(return_value=["index_name", INDEX_NAME]) index = AsyncSearchIndex(schema=_schema(), redis_client=client) From d4779044614de51303eecf5fb5ef185062d065cf Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 30 Oct 2026 11:43:24 +0100 Subject: [PATCH 2/6] test(index): drop a cluster info test the parametrised case already covers --- tests/unit/test_cluster_index_info.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/unit/test_cluster_index_info.py b/tests/unit/test_cluster_index_info.py index 970b6aae3..d6d5b3796 100644 --- a/tests/unit/test_cluster_index_info.py +++ b/tests/unit/test_cluster_index_info.py @@ -120,17 +120,6 @@ async def test_async_info_reads_either_protocol(self, reply): class TestFreshAsyncClusterClient: - @pytest.mark.asyncio - async def test_info_initialises_before_choosing_a_node(self): - client, node = _fresh_async_cluster(RESP2_REPLY) - - info = await AsyncSearchIndex._info(INDEX_NAME, client) - - assert info["index_name"] == INDEX_NAME - client.execute_command.assert_awaited_once_with( - "FT.INFO", INDEX_NAME, target_nodes=node - ) - @pytest.mark.asyncio async def test_delete_targets_a_node_not_none(self): client, node = _fresh_async_cluster() From efb00ec76071b4b4d72a84b03af70c85865c289f Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 30 Oct 2026 12:39:46 +0100 Subject: [PATCH 3/6] fix(index): read cluster FT.INFO and FT._LIST from the default node _info() sent FT.INFO to get_random_node(), which picks from every node in the cluster, replicas included. FT.CREATE goes to the default node, a primary, and Redis replicates asynchronously, so a replica can answer "no such index" straight after create(). The nightly cluster job hit this on redis-py 8.1.0, with FT.INFO landing on the replica at port 7005. Ask the default node instead, the node FT.CREATE, FT.DROPINDEX and FT.SEARCH already use. Async listall() had the same random-node read and now does the same; sync listall() already reached the default node through redis-py's keyless routing. --- redisvl/index/index.py | 17 +++++++---- tests/unit/test_cluster_index_info.py | 43 ++++++++++++++++++++++----- tests/unit/test_index_exists.py | 8 ++--- 3 files changed, 51 insertions(+), 17 deletions(-) diff --git a/redisvl/index/index.py b/redisvl/index/index.py index c6f69abb8..993f341d9 100644 --- a/redisvl/index/index.py +++ b/redisvl/index/index.py @@ -2366,7 +2366,9 @@ def _info(name: str, redis_client: SyncRedisClient) -> dict[str, Any]: """Run FT.INFO to fetch information about the index.""" try: if isinstance(redis_client, SyncRedisCluster): - node = redis_client.get_random_node() + # Ask the node FT.CREATE and FT.DROPINDEX go to. A replica + # learns of a new index only once replication catches up. + node = redis_client.get_default_node() values = redis_client.execute_command( "FT.INFO", name, target_nodes=node ) @@ -2642,8 +2644,8 @@ async def _get_client(self) -> AsyncRedisClient: self._validated_client = True if isinstance(self._redis_client, AsyncRedisCluster): # The async cluster client discovers its nodes on first use, so - # get_default_node() and get_random_node() find nothing on a fresh - # client. This is a no-op once the client is initialised. + # get_default_node() returns None on a fresh client. This is a + # no-op once the client is initialised. await self._redis_client.initialize() return self._redis_client @@ -2654,7 +2656,9 @@ async def _info(name: str, redis_client: AsyncRedisClient) -> dict[str, Any]: # Callers such as from_existing() pass a client that has not # been through _get_client(), so initialise it here too. await redis_client.initialize() - node = redis_client.get_random_node() + # Ask the node FT.CREATE and FT.DROPINDEX go to. A replica + # learns of a new index only once replication catches up. + node = redis_client.get_default_node() values = await redis_client.execute_command( "FT.INFO", name, target_nodes=node ) @@ -3705,8 +3709,9 @@ async def listall(self) -> list[str]: """ client = await self._get_client() if isinstance(client, AsyncRedisCluster): - target_nodes = client.get_random_node() - return convert_bytes(await target_nodes.execute_command("FT._LIST")) + # The default node, as in _info(): a replica may lag behind. + node = client.get_default_node() + return convert_bytes(await node.execute_command("FT._LIST")) else: return convert_bytes(await client.execute_command("FT._LIST")) diff --git a/tests/unit/test_cluster_index_info.py b/tests/unit/test_cluster_index_info.py index d6d5b3796..22879c732 100644 --- a/tests/unit/test_cluster_index_info.py +++ b/tests/unit/test_cluster_index_info.py @@ -7,9 +7,14 @@ list on RESP2, a map on RESP3 (the redis-py 8 default). Both must produce the same index information. +_info() must also ask the node that FT.CREATE went to, the default node: a +replica learns of a new index only once replication catches up, so a replica +can answer "no such index" straight after create(). The stand-in clients below +model that with a replica that never has the index. + The async cluster client also discovers its nodes lazily, on its first command, so a freshly built client has no node to pick. The live cluster suite covers -both cases but only runs with --run-cluster-tests, which CI never passes. +these cases but only runs with --run-cluster-tests, which CI never passes. """ from unittest.mock import create_autospec @@ -18,6 +23,7 @@ from redis.asyncio.cluster import ClusterNode as AsyncClusterNode from redis.asyncio.cluster import RedisCluster as AsyncRedisCluster from redis.cluster import ClusterNode, RedisCluster +from redis.exceptions import ResponseError from redisvl.index import AsyncSearchIndex, SearchIndex from redisvl.redis.connection import convert_index_info_to_schema @@ -64,10 +70,23 @@ def _schema(): ) +def _answer_from_primary(primary, reply): + """FT.INFO that only the primary can answer: the replica has not caught up.""" + + def execute_command(*args, target_nodes=None): + if target_nodes not in (primary, [primary]): + raise ResponseError(f"{INDEX_NAME}: no such index") + return reply + + return execute_command + + def _sync_cluster(reply): client = create_autospec(RedisCluster, instance=True) + primary = create_autospec(ClusterNode, instance=True) + client.get_default_node.return_value = primary client.get_random_node.return_value = create_autospec(ClusterNode, instance=True) - client.execute_command.return_value = reply + client.execute_command.side_effect = _answer_from_primary(primary, reply) return client @@ -75,7 +94,8 @@ def _fresh_async_cluster(reply=None): """An async cluster client that, like a real one, knows no nodes until initialize() has run.""" client = create_autospec(AsyncRedisCluster, instance=True) - node = create_autospec(AsyncClusterNode, instance=True) + primary = create_autospec(AsyncClusterNode, instance=True) + replica = create_autospec(AsyncClusterNode, instance=True) initialized = False async def initialize(): @@ -86,13 +106,15 @@ async def initialize(): def get_random_node(): if not initialized: raise IndexError("Cannot choose from an empty sequence") - return node + return replica client.initialize.side_effect = initialize client.get_random_node.side_effect = get_random_node - client.get_default_node.side_effect = lambda: node if initialized else None - client.execute_command.return_value = reply - return client, node + client.get_default_node.side_effect = lambda: primary if initialized else None + client.execute_command.side_effect = _answer_from_primary(primary, reply) + primary.execute_command.return_value = [INDEX_NAME.encode()] + replica.execute_command.return_value = [] + return client, primary class TestClusterInfoReplyShape: @@ -130,3 +152,10 @@ async def test_delete_targets_a_node_not_none(self): client.execute_command.assert_awaited_once_with( "FT.DROPINDEX", INDEX_NAME, target_nodes=[node] ) + + @pytest.mark.asyncio + async def test_listall_sees_a_new_index(self): + client, _ = _fresh_async_cluster() + index = AsyncSearchIndex(schema=_schema(), redis_client=client) + + assert await index.listall() == [INDEX_NAME] diff --git a/tests/unit/test_index_exists.py b/tests/unit/test_index_exists.py index 5a5b3105a..fae2b306f 100644 --- a/tests/unit/test_index_exists.py +++ b/tests/unit/test_index_exists.py @@ -147,8 +147,8 @@ async def test_async_index_name_resolving_elsewhere_returns_false(self): class TestExistsOnCluster: """On a cluster, exists() must go through _info()'s node-targeted path. - Index metadata is cluster-wide, so any single node can answer -- but the - command has to carry target_nodes to get there. These are the only cluster + The command has to carry target_nodes, and it must name the default node, + where FT.CREATE goes: a replica may not have the new index yet. These are the only cluster checks that run by default; the live cluster suite needs --run-cluster-tests. Sync and async _info() each have their own cluster branch, and exists() reaches both for the first time with this change. @@ -157,7 +157,7 @@ class TestExistsOnCluster: def test_ft_info_is_routed_to_a_node(self): node = Mock() client = MagicMock(spec=RedisCluster) - client.get_random_node.return_value = node + client.get_default_node.return_value = node client.execute_command.return_value = ["index_name", INDEX_NAME] index = SearchIndex(schema=_schema(), redis_client=client) @@ -172,7 +172,7 @@ async def test_async_ft_info_is_routed_to_a_node(self): client = MagicMock() client.__class__ = AsyncRedisCluster # isinstance drives the branch client.initialize = AsyncMock() - client.get_random_node.return_value = node + client.get_default_node.return_value = node client.execute_command = AsyncMock(return_value=["index_name", INDEX_NAME]) index = AsyncSearchIndex(schema=_schema(), redis_client=client) From c688b1d0a822181af4a5794d17bc5f8996142345 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Fri, 30 Oct 2026 12:47:46 +0100 Subject: [PATCH 4/6] fix(index): send sync cluster listall() to the default node The previous commit said sync listall() already reached the default node through redis-py's keyless routing. That holds only on redis-py 6.x. On 7.x and 8.x, FT._LIST has no routing entry, so a keyless call on a cluster raises RedisClusterException ("No way to dispatch this command to Redis Cluster. Missing key"). Target the default node explicitly, as the async twin and _info() do. --- redisvl/index/index.py | 7 +++++++ tests/unit/test_cluster_index_info.py | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/redisvl/index/index.py b/redisvl/index/index.py index 993f341d9..9128636c0 100644 --- a/redisvl/index/index.py +++ b/redisvl/index/index.py @@ -2336,6 +2336,13 @@ def listall(self) -> list[str]: Returns: List[str]: The list of indices in the database. """ + if isinstance(self._redis_client, SyncRedisCluster): + # redis-py 7+ cannot route a keyless FT._LIST on a cluster, and a + # replica may lag behind, so ask the default node, as in _info(). + node = self._redis_client.get_default_node() + return convert_bytes( + self._redis_client.execute_command("FT._LIST", target_nodes=node) + ) return convert_bytes(self._redis_client.execute_command("FT._LIST")) def exists(self) -> bool: diff --git a/tests/unit/test_cluster_index_info.py b/tests/unit/test_cluster_index_info.py index 22879c732..c8031e5c3 100644 --- a/tests/unit/test_cluster_index_info.py +++ b/tests/unit/test_cluster_index_info.py @@ -153,9 +153,17 @@ async def test_delete_targets_a_node_not_none(self): "FT.DROPINDEX", INDEX_NAME, target_nodes=[node] ) + +class TestListallOnCluster: @pytest.mark.asyncio async def test_listall_sees_a_new_index(self): client, _ = _fresh_async_cluster() index = AsyncSearchIndex(schema=_schema(), redis_client=client) assert await index.listall() == [INDEX_NAME] + + def test_sync_listall_sees_a_new_index(self): + client = _sync_cluster([INDEX_NAME.encode()]) + index = SearchIndex(schema=_schema(), redis_client=client) + + assert index.listall() == [INDEX_NAME] From d5d2bef1c891edbc27e232367b299d4deeba67a8 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Thu, 12 Nov 2026 13:55:07 +0100 Subject: [PATCH 5/6] docs(concepts): describe index commands after a Redis Cluster failover Index commands go to redis-py's default node, which redis-py re-points only after a keyed command is redirected or a connection fails. Until then, writes fail with ReadOnlyError and reads come from the demoted node. Say so, and how to recover. --- docs/concepts/search-and-indexing.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/concepts/search-and-indexing.md b/docs/concepts/search-and-indexing.md index 5cab8733b..9c20308f7 100644 --- a/docs/concepts/search-and-indexing.md +++ b/docs/concepts/search-and-indexing.md @@ -97,6 +97,15 @@ This is a short indexing delay, not data loss. A later query sees the documents Applications that require strict search read-after-write behavior can start Redis with `--search-workers 0`. This is a Redis server setting, not a RedisVL option: it keeps indexing in the foreground but gives up the throughput benefits of multithreaded background indexing. +## Index Commands After a Cluster Failover + +On Redis Cluster, index commands carry no key, so RedisVL sends them to the client's default node: a primary that redis-py picks when it connects. That covers `create()`, `delete()`, `exists()`, `info()`, `listall()` and queries. redis-py learns that a failover has happened only when a keyed command is redirected with `MOVED`, or when a connection fails. Until then, a client that has sent only index commands since the failover keeps sending them to the demoted node, which is now a replica: + +- `create()` and `delete()` fail with `ReadOnlyError`. +- `exists()`, `info()`, `listall()` and queries are answered by the replica. Replication is asynchronous, so its copy can lag behind the new primary: a new index can be reported missing, or a dropped one still present. + +This lasts until the client sends any keyed command, such as `load()` or `fetch()`, or reconnects. Most applications send keyed commands constantly. A process that only manages indexes can recover from a `ReadOnlyError` by building a new client and retrying. + ## Bulk Delete and Update Redis has no server-side "delete/update by query", so mutating many documents traditionally means scanning for keys and issuing writes yourself. RedisVL wraps that pattern behind two filter-driven methods (available on both `SearchIndex` and `AsyncSearchIndex`). From a5098cbff3cbbe514b97dd0a16d9a8a56afb7ed2 Mon Sep 17 00:00:00 2001 From: Vishal Bala Date: Thu, 19 Nov 2026 12:27:33 +0100 Subject: [PATCH 6/6] docs(concepts): name the exception create() and delete() raise after a failover They wrap redis-py's ReadOnlyError in RedisSearchError, so code that catches ReadOnlyError never runs. Say what to catch. --- docs/concepts/search-and-indexing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/concepts/search-and-indexing.md b/docs/concepts/search-and-indexing.md index 9c20308f7..613d9a5fd 100644 --- a/docs/concepts/search-and-indexing.md +++ b/docs/concepts/search-and-indexing.md @@ -101,10 +101,10 @@ Applications that require strict search read-after-write behavior can start Redi On Redis Cluster, index commands carry no key, so RedisVL sends them to the client's default node: a primary that redis-py picks when it connects. That covers `create()`, `delete()`, `exists()`, `info()`, `listall()` and queries. redis-py learns that a failover has happened only when a keyed command is redirected with `MOVED`, or when a connection fails. Until then, a client that has sent only index commands since the failover keeps sending them to the demoted node, which is now a replica: -- `create()` and `delete()` fail with `ReadOnlyError`. +- `create()` and `delete()` raise `RedisSearchError`, with the redis-py `ReadOnlyError` as its `__cause__`. - `exists()`, `info()`, `listall()` and queries are answered by the replica. Replication is asynchronous, so its copy can lag behind the new primary: a new index can be reported missing, or a dropped one still present. -This lasts until the client sends any keyed command, such as `load()` or `fetch()`, or reconnects. Most applications send keyed commands constantly. A process that only manages indexes can recover from a `ReadOnlyError` by building a new client and retrying. +This lasts until the client sends any keyed command, such as `load()` or `fetch()`, or reconnects. Most applications send keyed commands constantly. A process that only manages indexes can recover: if `create()` or `delete()` raises `RedisSearchError` caused by a `ReadOnlyError`, build a new cluster client and retry the call. ## Bulk Delete and Update