Skip to main content
LlamaIndex.TS provides storage abstractions for persisting different types of data. Storage systems enable caching, state management, and efficient data retrieval across sessions.

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

  1. Use document hashing
    • Track document changes efficiently
    • Avoid reprocessing unchanged content
    • Enable incremental updates
  2. Organize storage
    • Use consistent directory structure
    • Separate different store types
    • Version your storage format
  3. Handle persistence errors
    • Validate file paths before writing
    • Use atomic writes when possible
    • Backup before major updates
  4. Manage chat history
    • Set retention policies
    • Limit history size for context windows
    • Archive old conversations
  5. 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 BaseDocumentStore or BaseKVStore

Next Steps

Vector Stores

Explore vector storage options

Ingestion

Build data processing pipelines

Chat Engines

Create conversational interfaces

Documents

Work with Document objects