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
> +[Filter and query vector fields](#filter-and-vector-queries)
22
23
> +[Combine vector, full text search, and semantic search in a hybrid query](#query-syntax-for-hybrid-search).
23
24
> +[Query multiple vector fields at once](#query-syntax-for-vector-query-over-multiple-fields).
24
25
> +[Run multiple vector queries in parallel](#query-syntax-for-multiple-vector-queries).
@@ -127,7 +128,7 @@ In this vector query, which is shortened for brevity, the "value" contains the v
127
128
In the following example, the vector is a representation of this query string: `"what Azure services support full text search"`. The query request targets the "contentVector" field. The actual vector has 1536 embeddings. It's trimmed in this example for readability.
128
129
129
130
```http
130
-
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version={{api-version}}
131
+
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version=2023-07-01-Preview
131
132
Content-Type: application/json
132
133
api-key: {{admin-api-key}}
133
134
{
@@ -221,16 +222,50 @@ Here's a modified example so that you can see the basic structure of a response
221
222
222
223
---
223
224
225
+
## Filter and vector queries
226
+
227
+
A query request can include a vector query and a [filter expression](search-filters.md). Filters apply to text and numeric fields, and are useful for including or excluding search documents based on filter criteria. Although a vector field isn't filterable itself, you can attribute a text or numeric field in the same index as "filterable".
228
+
229
+
In contrast with full text search, a filter in a pure vector query is effectively processed as a post-query operation. The set of `"k"` nearest neighbors is retrieved, and then combined with the set of filtered results. As such, the value of `"k"` predetermines the surface over which the filter is applied. For `"k": 10`, the filter is applied to 10 most similar documents. For `"k": 100`, the filter iterates over 100 documents (assuming the index contains 100 documents that are sufficiently similar to the query).
230
+
231
+
Here's an example of filter expressions combined with a vector query:
232
+
233
+
```http
234
+
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version=2023-07-01-Preview
235
+
Content-Type: application/json
236
+
api-key: {{admin-api-key}}
237
+
{
238
+
"vectors": [
239
+
{
240
+
"value": [
241
+
-0.009154141,
242
+
0.018708462,
243
+
. . .
244
+
-0.02178128,
245
+
-0.00086512347
246
+
],
247
+
"fields": "contentVector",
248
+
"k": 10
249
+
},
250
+
],
251
+
"select": "title, content, category",
252
+
"filter": "category eq 'Databases'"
253
+
}
254
+
```
255
+
256
+
> [!TIP]
257
+
> If you don't have source fields with text or numeric values, check for document metadata, such as LastModified or CreatedBy properties, that might be useful in a filter.
258
+
224
259
## Query syntax for hybrid search
225
260
226
261
A hybrid query combines full text search and vector search, where the `"search"` parameter takes a query string and `"vectors.value"` takes the vector query. The search engine runs full text and vector queries in parallel. All matches are evaluated for relevance using Reciprocal Rank Fusion (RRF) and a single result set is returned in the response.
227
262
228
-
Hybrid queries are useful because they add support for filters, orderby, and [semantic search](semantic-how-to-query-request.md) For example, in addition to the vector query, you could filter by location or search over product names or titles, scenarios for which similarity search isn't a good fit.
263
+
Hybrid queries are useful because they add support for filters, orderby, and [semantic search](semantic-how-to-query-request.md) For example, in addition to the vector query, you could search over people or product names or titles, scenarios for which similarity search isn't a good fit.
229
264
230
265
The following example is from the [Postman collection of REST APIs](https://github.com/Azure/cognitive-search-vector-pr/tree/main/demo-python) that demonstrate query configurations. It shows a complete request that includes vector search, full text search with filters, and semantic search with captions and answers. Semantic search is an optional premium feature. It's not required for vector search or hybrid search. For content that includes rich descriptive text *and* vectors, it's possible to benefit from all of the search modalities in one request.
231
266
232
267
```http
233
-
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version={{api-version}}
268
+
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version=2023-07-01-Preview
234
269
Content-Type: application/json
235
270
api-key: {{admin-api-key}}
236
271
{
@@ -262,7 +297,7 @@ api-key: {{admin-api-key}}
262
297
You can set the "vectors.fields" property to multiple vector fields. For example, the Postman collection has vector fields named "titleVector" and "contentVector". A single vector query executes over both the "titleVector" and "contentVector" fields, which must have the same embedding space since they share the same query vector.
263
298
264
299
```http
265
-
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version={{api-version}}
300
+
POST https://{{search-service-name}}.search.windows.net/indexes/{{index-name}}/docs/search?api-version=2023-07-01-Preview
Copy file name to clipboardExpand all lines: articles/search/vector-search-overview.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ author: robertklee
7
7
ms.author: robertlee
8
8
ms.service: cognitive-search
9
9
ms.topic: conceptual
10
-
ms.date: 08/10/2023
10
+
ms.date: 09/21/2023
11
11
---
12
12
13
13
# Vector search within Azure Cognitive Search
@@ -41,7 +41,7 @@ On the indexing side, prepare source documents that contain embeddings. Cognitiv
41
41
42
42
On the query side, in your client application, collect the query input. Add a step that converts the input into a vector, and then send the vector query to your index on Cognitive Search for a similarity search. Cognitive Search returns documents with the requested `k` nearest neighbors (kNN) in the results.
43
43
44
-
You can index vector data as fields in documents alongside alphanumeric content. Vector queries can be issued singly or in combination with other query types, including term queries (hybrid search) and filters and semantic re-ranking in the same search request.
44
+
You can index vector data as fields in documents alongside alphanumeric content. Vector queries can be issued singly or in combination with filters and other query types, including term queries (hybrid search) and semantic ranking in the same search request.
45
45
46
46
## Limitations
47
47
@@ -66,9 +66,9 @@ Scenarios for vector search include:
66
66
67
67
+**Multi-lingual search**. Use a multi-lingual embeddings model to represent your document in multiple languages in a single vector space to find documents regardless of the language they are in.
68
68
69
-
+**Hybrid search**. Vector search is implemented at the field level, which means you can build queries that include vector fields and searchable text fields. The queries execute in parallel and the results are merged into a single response. Optionally, add [semantic search (preview)](semantic-search-overview.md) for even more accuracy with L2 reranking using the same language models that power Bing.
69
+
+**Hybrid search**. Vector search is implemented at the field level, which means you can build queries that include both vector fields and searchable text fields. The queries execute in parallel and the results are merged into a single response. Optionally, add [semantic search (preview)](semantic-search-overview.md) for even more accuracy with L2 reranking using the same language models that power Bing.
70
70
71
-
+**Filtered vector search**. A query request can include a vector query and a [filter expression](search-filters.md). Filters apply to text and numeric fields, and are useful for including or excluding search documents based on filter criteria. Although a vector field isn't filterable itself, you can set up a filterable text or numeric field. The search engine processes the filter first, reducing the surface area of the search corpus before running the vector query.
71
+
+**Filtered vector search**. A query request can include a vector query and a [filter expression](search-filters.md). Filters apply to text and numeric fields, and are useful for including or excluding search documents based on filter criteria. Although a vector field isn't filterable itself, you can set up a filterable text or numeric field. The search engine processes the filter after the vector query executes, trimming search results from query response.
72
72
73
73
+**Vector database**. Use Cognitive Search as a vector store to serve as long-term memory or an external knowledge base for Large Language Models (LLMs), or other applications. For example, you can use Azure Cognitive Search as a [*vector index* in an Azure Machine Learning prompt flow](/azure/machine-learning/concept-vector-stores) for Retrieval Augmented Generation (RAG) applications.
0 commit comments