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
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Prior to indexing, assemble a document payload that includes vector data. The do
37
37
38
38
Vector fields contain vector data generated by embedding models, one embedding per field. We recommend the embedding models in [Azure OpenAI](https://aka.ms/oai/access), such as **text-embedding-ada-002** for text documents or the [Image Retrieval REST API](/rest/api/computervision/2023-02-01-preview/image-retrieval/vectorize-image) for images.
39
39
40
-
1. Provide other fields with alphanumeric content for the search response and for hybrid query scenarios that include full text search or semantic ranking in the same request.
40
+
1. Provide other fields with alphanumeric content for the query response and for hybrid query scenarios that include full text search or semantic ranking in the same request.
41
41
42
42
Your search index should include fields and content for all of the query scenarios you want to support. Suppose you want to search or filter over product names, versions, metadata, or addresses. In this case, similarity search isn't especially helpful. Keyword search, geo-search, or filters would be a better choice. A search index that includes a comprehensive field collection of vector and non-vector data provides maximum flexibility for query construction and response composition.
Copy file name to clipboardExpand all lines: articles/search/vector-search-how-to-query.md
+36-37Lines changed: 36 additions & 37 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -79,42 +79,6 @@ The expected response is 202 for a successful call to the deployed model. The bo
79
79
}
80
80
```
81
81
82
-
## Configure a query response
83
-
84
-
When you're setting up the vector query, think about the response structure. The response is a flattened rowset. Parameters on the query determine which fields are in each row and how many rows are in the response. The search engine ranks the matching documents and returns the most relevant results.
85
-
86
-
### Fields in a response
87
-
88
-
Search results are composed of "retrievable" fields from your search index. A result is either:
89
-
90
-
+ All "retrievable" fields (a REST API default).
91
-
+ Fields explicitly listed in a "select" parameter on the query.
92
-
93
-
The examples in this article include a "select" statement that specifies text (non-vector) fields to include the response.
94
-
95
-
> [!NOTE]
96
-
> 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.
97
-
98
-
### Number of results
99
-
100
-
A query might match to any number of documents, as many as all of them if the search criteria are weak (for example "search=*" for a null query). Because it's seldom practical to return unbounded results, you should specify a maximum for the response:
101
-
102
-
+`"k": n` results for vector-only queries
103
-
+`"top": n` results for hybrid queries that include a "search" parameter
104
-
105
-
Both "k" and "top" are optional. Unspecified, the default number of results in a response is 50. You can set "top" and "skip" to [page through more results](search-pagination-page-layout.md#paging-results) or to change the default.
106
-
107
-
### Ranking
108
-
109
-
Ranking of results is computed by either:
110
-
111
-
+ The similarity metric specified in the index `vectorConfiguration` for a vector-only query. Valid values are `cosine` , `euclidean`, and `dotProduct`.
112
-
+ Reciprocal Rank Fusion (RRF) if there are multiple sets of search results.
113
-
114
-
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`.
115
-
116
-
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). 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 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).
117
-
118
82
## Query syntax for vector search
119
83
120
84
In this vector query, which is shortened for brevity, the "value" contains the vectorized text of the query input. The "fields" property specifies which vector fields are searched. The "k" property specifies the number of nearest neighbors to return as top hits.
@@ -245,7 +209,42 @@ You must use REST for this scenario. Currently, there isn't support for multiple
245
209
246
210
Search results would include a combination of text and images, assuming your search index includes a field for the image file (a search index doesn't store images).
247
211
212
+
## Configure a query response
213
+
214
+
When you're setting up the vector query, think about the response structure. The response is a flattened rowset. Parameters on the query determine which fields are in each row and how many rows are in the response. The search engine ranks the matching documents and returns the most relevant results.
215
+
216
+
### Fields in a response
217
+
218
+
Search results are composed of "retrievable" fields from your search index. A result is either:
219
+
220
+
+ All "retrievable" fields (a REST API default).
221
+
+ Fields explicitly listed in a "select" parameter on the query.
222
+
223
+
The examples in this article used a "select" statement to specify text (non-vector) fields in the response.
224
+
225
+
> [!NOTE]
226
+
> 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.
227
+
228
+
### Number of results
229
+
230
+
A query might match to any number of documents, as many as all of them if the search criteria are weak (for example "search=*" for a null query). Because it's seldom practical to return unbounded results, you should specify a maximum for the response:
231
+
232
+
+`"k": n` results for vector-only queries
233
+
+`"top": n` results for hybrid queries that include a "search" parameter
234
+
235
+
Both "k" and "top" are optional. Unspecified, the default number of results in a response is 50. You can set "top" and "skip" to [page through more results](search-pagination-page-layout.md#paging-results) or change the default.
236
+
237
+
### Ranking
238
+
239
+
Ranking of results is computed by either:
240
+
241
+
+ The similarity metric specified in the index `vectorConfiguration` for a vector-only query. Valid values are `cosine` , `euclidean`, and `dotProduct`.
242
+
+ Reciprocal Rank Fusion (RRF) if there are multiple sets of search results.
243
+
244
+
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`.
245
+
246
+
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). 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 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).
247
+
248
248
## Next steps
249
249
250
250
As a next step, we recommend reviewing the demo code for [Python](https://github.com/Azure/cognitive-search-vector-pr/tree/main/demo-python), or [C#](https://github.com/Azure/cognitive-search-vector-pr/tree/main/demo-dotnet).
0 commit comments