fix: add replicas to opensearch in cpd#1994
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Build successful! ✅ |
This pull request introduces improved configuration and management of OpenSearch index shard and replica counts, especially for OpenRAG-managed indices. The main changes add new environment variables to control the number of shards and replicas, ensure that existing indices are automatically reconciled to these settings at startup, and refactor related code for clarity and testability. Documentation and tests are updated to reflect and verify the new behavior.
OpenSearch index configuration and management:
OPENRAG_OPENSEARCH_NUMBER_OF_SHARDS,OPENRAG_OPENSEARCH_NUMBER_OF_REPLICAS, andOPENRAG_ENSURE_INDEX_REPLICAS_ON_STARTUP) to control the number of shards and replicas for OpenRAG indices, with appropriate defaults for local and production environments. (.env.example, [1];docker-compose.yml, [2];docs/docs/reference/configuration.mdx, [3]src/config/settings.py, [1] [2];src/utils/embeddings.py, [3];src/utils/opensearch_init.py, [4] [5]Automatic index replica reconciliation:
src/app/lifespan.py, [1];src/config/settings.py, [2];src/utils/opensearch_init.py, [3] [4] [5] [6] [7]Testing and documentation:
tests/unit/test_embedding_fields.py, [1];tests/unit/test_ensure_index_replicas.py, [2]docs/docs/reference/configuration.mdx, docs/docs/reference/configuration.mdxR155-R156)These changes make OpenRAG's OpenSearch index management more flexible, robust, and production-ready.