Semantic, Hybrid and Vector Search
30-second answer
Keyword search (BM25) matches the words you type. Vector search embeds the question and matches meaning. Hybrid runs both in one request and merges the lists with Reciprocal Rank Fusion (RRF), so synonyms and exact codes both work. The semantic ranker then rereads the top 50 results with a language model, returns a reranker score and captions, and needs a semantic configuration on the index. For grounding, hybrid plus semantic ranking is the usual best choice. The ranker can't find a document the first stage missed.
Simulate it » No Azure account neededExam objective: 5.1.2 Configure semantic search, hybrid search and vector search for grounding. (Skills measured as of April 16, 2026)
Simulations
Feel it before you read it. No account needed, nothing leaves this page.
Open the search service that holds the <strong>policies-index</strong>.
👆 Click the glowing item in the portal to continue
Read the steps as text
- Open the search service that holds the policies-index.
- Type srch-agt-kb01 in the search bar and pick srch-agt-kb01 under Services.
- Select the index, then use Search explorer to try queries without writing code.
- A plain keyword query. The user typed “cab” and the policy says “taxi”, so BM25 finds nothing useful.
- A vector query. The question is embedded and compared with the chunk vectors, so “cab” lands next to “taxi”.
- Put both in one request and you have hybrid search. It still finds the taxi policy, and it keeps exact matches such as an error code.
- Add queryType: semantic and a semantic configuration. The ranker re-reads the top results, returns a reranker score (0 to 4) and highlights a caption.
- The semantic ranker is switched on per service under Settings ➜ Semantic ranker. The free plan has a monthly allowance; check the pricing page for today's rates.
🧪 Simulation for learning. Screens are simplified versions of the Azure portal; names, prices and IDs are examples. Nothing here touches real Azure.
🖱️ Drag to rotate · scroll or pinch to zoom
Keyword, vector, hybrid and semantic
Keyword search (BM25) matches words. Vector search compares embeddings, so it matches meaning. Hybrid runs both in parallel and merges them with Reciprocal Rank Fusion. The semantic ranker then re-reads the top 50 results with a language model and adds captions.
🤔 What happens if…
Read this tour as text
- Ingest and index content. An indexer reads files from a data source, runs a skillset (OCR, Text Split, an embedding model) and writes one search document per chunk into the index. Scanned images only become searchable when the OCR skill gets the images (imageAction: generateNormalizedImages).
- Keyword, vector, hybrid and semantic. Keyword search (BM25) matches words. Vector search compares embeddings, so it matches meaning. Hybrid runs both in parallel and merges them with Reciprocal Rank Fusion. The semantic ranker then re-reads the top 50 results with a language model and adds captions.
- Enrich with skills. A skillset is a chain of skills that adds fields to each document: built-in skills such as OCR, PII Detection and Key Phrase Extraction, a Web API custom skill for your own code, and the Content Understanding skill for layout-aware chunking. Outputs reach the index through output field mappings or index projections.
- Connect retrieval to an agent. A Foundry agent gets a knowledge base as a tool (an MCP endpoint). The project’s managed identity needs the Search Index Data Reader role. A retrieval reasoning effort of minimal, low or medium decides whether a model plans subqueries. Answers should come back with citations.
- Content Understanding analyzers. An analyzer turns a document into Markdown (layout, tables, figures) and into fields you define. Each field uses a method: extract (text on the page), classify (a fixed list) or generate (the model writes it). Fields come with a confidence score and a source location.
The policy index already exists. Ask it the same question in four ways, find out where each one fails, and see why an index needs a semantic configuration before the ranker will run.
🎓 Education-only simulation. Your lab is saved in this browser, so you can leave and continue later.
😟 THE PROBLEM
Searching “cab fare” misses the policy that says “taxi”, but pure vector search loses the exact error code.
😊 THE SOLUTION
Run hybrid search, then rerank the top results with the semantic ranker.
- Synonyms and paraphrases missed✓ Add a vector query for meaning
- Exact codes and names get lost✓ Keep the keyword query in the same request (hybrid)
- The best passage is ranked fourth✓ Semantic ranker reranks the top 50
Start with a question
An employee asks, “Can I get my cab money back?” The policy says “taxi fares are reimbursed”. Which search finds it?
Picture two librarians. The first one only looks at the exact words on the book spines. You ask for “cab” and she shrugs: no book has that word.
The second one has read every book and knows what each is about. You say “cab money” and she says: “You mean taxi refunds. Shelf three.”
That’s keyword versus vector search. A good library uses both, and then asks a third person, the semantic ranker, to read the top few books and tell you which one really answers the question.
Explain it like I’m 10
The technical explanation
All four options work on the same index. What changes is the query you send.
Keyword (full-text) search
The search parameter runs a BM25 query over searchable text fields. It’s fast, precise for exact words, names and codes, and supports filters, facets and analyzers. Its weakness is vocabulary: it can’t know that “cab” and “taxi” mean the same.
Vector search
A vector query compares an embedding of the question with the vector field and returns the k nearest neighbours. You can send a ready-made vector (kind: "vector") or, if the index has a vectorizer, send the text and let the service embed it (kind: "text").
{
"select": "title, chunk",
"vectorQueries": [
{ "kind": "text", "text": "Can I get my cab money back?",
"fields": "text_vector", "k": 5 }
]
}
Vector search finds meaning, so it works across paraphrases and even languages. Its weakness is exact identifiers: an error code like E-1074 has no meaning to blur into, so the nearest neighbours may be unrelated. The documents and the query must use the same embedding model.
Behind the scenes the vector field uses an HNSW graph for fast approximate search, or exhaustive KNN when you need exact results on a small set. You can also add filters to the same query. A preFilter narrows the candidates first, and a postFilter trims the nearest neighbours after.
Hybrid search
Put search and vectorQueries in the same request. The service runs the keyword and vector queries in parallel and merges their ranked lists with Reciprocal Rank Fusion:
RRF score = sum over lists of 1 / (60 + rank in that list)
A document that ranks well in both lists beats a document that is first in only one. You get one list back, with small RRF scores. You can weight individual vector queries if one field matters more.
{
"search": "Can I get my cab money back?",
"vectorQueries": [ { "kind": "text", "text": "Can I get my cab money back?", "fields": "text_vector", "k": 50 } ],
"top": 5
}
The semantic ranker
Add queryType: "semantic" and a semanticConfiguration, and a second stage runs. It rereads the top 50 results from the first stage with a language model, reorders them by a reranker score (0 to 4), and can return extractive captions (highlighted passages) and answers.
{
"search": "Can I get my cab money back?",
"queryType": "semantic",
"semanticConfiguration": "default",
"captions": "extractive",
"answers": "extractive",
"vectorQueries": [ { "kind": "text", "text": "Can I get my cab money back?", "fields": "text_vector", "k": 50 } ]
}
Two things to remember. First, the semantic configuration has to exist on the index (it names a title field, content fields and optional keyword fields), and the feature has to be turned on for the service. Second, the ranker only reorders: if the right passage isn’t in the first stage’s results, it can’t appear.
Which one when?
| Need | Use |
|---|---|
| Users type exact part numbers, names or codes | Keyword (or hybrid) |
| Users ask in their own words | Vector (or hybrid) |
| You can’t predict the style | Hybrid |
| The right answer is in the top 50 but not first, or you need captions | Hybrid plus the semantic ranker |
For an agent, you often don’t pick at all. A knowledge base with agentic retrieval plans the subqueries and sends hybrid queries with semantic reranking for you (next but one lesson).
| Query | Finds “taxi” for “cab”? | Finds “E-1074”? |
|---|---|---|
| Keyword | No | Yes |
| Vector | Yes | Often not |
| Hybrid | Yes | Yes |
| Hybrid + semantic ranker | Yes, ranked best first | Yes |
Architect level Tuning and cost
Start with k of 50 on the vector query so the semantic ranker has enough candidates. Increase it only if tests show good documents falling outside the top 50.
Vector fields use memory. Vector compression (scalar or binary quantization) and truncated dimensions on supported embedding models shrink the index with a small recall cost, and oversampling with rescoring wins some of that back. Measure recall on your own questions before you compress.
The semantic ranker is a billed feature: a free allowance each month, then a charge per thousand queries. Agentic retrieval adds model token charges for query planning at low and medium effort. Look at the current pricing page before you size a production system, and keep an eye on search latency and throttled queries in the metrics.
Real-world business scenario
Northwind Support (fictional)
- The problem
- Customers typed error codes and also described problems in their own words. Keyword search found the codes but missed descriptions, and a vector-only pilot found descriptions but returned the wrong article for codes like E-1074.
- What they used
- A hybrid query over the chunk and text_vector fields with a vectorizer for the same embedding model, plus the semantic ranker over the top 50, with a filter on product line.
- Why that choice
- Hybrid keeps the exact-match strength of keyword and the meaning-match of vectors, and the ranker picks the best passage and returns a caption for the answer card.
- The result
- First-answer accuracy on the test set went from 61% to 84% and agents stopped pasting error codes into chat to get a hit.
When to use it and when not to
✓ Use it when…
- Hybrid for most RAG and agent grounding, because users mix exact terms and plain language.
- The semantic ranker when quality of the first few results matters and a bit more latency is fine.
- Pure keyword for catalogue search by SKU, name or code where meaning doesn't matter.
✕ Think twice when…
- Vector search alone for identifiers and codes.
- The semantic ranker as a fix for poor recall. It only reorders what's already there.
- Embedding queries with a different model than the one used at indexing.
↔ Alternatives to consider
- Agentic retrieval through a knowledge base when an agent asks multi-part questions.
- Filters and facets when users narrow by category, date or department.
- Scoring profiles to boost fields such as title or recency in keyword scoring.
Test yourself with exercises
5 original practice questions in the AI-103 style. Pick your answers, then check them. You will see why each option is right or wrong. Score 75% or more and this topic is marked complete.
Interview preparation
Say your answer out loud first, then open the model answer. Interviewers care more about your reasoning than the exact words.
Beginner What is the difference between keyword and vector search?
Model answer
Keyword search matches the exact tokens in the query, so "cab" never finds "taxi". Vector search turns the query and the documents into embeddings and finds the closest meaning, so it handles synonyms and paraphrases.
Intermediate Why is hybrid search often better than vector search alone?
Model answer
Vector search can blur exact identifiers such as part numbers or error codes, and keyword search misses synonyms. Hybrid runs both and merges the two lists with RRF, so a document that does well in either, or in both, rises to the top.
Interviewer follows up
Why are hybrid scores small numbers?
You
They're RRF scores, each term being 1 divided by a constant plus a rank, so they look like 0.03 and aren't comparable with BM25 or similarity scores.
Experienced developer What does the semantic ranker do, and what can't it do?
Model answer
It takes at most the top 50 results from the first stage, rereads them with a language model, reorders them with a reranker score from 0 to 4 and can add captions and answers. It can't retrieve a document the first stage didn't return, and it only reads the text fields in the semantic configuration.
Scenario A semantic query returns an error about a configuration. What do you check?
Model answer
Whether the index has a semantic configuration, whether the request names it with semanticConfiguration (or a default is set), and whether the semantic ranker is enabled on the service plan. Then I'd make sure the configuration points at real text fields.
Architecture & design How would you configure retrieval for an HR policy agent?
Model answer
A hybrid query over a chunk text field and a vector field, with the vectorizer matching the embedding model used at indexing, then the semantic ranker over the top results, with a filter for department or country applied first. I'd test recall and groundedness on a set of real questions before choosing k and any weights.
Quick revision
Key points
- Keyword = tokens (BM25). Vector = meaning (embeddings, nearest neighbours). Hybrid = both, merged with RRF.
- Semantic ranker reranks only the top 50 and returns captions, answers and a 0 to 4 reranker score.
- Semantic ranking needs a semantic configuration on the index and the feature enabled on the service.
- A vectorizer lets you send text (kind text) and have the query embedded with the same model as the documents.
- Filters can run before the vector search (preFilter) or after it (postFilter).
- Hybrid is the default for grounding. Add the semantic ranker when quality matters more than a little latency and cost.
Important terminology
- BM25
- The relevance scoring used for keyword (full-text) queries. It rewards rare words that appear often in a document.
- Embedding
- A list of numbers that represents the meaning of a text, so similar meanings sit close together.
- Vector query
- A query that compares a query vector with the vector field and returns the k nearest neighbours.
- Vectorizer
- An index setting that calls an embedding model so a text query can be embedded for you at query time (query kind text).
- Hybrid search
- One request that contains a keyword query and one or more vector queries. The lists are merged with RRF.
- Reciprocal Rank Fusion
- A merge method that scores each document by the sum of 1 divided by (a constant plus its rank) in every list.
- Semantic ranker
- A second-stage reranker that uses a language model on the top 50 results to reorder them and add captions and answers.
- Semantic configuration
- An index setting that names the title, content and keyword fields the semantic ranker should read.
Common mistakes
- Embedding the query with a different model than the documents.
- Expecting the semantic ranker to find documents the first stage missed.
- Comparing RRF scores with BM25 scores.
- Using vector search alone for part numbers and error codes.
Exam tips
- "Finds meaning with no shared words" = vector.
- "Combine full-text and vector results into one list" = hybrid (RRF).
- "Reorders the top results and returns captions" = semantic ranker.
Five quick revision questions
-
1.Which algorithm merges keyword and vector result lists?Show
Reciprocal Rank Fusion.
-
2.How many results does the semantic ranker rerank at most?Show
The top 50.
-
3.What must the index have before a semantic query works?Show
A semantic configuration.
-
4.What does a vectorizer let you do at query time?Show
Send text and have it embedded with the same model as the documents.
-
5.Which query type is weak at exact error codes?Show
Vector search.
Official references
Finished this lesson? Tick it off. Your progress is saved in this browser.
Next up: Enrich Content with Built-in and Custom Skills
Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges.