01. Documents and Nodes: the only data model
A document and the nodes it is split into are the two core building blocks of the whole framework. A document is not a subclass of a text node. That is a common mistake from older guides. Ingestion does not turn documents into nodes. Instead, nodes get split into smaller nodes. They keep relationships to their parent nodes.
Each node carries five key pieces of information. First is the text itself. This is what gets embedded and what the language model reads. Second is a stable identifier. Stability matters because if you regenerate random ids each time, syncing becomes a duplicate mess. Third is metadata. This is a simple dictionary. It is the most underused field in the framework. Metadata makes filtering possible. Filtering is what makes similarity search work in a multi-tenant corpus. Fourth are relationships. These link to source, previous, next, parent, and child nodes. They let a postprocessor retrieve a sentence and then hand the language model the paragraph around it. Fifth are the excluded metadata keys. This pair is an escape hatch that nobody reads about until it causes trouble.
Here is the trade-off. By default, a node's metadata is prepended to its text when going into both the embedding model and the language model prompt. That is usually what you want. A chunk with metadata like title Q3 Pricing Policy embeds as a chunk about Q3 pricing. That gives a semantic lift.
But here is the self-inflicted bug. If you stash a file path, an ingestion timestamp, or a long JSON blob on the node, that text also gets embedded. It dilutes the vector with meaningless text. When someone reports that retrieval got worse after adding metadata, this is nearly always why.
The fix is not to drop the metadata. You should exclude it from the embedding while keeping it available for filtering. That is the classic fix.
So remember: the document and node are the foundation. Metadata rides along with each node. And if you let metadata leak into the embedded text, you cause a retrieval bug yourself. Always set excluded metadata keys to keep your embeddings clean. That is a small change that saves a lot of trouble later.