Documents and Nodes: LlamaIndex Data Model
You'll learn the fundamental data structures LlamaIndex uses to organize and process your data.
When working with LlamaIndex, you need to understand how it represents information internally. Think of it like organizing a library: you start with entire books (Documents), then break them into catalog-able sections (Nodes) that the system can actually search and retrieve.
What is a Document?
A Document is the raw, unprocessed unit of data you feed into LlamaIndex. It represents a complete source file or content chunk—like an entire PDF, a web page, or a text file. The Document holds:
- The full text content
- Metadata (author, date, source URL, etc.)
- A unique identifier
Documents are your starting point, but they're often too large to efficiently search or embed directly.
What is a Node?
A Node is a chunked, indexed piece of a Document. LlamaIndex automatically splits Documents into smaller Nodes during ingestion. Each Node:
- Contains a portion of the original text (sized for embedding models)
- Maintains a reference back to its parent Document
- Can have relationships to other Nodes (previous/next chunks)
- Gets embedded and stored in your vector index
Think of Nodes as index cards in a card catalog—each one represents a searchable segment of your larger document collection.
Why This Matters
This two-tier structure lets LlamaIndex balance retrieval precision (finding specific relevant chunks via Nodes) with context preservation (knowing which Document a Node came from). When you retrieve relevant Nodes during a query, you can trace them back to their source Documents for citations or additional context.
Key Takeaway: Documents represent raw source data, while Nodes are the chunked, indexed units that enable efficient semantic search and retrieval in LlamaIndex.