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
In a nutshell
  • 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.

UC volumeraw documentsParse and chunkDelta tablechunks and metadataAI Search indexAgent context

How it works

The governed pipeline

  1. Store source files in a Unity Catalog volume, so access is granted and audited in one place.
  2. 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.
  3. 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.
  4. 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 patternStrategy
Manuals, policies with headingsSplit on structure (section or heading)
Plain prose, no structureFixed size with overlap
Questions about one precise clause or valueSmaller chunks
Questions that need a whole procedureLarger, section level chunks
Tables inside documentsKeep each table whole with its caption
Short FAQsOne 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

AI Search sync: a TRIGGERED index that is never synced after the morning refresh serves old text; ending the load job with an index sync is the cost-effective fix, and CONTINUOUS sync is for cases where seconds matter, at higher cost.

Symptom in the scenarioLikely root causeRemediation
Agent cites text that was updated in the source tableTRIGGERED index not synced after updatesRun sync after each load, in the same job
Updates must appear within secondsTRIGGERED sync too slowSwitch to CONTINUOUS (higher cost)
Exact codes or part numbers missedPure semantic (ANN) searchUse query_type HYBRID
Right document type, wrong region or yearNo metadata filterAdd filters on an indexed column
Relevant chunk exists but rarely in resultsnum_results too small or chunks too largeRaise num_results or re chunk
Long noisy context, many weak matchesnum_results too highLower num_results
Unrelated chunks score highQuery embedded with a different model than the indexUse 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.
Watch out

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.