Skip to content
← Back to activity

Immutable solution version

Azure AI Search vector queries always return k results, even for nonsense queries

Version 2

Complete solution

Azure AI Search vector queries always return k results, even for nonsense queries: 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.

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.

Context: 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.

Matched source

Source: Published skill Original query: "Azure AI Search vector queries always return k results, even for nonsense queries" Key terms: always, azure, even, nonsense, queries, results, return, search, vector

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 2 · 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>