Knowledge Retrieval and Genie Configuration · Topic 2 of 4
RAG Pipelines, Chunking and AI Search Configuration
Databricks Context Engineer: build a governed RAG pipeline, choose a chunking strategy and fix the AI Search setting behind poor retrieval quality.
- 6 min
- Includes a diagram
- Pipeline order: UC volume, parse and chunk, Delta table with metadata, DELTA_SYNC index, retrieved chunks with sources in context.
- DELTA_SYNC indexes on standard endpoints need Change Data Feed on the source table; TRIGGERED needs a sync call, CONTINUOUS syncs within seconds at higher cost.
- DIRECT_ACCESS indexes change only through API upserts.
What it is
A RAG pipeline turns a document corpus into chunks the agent can retrieve and place in its context. On Databricks the documents sit under Unity Catalog governance, the chunks live in a Delta table, and a Databricks AI Search index (the docs may still say Vector Search) serves similarity queries.
Most retrieval quality problems come from three places: how the documents were chunked, how the index is configured and synced, and how the query is sent. The exam describes a symptom and asks which of these to change.
How it works
The governed pipeline
- Store source files in a Unity Catalog volume, so access is granted and audited in one place.
- Parse and chunk them into a Delta table with a primary key, the chunk text and metadata columns such as source path, section, document type and effective date.
- Create a DELTA_SYNC index on that table. On standard endpoints the source table needs Change Data Feed enabled. Either let AI Search compute embeddings from a text column with a model serving endpoint, or supply your own embedding column.
- At run time, query the index and insert the returned chunks, with their source, into the prompt or the tool result.
Metadata columns let you filter by document type or date, cite sources and trace a bad answer back to a file.
Choosing a chunking strategy
| Document and query pattern | Strategy |
|---|---|
| Manuals, policies with headings | Split on structure (section or heading) |
| Plain prose, no structure | Fixed size with overlap |
| Questions about one precise clause or value | Smaller chunks |
| Questions that need a whole procedure | Larger, section level chunks |
| Tables inside documents | Keep each table whole with its caption |
| Short FAQs | One question and answer pair per chunk |
The embedding model's context length is a hard ceiling. Text beyond the model's input limit is truncated, so it is never embedded and cannot be matched. With a 512 token embedding model, an 1,800 token section chunk is mostly invisible to search; split it, or use a model with a longer input limit.
A modest overlap keeps a sentence that crosses a boundary findable; too much fills the top results with near duplicates.
AI Search settings that affect signal quality

| Symptom in the scenario | Likely root cause | Remediation |
|---|---|---|
| Agent cites text that was updated in the source table | TRIGGERED index not synced after updates | Run sync after each load, in the same job |
| Updates must appear within seconds | TRIGGERED sync too slow | Switch to CONTINUOUS (higher cost) |
| Exact codes or part numbers missed | Pure semantic (ANN) search | Use query_type HYBRID |
| Right document type, wrong region or year | No metadata filter | Add filters on an indexed column |
| Relevant chunk exists but rarely in results | num_results too small or chunks too large | Raise num_results or re chunk |
| Long noisy context, many weak matches | num_results too high | Lower num_results |
| Unrelated chunks score high | Query embedded with a different model than the index | Use the same embedding model for both |
A DIRECT_ACCESS index is not synced from a table at all. Your code writes vectors with upserts, so staleness there means the ingestion code skipped an upsert.
Querying the index
from databricks.vector_search.client import VectorSearchClient
index = VectorSearchClient().get_index(
endpoint_name="kb_endpoint", index_name="main.kb.policy_chunks_idx")
hits = index.similarity_search(
query_text="EU refund window for damaged items",
columns=["chunk_id", "text", "source_path"],
num_results=5, filters={"region": "EU"}, query_type="HYBRID")
Return the source column with the text, so the agent can cite each fact.
A small worked budget
The model has 16,000 tokens for retrieved context after the system prompt and history. With 800 token chunks, num_results of 10 uses 8,000 tokens and leaves room; num_results of 25 would need 20,000 and overflow. Smaller chunks of 300 tokens let 10 results fit in 3,000 tokens, but each carries less surrounding context.
How the exam asks about this
- "The source table is updated hourly, the index is TRIGGERED, and answers lag by days." The sync is not being run; call sync after each update job, or use CONTINUOUS only if seconds of freshness are required.
- "Users search by SKU codes and the agent returns similar but wrong products." Switch query_type to HYBRID so keyword matching catches exact codes.
- "Long sections are chunked whole and the embedding model accepts 512 tokens; later parts of sections are never retrieved." Re chunk below the embedding limit, splitting by subsection.
What to remember for the exam
- Pipeline order: UC volume, parse and chunk, Delta table with metadata, DELTA_SYNC index, retrieved chunks with sources in context.
- DELTA_SYNC indexes on standard endpoints need Change Data Feed on the source table; TRIGGERED needs a sync call, CONTINUOUS syncs within seconds at higher cost.
- DIRECT_ACCESS indexes change only through API upserts.
- Chunks must fit the embedding model's input limit, or the excess is truncated and never matched.
- Chunk by structure for structured documents, smaller for precise lookups, larger for whole procedures.
- HYBRID search helps exact terms; filters narrow by metadata; num_results trades recall against noise and tokens.
CONTINUOUS sync is not the default fix for stale results. If the source changes on a schedule, a sync call after each load gives the same freshness for those reads at lower cost.
Common mistakes
Fixing retrieval by changing the LLM. A better generator cannot cite a chunk the index never returned. When the trace shows the wrong chunks retrieved, the fix is in chunking, sync or query settings.
Ignoring the embedding limit. Chunks larger than the embedding model's input are silently truncated. The symptom is that facts near the end of long chunks are never found.
Dropping metadata during chunking. Without document type, region or date columns, there is nothing to filter on and no source to cite, so the agent mixes versions and regions.
Check yourself
Why does a TRIGGERED DELTA_SYNC index return outdated text after the source table changes?
A TRIGGERED index updates only when a sync is run, so until a sync call or scheduled sync job runs, the index keeps the old embeddings and text.
What chunking change fits questions that each target one exact contract clause?
Split by clause or subsection into smaller chunks that stay under the embedding model's input limit, so each clause is matched on its own.
Which query setting helps when searches for exact error codes return look alike results?
Setting query_type to HYBRID, which adds keyword matching to vector similarity so exact codes rank higher.
Topic 2 of 4 in Knowledge Retrieval and Genie Configuration
Test yourself on Knowledge Retrieval and Genie Configuration
The full Databricks Context Engineer Associate question bank has 600 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Databricks. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.