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-create-index.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ The schema must include fields for the document key, vector fields, and any othe
50
50
> + Both new and existing indexes support vector search. However, there is a small subset of older services that don't support vector search. In this case, a new search service must be created to use it.
51
51
> + Updating an existing index to add vector fields requires `allowIndexDowntime` query parameter to be `true`.
52
52
53
-
1. Use the [Create or Update Index Preview REST API](/rest/api/searchservice/preview-api/create-or-update-index) to add vector fields.
53
+
1. Use the [Create or Update Index Preview REST API](/rest/api/searchservice/preview-api/create-or-update-index) to create the index.
54
54
55
55
1. Create a `vectorSearch` section in the index that specifies the algorithm used to create the embedding space. Currently, only `"hnsw"` is supported.
56
56
@@ -73,7 +73,7 @@ The schema must include fields for the document key, vector fields, and any othe
73
73
74
74
1. Add fields that define the substance and structure of the content you're indexing. At a minimum, you need a document key.
75
75
76
-
You should also add fields that are useful in the query response. The example below shows vector fields for title and content ("titleVector", "contentVector"). It also provides fields for equivalent textual content ("title", "content") that users can read in a search result.
76
+
You should also add fields that are useful in the query or in it's response. The example below shows vector fields for title and content ("titleVector", "contentVector"). It also provides fields for equivalent textual content ("title", "content") useful for sorting, filtering, and reading in a search result.
77
77
78
78
1. Add vector fields to the fields collection. You can store one generated embedding per document field. For each vector field:
79
79
@@ -84,6 +84,8 @@ The schema must include fields for the document key, vector fields, and any othe
84
84
+ "searchable" must be "true".
85
85
+ "retrievable" set to "true" allows you to display the raw vectors (for example, as a verification step), but doing so will increase storage. Set to "false" if you don't need to return raw vectors. You don't need to return vectors for a query, but if you're passing a vector result to a downstream app then set "retrievable" to "true".
86
86
87
+
An index definition with the described elements looks like this:
88
+
87
89
```http
88
90
PUT https://my-search-service.search.windows.net/indexes/my-index?api-version=2023-07-01-Preview&allowIndexDowntime=true
Copy file name to clipboardExpand all lines: articles/search/vector-search-how-to-query.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ ms.date: 07/14/2023
17
17
18
18
In Azure Cognitive Search, if you added vector fields to a search index, this article explains how to query those fields. It also explains how to combine vector queries with full text search and semantic search for hybrid query combination scenarios.
19
19
20
-
Query execution in Cognitive Search doesn't include vector conversion. Encoding (text-to-vector) of the query string requires that you pass the text to an embedding model for vectorization. The output of the call to the embedding model is then passed to the search engine for similarity search over vector fields.
20
+
Query execution in Cognitive Search doesn't include vector conversion. Encoding (text-to-vector) of the query string requires that you pass the text to an embedding model for vectorization. You would then pass the output of the call to the embedding model to the search engine for similarity search over vector fields.
21
21
22
22
## Prerequisites
23
23
@@ -37,7 +37,7 @@ If you aren't sure whether your search index already has vector fields, look for
37
37
38
38
+ In the fields collection, look for fields of type `Collection(Edm.Single)`, with a `dimensions` attribute and a `vectorSearchConfiguration` set to the name of the `vectorSearch` algorithm configuration used by the field.
39
39
40
-
You can also send an empty query (`search=*`) against the index if the vector field is "retrievable". In a response, a vector field consists of an array of floating point values.
40
+
You can also send an empty query (`search=*`) against the index. If the vector field is "retrievable", the response includes a vector field consisting of an array of floating point values.
41
41
42
42
## Convert query input into a vector
43
43
@@ -83,7 +83,7 @@ The expected response is 202 for a successful call to the deployed model. The bo
83
83
84
84
When you're setting up the vector query, think about the response structure. Search results are composed of either all "retrievable" fields (a REST API default) or the fields explicitly listed in a "select" parameter on the query. In the examples that follow, each one includes a "select" statement that specifies text (non-vector) fields to include the response.
85
85
86
-
Vectors aren't designed for readability, so avoid returning them in the response. Instead, choose non-vector fields that are representative of the search document. For example, if the query targets a "descriptionVector" field, return an equivalent text field ("description") in the response.
86
+
Vectors aren't designed for readability, so avoid returning them in the response. Instead, choose non-vector fields that are representative of the search document. For example, if the query targets a "descriptionVector" field, return an equivalent text field if you have one ("description") in the response.
87
87
88
88
Size of the results is determined by the query parameters "k" and "top". Maximum results in a response are either:
89
89
@@ -93,11 +93,11 @@ Size of the results is determined by the query parameters "k" and "top". Maximum
93
93
94
94
Ranking of results is either:
95
95
96
-
+ Cosine similarity if the query is over a single vector field, assuming `cosine` is what you specified in the index `vectorConfiguration`. Azure OpenAI embedding models use cosine similarity metrics. Other supported ranking metrics include `euclidean` and `dotProduct`.
96
+
+ Cosine similarity if the query is over a single vector field, assuming `cosine` is what you specified in the index `vectorConfiguration`. 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`.
97
97
98
98
+ Reciprocal Rank Fusion (RRF) if there are multiple sets of search results. 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 the optional semantic reranking capabilities of [semantic search](semantic-search-overview.md).
99
99
100
-
Within vector search, a vector query can only target one internal vector index. So for [multiple vector fields](#query-syntax-for-vector-query-over-multiple-fields) and [multiple vector queries](#query-syntax-for-multiple-vector-queries), the search engine generates parallel 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).
100
+
Within vector search, a vector query can only target one internal vector index. So for [multiple vector fields](#query-syntax-for-vector-query-over-multiple-fields) and [multiple vector queries](#query-syntax-for-multiple-vector-queries), the search engine generates parallel 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).
0 commit comments