Vector Search
After generating the question embedding (Step 5), pass it to the Azure AI Search Vector Search endpoint. The engine performs an Approximate Nearest Neighbor (ANN) search over the stored embedding vectors and returns the chunks whose vectors are closest to the question vector — i.e., the most semantically similar document chunks regardless of exact keyword overlap.
Azure AI Search API Key
api-key{{azureAISearch_Key}}| Field | Type | Required | Description |
|---|---|---|---|
| vectorQueries | Array | Required | Array of vector query objects. Typically contains one query. |
| vectorQueries[].kind | String | Required | Must be "vector". |
| vectorQueries[].vector | Array<float> | Required | The 1536-dim embedding vector of the user's question. Copy from the Get Question Embedding response (data[0].embedding). |
| vectorQueries[].fields | String | Required | The vector field in the index to search against. Use "embedding". |
| vectorQueries[].k | Integer | Optional | Number of nearest neighbours to return. Default 5. Use 3–5 for RAG context. |
| select | String | Optional | Comma-separated fields to return, e.g. "section,content". |
Request Body Structure
{
"vectorQueries": [
{
"kind" : "vector",
"vector": [ 0.0198974609375, 0.055816650390625, ... ], // 1536 floats from Step 5
"fields": "embedding",
"k" : 5
}
],
"select": "section,content"
}cURL
curl -X POST \ -H "api-key: <your-azure-search-key>" \ -H "Content-Type: application/json" \ -d '{"vectorQueries":[{"kind":"vector","vector":[0.019,0.055,...],"fields":"embedding","k":5}],"select":"section,content"}' \ "https://<resource>.search.windows.net/indexes/<index>/docs/search?api-version=2025-05-01-preview"
content fields from the returned chunks and pass them as context in the Ask Question to GPT request (Step 7).
Sample Response
{
"value": [
{
"@search.score" : 0.8912,
"section" : "Introduction to Azure AI Search",
"content" : "Azure AI Search is a fully managed, cloud-based search service..."
},
// more chunks...
]
}fields not a vector field.api-key.