Your profile

One profile for every MSDEVBUILD site. Only you can see it, and the site owner if you write in.

Lesson 36 of 39
❮Prev Next❯

Semantic, Hybrid and Vector Search

Module 5: Information Extraction ⏱ 12 min read Updated

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    All my bookmarks and notes

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    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 needed

    Exam 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.

    Azure portal: Run keyword, vector, hybrid and semantic queries in Search explorer Run keyword, vector, hybrid and semantic queries in Search explorer.
    </> Embed

    Embed this simulation

    Free for trainers, teachers and bloggers. Paste this into your page:

    Loading the portal…

    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
    1. Open the search service that holds the policies-index.
    2. Type srch-agt-kb01 in the search bar and pick srch-agt-kb01 under Services.
    3. Select the index, then use Search explorer to try queries without writing code.
    4. A plain keyword query. The user typed “cab” and the policy says “taxi”, so BM25 finds nothing useful.
    5. A vector query. The question is embedded and compared with the chunk vectors, so “cab” lands next to “taxi”.
    6. 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.
    7. 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.
    8. 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.

    😟 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
    🛠️ Solved with: Hybrid and semantic queries

    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.

    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.

    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.

    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?

    NeedUse
    Users type exact part numbers, names or codesKeyword (or hybrid)
    Users ask in their own wordsVector (or hybrid)
    You can’t predict the styleHybrid
    The right answer is in the top 50 but not first, or you need captionsHybrid 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).

    QueryFinds “taxi” for “cab”?Finds “E-1074”?
    KeywordNoYes
    VectorYesOften not
    HybridYesYes
    Hybrid + semantic rankerYes, ranked best firstYes
    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

    Consumer electronics

    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.
    Ready for more?The full lesson adds the technical explanation, when to use it, interview questions and revision notes.

    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.

    Question 1

    Question 1 of 5

    Users search an HR index for "cab reimbursement", but the policy text says "taxi fares are refunded". Keyword queries return no results. What should you add first?

    Question 2

    Question 2 of 5

    A hybrid query returns results with scores such as 0.0328 and 0.0164. What explains the small values?

    Question 3

    Question 3 of 5

    A query that uses queryType semantic fails because the index has no semantic configuration. Which statement about the semantic ranker is correct?

    Question 4

    Question 4 of 5

    A support index must find exact error codes such as E-1074 and also match natural language descriptions. Vector-only queries return unrelated articles for codes. Which query type should you use?

    Question 5

    Question 5 of 5 · Select 2

    Documents were embedded with text-embedding-3-small. Which two statements about querying the vector field are correct?

    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. 1.Which algorithm merges keyword and vector result lists?Show

      Reciprocal Rank Fusion.

    2. 2.How many results does the semantic ranker rerank at most?Show

      The top 50.

    3. 3.What must the index have before a semantic query works?Show

      A semantic configuration.

    4. 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. 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

    Studying with a friend? Send them this lesson

    It's free and needs no sign-up. Their progress saves in their own browser.

    Lesson done? Make it stick with a quick gameSort It, Match the Pairs, Lightning Round and Who Am I? Earn XP and badges. Play ❯

    Install MSDEVBUILD Azure

    Free · no account · works offline

    Save the whole course for offline ›

    Hi, I’m your Nimbus

    Your study buddy. Pick what we do next.

    MSDEVBUILD · Multi-Stack Dev Build

    Sign in to MSDEVBUILD

    One account for Azure certifications and the blog: sign in here and you are signed in on both. Your XP, streak, practice deck and certificate stay in sync on every device. Optional: everything works without an account.