Skip to main content

Overview

Indices organize your data for efficient retrieval. LlamaIndex provides several index types optimized for different use cases.

VectorStoreIndex

Most common index type using vector embeddings for semantic search.

Constructor Options

BaseNode[]
Nodes to index
VectorStore
Vector store backend (defaults to SimpleVectorStore)
StorageContext
Storage configuration
ServiceContext
Service configuration (deprecated, use Settings instead)

Methods

static method
Create index from documents
method
Convert index to query engine
method
Convert index to chat engine
method
Convert index to retriever
method
Insert new document
method
Insert new nodes
method
Delete document by ID

Example: Custom Vector Store

Example: Persistence

SummaryIndex

Index that retrieves all nodes (useful for summarization).

Use Cases

  • Document summarization
  • Full-text queries requiring all context
  • Small document collections

KeywordTableIndex

Index based on keyword extraction.

Keyword Extraction Modes

  • rake: RAKE algorithm for keyword extraction
  • simple: Simple token-based extraction

Use Cases

  • Keyword-based search
  • Exact term matching
  • Complement to vector search

Composable Indices

Combine multiple indices for hybrid search:

Retrieval Modes

Default Retrieval

MMR (Maximal Marginal Relevance)

Diversity-based retrieval:

Metadata Filtering

Filter nodes by metadata during retrieval:

Index Updates

Insert Documents

Delete Documents

Refresh Index

Best Practices

  1. Use VectorStoreIndex for most cases: Best for semantic search
  2. Persist indices: Save to disk to avoid reindexing
  3. Configure chunk size: Adjust via Settings for optimal retrieval
  4. Use external vector stores: Pinecone, Chroma, etc. for production
  5. Filter with metadata: Narrow search scope for better results
  6. Combine index types: Use RouterQueryEngine for hybrid search

See Also