Lesson 3 of 5 Retrieval and Grounding Pipelines with Azure AI Search

Enriching Indexes with Built-in and Custom Skills

This lesson explains how skillsets apply AI during indexing so that the index contains OCR text, layout-aware sections, entities, translations, descriptions and embeddings, and how their outputs reach the index.

Learning outcomes

After completing this lesson, you will be able to:

  • Describe the enrichment pipeline and enrichment tree.
  • Identify the built-in skills for each kind of content.
  • Add logic with a custom Web API skill.

The enrichment pipeline

An indexer on its own copies the text of each source document into the index. Enrichment (also called AI enrichment) adds processing between reading and indexing: it reads text from images, detects languages and entities, splits text into chunks, generates embeddings and creates new fields that the source never contained. Each processing step is a skill, and the set of skills attached to an indexer is a skillset. The enrichment pipeline is the sequence in which the indexer and its skillset process each document.

The pipeline works as follows. The indexer first cracks each document into an enrichment tree, an in-memory structure of named nodes such as /document/content and /document/normalized_images/*. It then runs the skills in dependency order, each reading inputs from the tree and writing outputs back to it. Finally, it maps outputs to index fields through output field mappings or index projections. Skills that call Foundry Tools or models use the Foundry resource attached to the skillset, preferably through the search service's managed identity.

Tracing one scanned PDF through the tree makes the mechanism concrete. Document cracking writes the PDF's digital text to /document/content and each page image to /document/normalized_images/*. The OCR skill runs once per image, because its context is /document/normalized_images/*, and writes /document/normalized_images/*/text. A merge skill then combines the original text and the OCR text into /document/merged_content. A text split skill reads that node and writes /document/pages/*, one node per chunk, and an embedding skill with context /document/pages/* adds a vector to each chunk. Index projections finally turn each chunk node into its own search document.

The context of a skill is the key idea: it decides how many times the skill runs and where its outputs are attached. A skill with context /document runs once per document; a skill with context /document/pages/* runs once per chunk. A wrong context is a common cause of skills that produce one value where many were expected, and the debug session view of the enrichment tree shows exactly which nodes each skill read and wrote.

The following diagram shows the tree for the scanned PDF described above, and which skill writes each node.

Tracing a scanned PDF through the enrichment tree. Document cracking writes /document/content and one /document/normalized_images/* node per page image. The OCR skill runs once per image and writes its text, a merge skill writes /document/merged_content, the text split skill writes one /document/pages/* node per chunk, and the embedding skill runs once per chunk to add a vector. Index projections turn each chunk into its own search document.
A skill's context sets how many times it runs: the OCR skill runs once per page image and the embedding skill once per chunk. Index projections then make every chunk its own search document.
True or false

How skillsets work

Exam skills 5.1.3

Check four facts about the enrichment pipeline.

Log in to try this activity Interactive activities are free with an account.

Built-in skills

Built-in skills are maintained by Microsoft and configured rather than coded. They fall into a few groups according to the problem they solve.

Text skills detect the language, recognize entities, extract key phrases, detect and redact personal data, and translate. They add filterable metadata and make multilingual content searchable in one language.

Structure skills shape the text. The text split skill cuts it into chunks, the merge skill combines original text with OCR output, and the Document Layout skill uses Document Intelligence to return Markdown sections in which headings and tables are preserved.

Image skills read text from images with OCR and describe images with image analysis.

Vector skills call an Azure OpenAI embedding deployment, or Azure Vision multimodal embeddings for images, so that the index supports vector search.

The GenAI prompt skill sends content to a chat model with a prompt, which can describe a diagram, summarize a document or generate a custom field.

The Content Understanding skill runs a Content Understanding analyzer to produce layout-aware Markdown and chunks.

The following table summarizes the groups.

ContentSkillsOutput
TextLanguage detection, entity recognition, key phrase extraction, PII detection, sentiment, translationLanguages, entities, phrases, redacted text, translations
StructureText split, text merge, Document Layout (Document Intelligence)Chunks, merged text, Markdown sections with headings and tables
ImagesOCR, image analysisText from images, tags and captions
VectorsAzure OpenAI embedding, Azure Vision multimodal embeddingsText and image vectors
GenerativeGenAI prompt skillImage verbalization, summaries, custom generated fields
Mixed mediaContent Understanding skillLayout-aware Markdown and chunks from documents
Sort into groups

Choose the built-in skill

Exam skills 5.1.3

Choose the built-in skill for each enrichment.

Log in to try this activity Interactive activities are free with an account.

Custom skills

A custom Web API skill calls an HTTPS endpoint, usually an Azure Function, with a batch of records and receives new fields for each record. It adds logic that no built-in skill provides: a proprietary classifier, a lookup in a product database, a call to a Content Understanding custom analyzer, or a domain-specific normalization. The skill's contract is a JSON array of records with recordId and data in both directions; errors and warnings returned per record appear in the indexer execution history.

{
  "@odata.type": "#Microsoft.Skills.Custom.WebApiSkill",
  "name": "classify-ticket",
  "uri": "https://func-enrich.azurewebsites.net/api/classify",
  "authResourceId": "api://func-enrich",            // the search service's managed identity gets a token
  "context": "/document",
  "inputs":  [{"name": "text", "source": "/document/content"}],
  "outputs": [{"name": "category", "targetName": "category"}]
}
Worked example

Making diagrams searchable

Engineering documents contain wiring diagrams with labels. Technicians search for terms that appear only inside the diagrams, and for diagrams that show a particular kind of connection.

Enable image extraction in the indexer, run the OCR skill to read labels and merge the text into the chunks, and run the GenAI prompt skill (image verbalization) to describe each diagram's content, indexing the descriptions and their vectors. OCR alone would find labels but not descriptions of what the diagrams show.

Check yourself

When is a custom Web API skill needed?

Show answer

When the enrichment needs logic that no built-in skill provides. It is usually hosted in an Azure Function.

Exam Tips

Remember for the exam

  • Labels inside images: OCR skill with image extraction enabled. What an image shows: verbalization or image analysis.
  • Logic no built-in skill provides: custom Web API skill, usually an Azure Function.
  • Skill outputs reach the index through output field mappings or index projections.