Skip to content

Commit 5af0278

Browse files
Merge pull request #268257 from HeidiSteen/heidist-fix
vector query edits
2 parents a249f3b + 0fd5da4 commit 5af0278

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

articles/search/vector-search-how-to-query.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In Azure AI Search, if you [have vector fields](vector-search-how-to-create-inde
2222
> + [Query multiple vector fields at once](#multiple-vector-fields)
2323
> + [Query with integrated vectorization (preview)](#query-with-integrated-vectorization-preview)
2424
25-
This article uses REST examples. For code samples in other languages, see the [azure-search-vector-samples](https://github.com/Azure/azure-search-vector-samples) GitHub repository for end-to-end solutions that include vector queries.
25+
This article uses REST for illustration. For code samples in other languages, see the [azure-search-vector-samples](https://github.com/Azure/azure-search-vector-samples) GitHub repository for end-to-end solutions that include vector queries.
2626

2727
## Prerequisites
2828

@@ -82,7 +82,8 @@ The actual response for this POST call to the deployed model includes 1536 embed
8282

8383
In this approach, your application code is responsible for connecting to a model, generating embeddings, and handling the response.
8484

85-
Alternatively, you can try [Query with integrated vectorization](#query-with-integrated-vectorization-preview), currently in public preview.
85+
> [!TIP]
86+
> Try [Query with integrated vectorization](#query-with-integrated-vectorization-preview), currently in public preview, to have Azure AI Search handle your query vectorization inputs and outputs.
8687
8788
## Vector query request
8889

@@ -247,7 +248,7 @@ In Azure AI Search, query responses consist of all `retrievable` fields by defau
247248

248249
In a vector query, carefully consider whether you need to vector fields in a response. Vector fields aren't human readable, so if you're pushing a response to a web page, you should choose nonvector fields that are representative of the result. For example, if the query executes against `contentVector`, you could return `content` instead.
249250

250-
If you do want vector fields in the result, here's the basic structure of a response from a pure vector query. The implied `select` for this response includes `title`, `category`, and `contentVector`.
251+
If you do want vector fields in the result, here's an example of the response structure. `contentVector` is a string array of embeddings, trimmed here for brevity. The search score indicates relevance. Other nonvector fields are included for context.
251252

252253
```json
253254
{
@@ -592,13 +593,21 @@ Both "k" and "top" are optional. Unspecified, the default number of results in a
592593

593594
Ranking of results is computed by either:
594595

595-
+ The similarity metric specified in the index `vectorSearch` section for a vector-only query. Valid values are `cosine`, `euclidean`, and `dotProduct`.
596+
+ Similarity metric
596597
+ Reciprocal Rank Fusion (RRF) if there are multiple sets of search results.
597598

599+
### Similarity metric
600+
601+
The similarity metric specified in the index `vectorSearch` section for a vector-only query. Valid values are `cosine`, `euclidean`, and `dotProduct`.
602+
598603
Azure OpenAI embedding models use cosine similarity, so if you're using Azure OpenAI embedding models, `cosine` is the recommended metric. Other supported ranking metrics include `euclidean` and `dotProduct`.
599604

600-
Multiple sets are created if the query targets multiple vector fields, or if the query is a hybrid of vector and full text search, with or without [semantic ranking](semantic-search-overview.md). Within vector search, a vector query can only target one internal vector index. So for [multiple vector fields](#multiple-vector-fields) and [multiple vector queries](#multiple-vector-queries), the search engine generates multiple queries that target the respective vector indexes of each field. Output is a set of ranked results for each query, which are fused using RRF. For more information, see [Vector query execution and scoring](vector-search-ranking.md).
605+
### Using RRF
606+
607+
Multiple sets are created if the query targets multiple vector fields, runs multiple vector queries in parallel, or if the query is a hybrid of vector and full text search, with or without [semantic ranking](semantic-search-overview.md).
608+
609+
During query execution, a vector query can only target one internal vector index. So for [multiple vector fields](#multiple-vector-fields) and [multiple vector queries](#multiple-vector-queries), the search engine generates multiple queries that target the respective vector indexes of each field. Output is a set of ranked results for each query, which are fused using RRF. For more information, see [Relevance scoring using Reciprocal Rank Fusion (RRF)](hybrid-search-ranking.md).
601610

602611
## Next steps
603612

604-
As a next step, we recommend reviewing the demo code for [Python](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-python), [C#](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-dotnet) or [JavaScript](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-javascript/JavaScriptVectorDemo).
613+
As a next step, review vector query code examples in [Python](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-python), [C#](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-dotnet) or [JavaScript](https://github.com/Azure/azure-search-vector-samples/tree/main/demo-javascript/JavaScriptVectorDemo).

0 commit comments

Comments
 (0)