5.1 Azure AI Search — Fundamentals and Architecture
Key Takeaways
- Azure AI Search (formerly Cognitive Search) provides full-text search, AI enrichment, vector search, and semantic ranking; the indexing pipeline runs Data Source → Indexer → Skillset → Index.
- fieldMappings map source fields BEFORE enrichment; outputFieldMappings map skill outputs AFTER enrichment — confusing the two is a top exam trap.
- Each field has independent attributes (searchable, filterable, sortable, facetable, retrievable, key); only Edm.String / Collection(Edm.String) are searchable for keyword search.
- Vector search stores embeddings in a Collection(Edm.Single) field and retrieves the k nearest neighbors via an HNSW or exhaustiveKnn algorithm using a cosine, dotProduct, or euclidean metric.
- Semantic ranker (an L2 re-ranker) requires a semantic configuration and a paid tier; hybrid search (BM25 + vector) plus semantic ranking is the recommended Retrieval-Augmented Generation pattern.
Quick Answer: Azure AI Search runs an indexing pipeline: Data Source -> Indexer -> Skillset -> Index -> Query. Indexers pull from Blob Storage, Azure SQL, Cosmos DB, ADLS Gen2, and SharePoint. Skillsets enrich data with Optical Character Recognition (OCR), Named Entity Recognition (NER), and key phrases. Vector search stores embeddings; semantic ranking re-ranks results. For RAG, use hybrid search (keyword + vector) with semantic ranking.
Where This Sits on AI-102
Knowledge mining and information extraction (Domain 6) is worth 15-20% of the AI-102 exam, which has roughly 40-60 questions, a 100-minute time limit, a passing score of 700/1000, and a $165 USD registration fee. Note for 2026: Microsoft has scheduled the Azure AI Engineer Associate (AI-102) exam to retire on June 30, 2026 — confirm the current edition before booking. Azure AI Search questions are heavy on case-study drag-and-drop: you order pipeline components, fix a broken field mapping, or choose the right search mode for a RAG scenario.
Indexing Pipeline Order
[Data Sources] [AI Enrichment] [Search]
Blob / SQL / Cosmos --> Skillset (OCR, NER, --> Index (full-text +
DB / ADLS Gen2 / key phrases, custom) vector + semantic)
SharePoint
^ |
Indexer ----------------- coordinates ------------------+
The indexer is the orchestrator: it connects to one data source, optionally invokes one skillset, and writes documents to exactly one index. A common trap presents the components scrambled (Index first, or Skillset before Indexer) — the correct sequence is always Data Source -> Indexer -> Skillset -> Index.
Field Mappings vs Output Field Mappings
This is the single most-tested logistics detail in 5.1:
| Mapping type | Runs | Maps from | Typical use |
|---|---|---|---|
| fieldMappings | BEFORE enrichment | Raw source field | Rename metadata_storage_name -> documentName; base64-encode a key |
| outputFieldMappings | AFTER enrichment | Enrichment-tree node (/document/...) | Write skill output /document/organizations -> index field organizations |
If a skill output never appears in the index, the missing piece is almost always an absent outputFieldMapping — not a skillset error.
Index Field Attributes
{"name": "id", "type": "Edm.String", "key": true, "filterable": true},
{"name": "content", "type": "Edm.String", "searchable": true, "analyzer": "en.microsoft"},
{"name": "category", "type": "Edm.String", "filterable": true, "facetable": true},
{"name": "contentVector", "type": "Collection(Edm.Single)", "searchable": true, "dimensions": 1536, "vectorSearchProfile": "vp"}
| Attribute | Meaning | Worked example |
|---|---|---|
| searchable | Full-text indexed via an analyzer | content for keyword queries |
| filterable | Usable in $filter (OData) | category eq 'Legal' |
| sortable | Usable in $orderby | Sort by lastModified desc |
| facetable | Drives faceted navigation counts | Sidebar of categories |
| retrievable | Returned in results | Turn off for embeddings you do not display |
| key | Unique document identifier | Exactly one per index, Edm.String |
Trap: attributes are immutable once the index is created. Adding filterable to an existing field requires rebuilding the index — you cannot patch it in place. Only one field can be key, and it must be Edm.String.
Vector Search
Vector search retrieves by semantic similarity instead of exact tokens. You store an embedding (e.g., 1536 floats from Azure OpenAI text-embedding-ada-002, or 3072 from text-embedding-3-large) in a Collection(Edm.Single) field, then query for the k nearest neighbors.
"vectorSearch": {
"algorithms": [{
"name": "hnsw-1", "kind": "hnsw",
"hnswParameters": {"metric": "cosine", "m": 4, "efConstruction": 400, "efSearch": 500}
}],
"profiles": [{"name": "vp", "algorithm": "hnsw-1"}]
}
| Algorithm | Behavior | When |
|---|---|---|
| hnsw | Approximate nearest neighbor, fast, graph-based | Large indexes, low latency |
| exhaustiveKnn | Exact, scans every vector | Small sets or 100% recall needed |
| Metric | Notes |
|---|---|
| cosine | Default; matches OpenAI embeddings (angle, ignores magnitude) |
| dotProduct | Use only with pre-normalized vectors |
| euclidean | Straight-line distance |
The dimensions value must match the embedding model exactly — mismatching 1536 against a 3072-dim model throws an indexing error.
from azure.search.documents.models import VectorizedQuery
results = search_client.search(
search_text=None,
vector_queries=[VectorizedQuery(
vector=query_embedding, k_nearest_neighbors=5, fields="contentVector")])
Hybrid Search and Semantic Ranking
Hybrid search runs BM25 keyword scoring and vector search in parallel, then fuses ranks with Reciprocal Rank Fusion (RRF). Layering the semantic ranker on top adds an L2 deep-learning re-rank of the top 50 candidates, plus semantic captions (the best passage per hit) and semantic answers (a verbatim extracted answer).
| Mode | How it scores | Best for |
|---|---|---|
| Keyword (BM25) | Term frequency / document frequency | Exact terms, codes, SKUs |
| Vector | Embedding similarity (k-NN) | Synonyms, paraphrase, intent |
| Hybrid | RRF fusion of both | General RAG recall |
| Hybrid + semantic | RRF then L2 re-rank | Best RAG precision |
Semantic ranking requires a semantic configuration in the index and a Basic tier or higher (not free). For a RAG chatbot scenario, the exam-correct answer is almost always hybrid search with semantic ranking — it maximizes both recall and the relevance of the few chunks you feed the language model.
On the Exam: Distinguish BM25 (keyword), vector (embeddings, k-NN), and semantic ranking (re-rank). When a question says "customers misspell or paraphrase queries," the fix is vector or hybrid search; when it says "surface a direct answer snippet," enable semantic answers.
An indexer applies a skillset that outputs detected organizations to /document/organizations, but the organizations never appear in the search index. What is the most likely cause?
A RAG chatbot must handle users who paraphrase questions while still matching exact product codes, and must surface the single most relevant passage. Which retrieval configuration best fits?
You stored embeddings from text-embedding-3-large (3072 dimensions) but defined the vector field with dimensions set to 1536. What happens?
After creating an index, you realize the 'category' field needs to support $filter expressions but it was defined without the filterable attribute. What must you do?