Building RAG Indexes with OCR, Chunking and Integrated Vectorization
This lesson walks through integrated vectorization in Azure AI Search, which builds a RAG index of complete, well-formed chunks with vectors and citation metadata from raw documents, and the chunking decisions that affect answer quality.
Learning outcomes
After completing this lesson, you will be able to:
- Describe the stages of an integrated vectorization pipeline.
- Choose chunk size and overlap.
- Use index projections to map documents to chunks.
The ingestion flow
The quality of a RAG application is limited by its index. If a scanned page was never read, if a table was cut in half, or if a chunk lost the heading that explains it, no retrieval setting or prompt can recover the missing information. RAG ingestion is therefore the step that turns raw files into chunks that are complete, searchable by keyword and by meaning, and labelled with the information needed for citations.
Integrated vectorization is the Azure AI Search feature that performs this whole flow inside the search service. Without it, the team would write code to extract text, call an OCR service, split the text, call an embedding model and upload each chunk, and would have to keep that code running as documents change. With it, an indexer and a skillset perform these steps on a schedule with change detection, and a vectorizer on the index embeds queries with the same model, so the application only sends text.
The pipeline runs in the following stages, which the Import data wizard in the Azure portal can generate. Each stage writes to the enrichment tree described in the previous lesson.
-
Data source and indexer
Enable image extraction (generateNormalizedImages) for scanned content.
-
OCR
Run OCR on extracted images with a merge skill that inserts the text into the document text, or use the Document Layout skill, which returns Markdown sections with OCR included.
-
Text split
Split into pages of a set length with overlap, or use layout-based chunks from Document Layout.
-
Embedding
An embedding skill vectorizes each chunk with an Azure OpenAI embedding deployment.
-
Index projections
Write each chunk as its own document with parent_id, title, page and source path.
-
Vectorizer
Add a vectorizer to the index so that queries are embedded with the same model.
After the data source, the wizard asks for the scenario, which decides the pipeline it builds, as the following screenshot shows: keyword search with optional AI skills, RAG over text and simple images read with OCR, or multimodal RAG, which also interprets complex images such as diagrams, charts and workflows.

Chunking decisions
Chunking is the stage of the ingestion flow that splits each document into the passages, or chunks, that are embedded, indexed and retrieved. Because the model sees only the chunks that retrieval returns, the way documents are split decides whether an answer and the information it depends on arrive together. Two decisions matter most: how large each chunk is and where its boundaries fall. Chunk size trades precision against context. Small chunks (for example 256 tokens) match questions precisely but may separate a statement from its conditions; large chunks (1,000 or more tokens) keep context but dilute relevance scores and consume prompt tokens. Overlap of around 10-25% reduces the risk of splitting an answer across chunks. Layout-aware chunking by section keeps headings with their text and keeps tables whole, which matters for manuals, policies and financial documents. Adding the document title and section heading to each chunk improves retrieval and citations.
A short illustration shows why boundaries matter. A leave policy states "Employees receive 20 days of annual leave" at the end of one page and "Part-time employees receive a pro rata amount" at the start of the next. With fixed 256-token chunks and no overlap, the two sentences can land in different chunks, and a question about part-time leave may retrieve only the first, producing a confident but wrong answer. Overlap, or a layout-aware chunk that keeps the whole section together, keeps the rule and its condition in the same chunk. Chunking settings are then confirmed with the relevance query set rather than chosen once and left unchanged.
Small or large chunks?
Index projections and parent documents
Chunking produces many chunks from one source document, but by default an indexer writes one search document per source document. Something must therefore decide how the chunks become separate entries in the index, and how each chunk stays linked to the document it came from, which is called its parent document.
Index projections map one source document to many chunk documents in the target index, each with a key and a parent key. The application can show the parent document as the citation, retrieve neighbouring chunks for more context, or filter by parent. Without projections, chunks would be stored as a collection inside one document, which cannot be searched chunk by chunk.
Scanned contracts
A legal team uploads 15,000 contracts, half of them scans, to Blob Storage. The RAG assistant currently returns nothing for scanned contracts and often cites half of a table.
Enable image extraction with OCR (or use the Document Layout skill, which includes OCR) so scanned text is indexed, switch from fixed-length splitting to layout-aware chunks that keep tables whole, and project chunks with the contract title and page for citations. Increasing the number of retrieved chunks would not help, because the scanned text was never indexed.
What do index projections do?
Show answer
They write each chunk as its own index document with a key to its parent document.
Exam Tips
Remember for the exam
- Scanned content: image extraction plus OCR merge, or the Document Layout skill.
- Layout-aware chunks keep headings and tables intact; add titles to chunks.
- Index projections create one index document per chunk with a parent key.