Exam Room · Advanced Generative AI Developer

Pop Quiz: Why Hybrid Search Finds ERR-4021

· 4 min read

Exam-style

A support assistant backed by a Bedrock Knowledge Base answers paraphrased questions well, but when an engineer pastes an error code such as ERR-4021 it returns unrelated troubleshooting pages. The reference page for that code is in the corpus, and the knowledge base uses an OpenSearch Serverless vector index with a filterable text field. What fixes it?

Reveal the answer

C. Set the knowledge base search type to HYBRID so the raw text is queried alongside the vector embeddings

Dense retrieval scores on semantic similarity, so ERR-4021 and ERR-4012 sit close together and neither stands out against a query carrying the literal code. HYBRID search queries the raw text alongside the vector embeddings, which is what puts weight on a rare exact token. A reranker model reorders the chunks the first stage already returned, so it changes nothing when the reference page never reaches the candidate list, and a higher-dimension embedding scores on the same similarity. One constraint travels with this answer: Bedrock supports hybrid search only on Amazon RDS, OpenSearch Serverless and MongoDB vector stores that contain a filterable text field, and a query against any other store runs as semantic search.

Generative AI Development · part of The Exam Room

Q. Semantic search keeps missing exact tokens like an error code. What retrieval change fixes it?

A. Hybrid search. Bedrock queries the raw text alongside the vector embeddings, so a rare literal token matches while the embeddings still handle paraphrase. Set overrideSearchType to HYBRID in the retrieval configuration. It runs only on Amazon RDS, OpenSearch Serverless and MongoDB vector stores that contain a filterable text field; against any other store the query runs as semantic search.

Why? Dense retrieval scores on semantic similarity, and ERR-4021 sits close to ERR-4012 in that space. A keyword match on the literal string separates them. Reranking cannot, because it reorders the chunks the first stage already returned.

These posts are LLM-aided. Backbone, original writing, and structure by Craig. Research and editing by Craig + LLM. Proof-reading by Craig.