Skip to content

Commit 89aea63

Browse files
Merge pull request #525 from HeidiSteen/heidist-release
hybrid search doc updates
2 parents 6d06092 + 73efe3c commit 89aea63

File tree

4 files changed

+35
-23
lines changed

4 files changed

+35
-23
lines changed

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

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,55 @@ ms.service: cognitive-search
99
ms.custom:
1010
- ignite-2023
1111
ms.topic: how-to
12-
ms.date: 08/05/2024
12+
ms.date: 10/01/2024
1313
---
1414

1515
# Create a hybrid query in Azure AI Search
1616

17-
[Hybrid search](hybrid-search-overview.md) combines one or more text (keyword) queries with one or more vector queries in a single search request. The queries execute in parallel. The results are merged and reordered by new search scores, using [Reciprocal Rank Fusion (RRF)](hybrid-search-ranking.md) to return a unified result set.
17+
[Hybrid search](hybrid-search-overview.md) combines text (keyword) and vector queries in a single search request. All subqueries in the request execute in parallel. The results are merged and reordered by new search scores, using [Reciprocal Rank Fusion (RRF)](hybrid-search-ranking.md) to return a unified result set. In many cases, [per benchmark tests](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/3929167), hybrid queries with semantic ranking return the most relevant results.
1818

19-
In many cases, [per benchmark tests](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/3929167), hybrid queries with semantic ranking return the most relevant results.
19+
In this article, learn how to:
2020

21-
To improve relevance, use these parameters:
21+
+ Set up a basic request
22+
+ Add filters
23+
+ Improve relevance using semantic ranking or vector weights
24+
+ Optimize query behaviors by controlling text and vector inputs
25+
26+
To improve relevance in a hybrid query, use these parameters:
2227

2328
+ [vector.queries.weight](vector-search-how-to-query.md#vector-weighting) lets you set the relative weight of the vector query. This feature is particularly useful in complex queries where two or more distinct result sets need to be combined, as is the case for hybrid search. This feature is generally available.
2429

2530
+ [hybridsearch.maxTextRecallSize and countAndFacetMode (preview)](#set-maxtextrecallsize-and-countandfacetmode-preview) give you more control over text inputs into a hybrid query. This feature requires a preview API version.
2631

2732
## Prerequisites
2833

29-
+ A search index containing `searchable` vector and nonvector fields. See [Create an index](search-how-to-create-search-index.md) and [Add vector fields to a search index](vector-search-how-to-create-index.md).
34+
+ A search index containing `searchable` vector and nonvector fields. We recommend the [Import and vectorize data wizard](search-import-data-portal.md) to create an index quickly. Otherwise, see [Create an index](search-how-to-create-search-index.md) and [Add vector fields to a search index](vector-search-how-to-create-index.md).
3035

3136
+ (Optional) If you want the [semantic ranker](semantic-search-overview.md), your search service must be Basic tier or higher, with [semantic ranker enabled](semantic-how-to-enable-disable.md).
3237

33-
+ (Optional) If you want text-to-vector conversion of a query string, [create and assign a vectorizer](vector-search-how-to-configure-vectorizer.md) to vector fields in the search index.
38+
+ (Optional) If you want built-in text-to-vector conversion of a query string, [create and assign a vectorizer](vector-search-how-to-configure-vectorizer.md) to vector fields in the search index.
3439

3540
## Choose an API or tool
3641

37-
+ [**2024-07-01**](/rest/api/searchservice/documents/search-post) stable version or a recent preview API version if you're using [maxTextRecallSize and countAndFacetMode(preview)](#set-maxtextrecallsize-and-countandfacetmode-preview).
38-
+ Search Explorer in the Azure portal (targets 2024-05-01-preview behaviors)
39-
+ Newer stable or beta packages of the Azure SDKs (see change logs for SDK feature support)
42+
+ Search Explorer in the Azure portal (supports both stable and preview API search syntax) has a JSON view that lets you paste in a hybrid request.
43+
44+
+ [**2024-07-01**](/rest/api/searchservice/documents/search-post) stable version or a recent preview API version if you're using preview features like [maxTextRecallSize and countAndFacetMode(preview)](#set-maxtextrecallsize-and-countandfacetmode-preview).
45+
46+
For readability, we use REST examples to explain how the APIs work. You can use a REST client like Visual Studio Code with the REST extension to build hybrid queries. For more information, see [Quickstart: Vector search using REST APIs](search-get-started-vector.md).
4047

41-
## Run a hybrid query in Search Explorer
48+
+ Newer stable or beta packages of the Azure SDKs (see change logs for SDK feature support).
4249

43-
1. In [Search Explorer](search-explorer.md), make sure the API version is **2024-07-01** or newer preview API versions.
50+
## Set up a hybrid query in Search Explorer
4451

45-
1. Under **View**, select **JSON view**.
52+
1. In [Search Explorer](search-explorer.md), make sure the API version is **2024-07-01** or a newer preview API version.
4653

47-
1. Replace the default query template with a hybrid query, such as the one starting on line 539 for the [vector quickstart example](vector-search-how-to-configure-vectorizer.md#try-a-vectorizer-with-sample-data). For brevity, the vector is truncated in this article.
54+
1. Under **View**, select **JSON view** so that you can paste in a vector query.
55+
56+
1. Replace the default query template with a hybrid query, such as the "Run a hybrid query" example starting on line 539 in the [vector quickstart](https://raw.githubusercontent.com/Azure-Samples/azure-search-rest-samples/refs/heads/main/Quickstart-vectors/az-search-vector-quickstart.rest). For brevity, the vector is truncated in this article.
4857

4958
A hybrid query has a text query specified in `search`, and a vector query specified under `vectorQueries.vector`.
5059

51-
The text query and vector query should be equivalent or at least not conflict. If the queries are different, you don't get the benefit of hybrid.
60+
The text query and vector query can be equivalent or divergent, but it's common for them to share the same intent.
5261

5362
```json
5463
{
@@ -70,6 +79,9 @@ To improve relevance, use these parameters:
7079

7180
1. Select **Search**.
7281

82+
> [!TIP]
83+
> Search results are easier to read if you hide the vectors. In **Query Options**, turn on **Hide vector values in search results**.
84+
7385
## Hybrid query request (REST API)
7486

7587
A hybrid query combines text search and vector search, where the `search` parameter takes a query string and `vectorQueries.vector` takes the vector query. The search engine runs full text and vector queries in parallel. The union of all matches is evaluated for relevance using Reciprocal Rank Fusion (RRF) and a single result set is returned in the response.

articles/search/hybrid-search-overview.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ ms.service: cognitive-search
99
ms.custom:
1010
- ignite-2023
1111
ms.topic: conceptual
12-
ms.date: 08/19/2024
12+
ms.date: 10/01/2024
1313
---
1414

1515
# Hybrid search using vectors and full text in Azure AI Search
1616

17-
Hybrid search is a combination of full text and vector queries that execute against a search index that contains both searchable plain text content and generated embeddings. For query purposes, hybrid search is:
17+
Hybrid search is a combination of full text and vector queries that execute against a search index containing both searchable plain text content and generated embeddings. For query purposes, hybrid search is:
1818

1919
+ A single query request that includes both `search` and `vectors` query parameters
2020
+ Executing in parallel
@@ -26,13 +26,13 @@ This article explains the concepts, benefits, and limitations of hybrid search.
2626

2727
In Azure AI Search, vector fields containing embeddings can live alongside textual and numerical fields, allowing you to formulate hybrid queries that execute in parallel. Hybrid queries can take advantage of existing functionality like filtering, faceting, sorting, scoring profiles, and [semantic ranking](semantic-search-overview.md) in a single search request.
2828

29-
Hybrid search combines results from both full text and vector queries, which use different ranking functions such as BM25 and HNSW. A [Reciprocal Rank Fusion (RRF)](hybrid-search-ranking.md) algorithm merges the results. The query response provides just one result set, using RRF to pick the most relevant matches from each query.
29+
Hybrid search combines results from both full text and vector queries, which use different ranking functions such as BM25, HNSW, and EKNN. A [Reciprocal Rank Fusion (RRF)](hybrid-search-ranking.md) algorithm merges the results. The query response provides just one result set, using RRF to rank the unified results.
3030

3131
## Structure of a hybrid query
3232

33-
Hybrid search is predicated on having a search index that contains fields of various [data types](/rest/api/searchservice/supported-data-types), including plain text and numbers, geo coordinates for geospatial search, and vectors for a mathematical representation of a chunk of text. You can use almost all query capabilities in Azure AI Search with a vector query, except for client-side interactions such as autocomplete and suggestions.
33+
Hybrid search is predicated on having a search index that contains fields of various [data types](/rest/api/searchservice/supported-data-types), including plain text and numbers, geo coordinates if you want geospatial search, and vectors for a mathematical representation of a chunk of text. You can use almost all query capabilities in Azure AI Search with a vector query, except for pure text client-side interactions such as autocomplete and suggestions.
3434

35-
A representative hybrid query might be as follows (notice the vector is trimmed for brevity):
35+
A representative hybrid query might be as follows (notice that the vector queries have placeholder values for brevity):
3636

3737
```http
3838
POST https://{{searchServiceName}}.search.windows.net/indexes/hotels-vector-quickstart/docs/search?api-version=2024-07-01
@@ -63,9 +63,9 @@ POST https://{{searchServiceName}}.search.windows.net/indexes/hotels-vector-quic
6363

6464
Key points include:
6565

66-
+ `search` specifies a full text search query.
66+
+ `search` specifies a single full text search query.
6767
+ `vectors` for vector queries, which can be multiple, targeting multiple vector fields. If the embedding space includes multi-lingual content, vector queries can find the match with no language analyzers or translation required.
68-
+ `select` specifies which fields to return in results, which can be text fields that are human readable.
68+
+ `select` specifies which fields to return in results, which should be text fields that are human readable.
6969
+ `filters` can specify geospatial search or other include and exclude criteria, such as whether parking is included. The geospatial query in this example finds hotels within a 300-kilometer radius of Washington D.C.
7070
+ `facets` can be used to compute facet buckets over results that are returned from hybrid queries.
7171
+ `queryType=semantic` invokes semantic ranker, applying machine reading comprehension to surface more relevant search results. Semantic ranking is optional. If you aren't using that feature, remove the last three lines of the hybrid query.

articles/search/hybrid-search-ranking.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.service: cognitive-search
99
ms.custom:
1010
- ignite-2023
1111
ms.topic: conceptual
12-
ms.date: 09/24/2024
12+
ms.date: 10/01/2024
1313
---
1414

1515
# Relevance scoring in hybrid search using Reciprocal Rank Fusion (RRF)

articles/search/vector-search-how-to-configure-compression-storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: heidisteen
77
ms.author: heidist
88
ms.service: cognitive-search
99
ms.topic: how-to
10-
ms.date: 08/14/2024
10+
ms.date: 10/01/2024
1111
---
1212

1313
# Reduce vector size through quantization, narrow data types, and storage options

0 commit comments

Comments
 (0)