Storage Types
LlamaIndex uses specialized stores for different data types:- Document Stores: Store and manage source documents and nodes
- Index Stores: Persist index structures and metadata
- Vector Stores: Store embeddings for semantic search
- Chat Stores: Manage conversation history
- KV Stores: General key-value storage
Document Stores
Document stores manage your source documents and nodes with deduplication and versioning.SimpleDocumentStore
Persistence
Document Hashing
Track document changes with hashes:Reference Document Info
Index Stores
Index stores persist index structures for quick loading.SimpleIndexStore
Persistence
Vector Stores
Vector stores persist embeddings for semantic search. See Vector Stores for detailed documentation.Chat Stores
Chat stores manage conversation history for chat engines.SimpleChatStore
Persistence
With Chat Engine
KV Stores
Key-value stores provide general-purpose persistence.SimpleKVStore
Persistence
Collections
Organize data with collections:Storage Context
Combine multiple stores for complete state management:Complete Example
Best Practices
-
Use document hashing
- Track document changes efficiently
- Avoid reprocessing unchanged content
- Enable incremental updates
-
Organize storage
- Use consistent directory structure
- Separate different store types
- Version your storage format
-
Handle persistence errors
- Validate file paths before writing
- Use atomic writes when possible
- Backup before major updates
-
Manage chat history
- Set retention policies
- Limit history size for context windows
- Archive old conversations
-
Choose appropriate stores
- SimpleKVStore for development
- Database-backed stores for production
- Vector stores for semantic search
- Chat stores for conversations
Advanced Storage
For production applications, consider:- Database-backed stores: PostgreSQL, MongoDB, Redis
- Cloud vector stores: Pinecone, Weaviate, Qdrant
- Distributed storage: For large-scale applications
- Custom stores: Implement
BaseDocumentStoreorBaseKVStore
Next Steps
Vector Stores
Explore vector storage options
Ingestion
Build data processing pipelines
Chat Engines
Create conversational interfaces
Documents
Work with Document objects