ERR redis resource_error ai_generated partial

ERR FT.CREATE failed: Out of memory allocating index 'myidx'

ID: redis/redisearch-index-out-of-memory

Also available as: JSON · Markdown · 中文
78%Fix Rate
82%Confidence
1Evidence
2024-05-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.2.0 active
7.4.0 active
8.0.0 active

Root Cause

Redis Search module failed to allocate memory for new index due to maxmemory limit or system OOM.

generic

中文

Redis Search 模块因 maxmemory 限制或系统内存不足,无法为新索引分配内存。

Official Documentation

https://redis.io/docs/stack/search/

Workarounds

  1. 80% success Increase maxmemory: CONFIG SET maxmemory 2gb. Then retry FT.CREATE. Monitor with INFO memory.
    Increase maxmemory: CONFIG SET maxmemory 2gb. Then retry FT.CREATE. Monitor with INFO memory.
  2. 75% success Drop unused indexes to free memory: FT.DROPINDEX oldidx DD (DD deletes documents). Then retry.
    Drop unused indexes to free memory: FT.DROPINDEX oldidx DD (DD deletes documents). Then retry.
  3. 70% success Reduce index memory overhead by using fewer fields or smaller text fields in FT.CREATE (e.g., WITHSUFFIXTRIE off).
    Reduce index memory overhead by using fewer fields or smaller text fields in FT.CREATE (e.g., WITHSUFFIXTRIE off).

中文步骤

  1. 增加 maxmemory:CONFIG SET maxmemory 2gb。然后重试 FT.CREATE。使用 INFO memory 监控。
  2. 删除未使用的索引以释放内存:FT.DROPINDEX oldidx DD(DD 删除文档)。然后重试。
  3. 通过在 FT.CREATE 中使用更少的字段或更小的文本字段来减少索引内存开销(例如,关闭 WITHSUFFIXTRIE)。

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Setting maxmemory-policy to noeviction prevents eviction but also blocks new writes including index creation; it doesn't free memory.

  2. 60% fail

    Deleting the index key with DEL may not free memory immediately if the index is still referenced by internal structures; use FT.DROPINDEX instead.