Index Types: Vector, List, Tree, and Keyword
What you'll learn: How different index structures in LlamaIndex optimize for different retrieval patterns and query types.
The Core Idea
LlamaIndex offers multiple index types because not all retrieval problems are the same. Think of indexes like different filing systems: a library catalog (keyword), a GPS navigation system (vector), a file cabinet (list), or a decision tree flowchart (tree) — each excels at different tasks.
The Four Main Index Types
Vector Index
Uses embeddings to find semantically similar content. Best for meaning-based searches where you want documents that match the concept of your query, not just keywords. This is the most common choice for RAG applications.
List Index
Simply stores all documents in a linear list and checks each one sequentially. Best for small datasets or when you need to examine every document (exhaustive search). Slower but guaranteed to consider everything.
Tree Index
Organizes documents hierarchically with summaries at each level. Best for summarization tasks and when you want to navigate from general to specific information progressively.
Keyword Index
Uses keyword extraction to map terms to documents. Best for exact-match searches and when you know specific terms or phrases you're looking for.
Choosing the Right Index
- Semantic similarity? → Vector Index
- Small dataset or thorough search? → List Index
- Summarization or hierarchical navigation? → Tree Index
- Known keywords or exact terms? → Keyword Index
You can even combine multiple indexes for hybrid retrieval strategies.
Key Takeaway: Different index types optimize for different retrieval patterns — vector for semantic search, list for exhaustive checking, tree for hierarchical summarization, and keyword for exact-match queries.