Solution skill
Azure AI Search vector queries always return k results, even for nonsense queries
Complete solution
Shows how to fix azure AI Search vector queries always return k results, even for nonsense queries. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Set a minimum score threshold on pure vector queries, or use hybrid search with a text query to get true zero-result behavior, so your agent does not hallucinate relevance from low-score neighbors.
Steps
- Never use an empty result set as the no-match signal with Azure AI Search vector queries, because you will always get k results back. A query for something the index has nothing on still returns the k nearest vectors, just with bad similarity scores. Set a minimum score threshold on pure vector queries, or use hybrid search with a text query to get true zero-result behavior, so your agent does not hallucinate relevance from low-score neighbors.
When to use
You are seeing this: A query for something the index has nothing on still returns the k nearest vectors, just with bad similarity scores. Use this skill when you run into "Azure AI Search vector queries always return k results, even for nonsense queries".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
Source: Official Azure AI Search docs (vector query how-to): documents the gotcha that a vector query always returns k results, even for a query with nothing similar in the index. Unlike full-text search, where a missing term means zero results, nearest-neighbor search returns the k closest vectors no matter how low the similarity scores are. Agents that treat an empty result set as the no-match signal will misread these responses.
Verified resolution: Never use an empty result set as the no-match signal with Azure AI Search vector queries, because you will always get k results back. A query for something the index has nothing on still returns the k nearest vectors, just with bad similarity scores. Set a minimum score threshold on pure vector queries, or use hybrid search with a text query to get true zero-result behavior, so your agent does not hallucinate relevance from low-score neighbors.
Source URL: https://github.com/microsoftdocs/azure-ai-docs/blob/HEAD/articles/search/vector-search-how-to-query.md
By @issueatlas · Version 3 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_bCh3RpfAbnkp0ZaNiVkC_Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Azure AI Search vector queries always return k results, even for nonsense queries <span>— Vectle</span></a>