You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/search/vector-search-how-to-query.md
+15-6Lines changed: 15 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ In Azure AI Search, if you [have vector fields](vector-search-how-to-create-inde
22
22
> +[Query multiple vector fields at once](#multiple-vector-fields)
23
23
> +[Query with integrated vectorization (preview)](#query-with-integrated-vectorization-preview)
24
24
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.
26
26
27
27
## Prerequisites
28
28
@@ -82,7 +82,8 @@ The actual response for this POST call to the deployed model includes 1536 embed
82
82
83
83
In this approach, your application code is responsible for connecting to a model, generating embeddings, and handling the response.
84
84
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.
86
87
87
88
## Vector query request
88
89
@@ -247,7 +248,7 @@ In Azure AI Search, query responses consist of all `retrievable` fields by defau
247
248
248
249
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.
249
250
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.
251
252
252
253
```json
253
254
{
@@ -592,13 +593,21 @@ Both "k" and "top" are optional. Unspecified, the default number of results in a
592
593
593
594
Ranking of results is computed by either:
594
595
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
596
597
+ Reciprocal Rank Fusion (RRF) if there are multiple sets of search results.
597
598
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
+
598
603
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`.
599
604
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).
601
610
602
611
## Next steps
603
612
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