Hybrid Search
该 API 的 Base URL 格式如下:
https://${CLUSTER_ENDPOINT}
- 你需要填入您的 Zilliz Cloud 集群的
${CLUSTER_ENDPOINT}
。 - 您可以使用 查看集群详情 V2 来获取集群的 Endpoint.
export CLUSTER_ENDPOINT=""
认证令牌,应为具备适当权限的 API 密钥或用冒号分隔的用户名和密码,如 username:password
。
数据库名称。
Collection 名称。
Partition 名称列表。设置此参数表示搜索仅限于指定的 Partition。否则,搜索会在 Collection 中搜索所有 Partition。
一个 Partition 名称。
搜索参数。
Search parameter for a vector field.
一个向量嵌入列表。Zilliz Cloud 会搜索与指定向量嵌入最相似的向量。
一个向量嵌入。
向量字段名称。
标量过滤条件。
用于分组聚合的字段名称。
当前搜索所使用的度量类型。该值应与目标 Collection 的度量类型相同。
需要返回的 Entity 数量。
需要在搜索结果中跳过的 Entity 数量。
搜索时是否需要忽略 Growing Segment 中的 Entity。
Extra search parameters.
确定最不相似向量的阈值。当设置 metrictype 为 L2 时,请确保该值大于 rangefilter 的值。否则,该值应小于 range_filter 的值。
优化搜索结果的相似度范围。当设置 metric_type 为 IP 或 COSINE 时,请确保该值大于 radius 的值。否则,该值应小于 radius 的值。
重新排序策略。
重新排序策略。
指定重新排序策略的参数。
可调节常数。仅当策略设置为 rrf
时适用。
需要返回的 Entity 总数。 您可以使用此参数与 param 中的 offset 结合使用,实现分页。 此值与 param 中的 offset 之和应小于 16,384。
搜索结果中需要包含的字段列表。
字段名称
当前搜索操作的一致性级别。
export TOKEN="db_admin:xxxxxxxxxxxxx"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/entities/hybrid_search" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "test_collection",
"search": [
{
"data": [
[
0.673437956701697,
0.739243747672878
]
],
"annsField": "float_vector_1",
"limit": 10,
"outputFields": [
"*"
]
},
{
"data": [
[
0.075384179256879,
0.9971545645073111
]
],
"annsField": "float_vector_2",
"limit": 10,
"outputFields": [
"*"
]
}
],
"rerank": {
"strategy": "rrf",
"params": {
"k": 10
}
},
"limit": 3,
"outputFields": [
"user_id",
"word_count",
"book_describe"
]
}'
响应码。
搜索结果。
An entity object.
Returns an error message.
响应码。
错误描述。
{
"code": 0,
"cost": 0,
"data": [
{
"book_describe": "book_105",
"distance": 0.09090909,
"id": 450519760774180800,
"user_id": 5,
"word_count": 105
},
{
"book_describe": "book_246",
"distance": 0.09090909,
"id": 450519760774180900,
"user_id": 46,
"word_count": 246
},
{
"book_describe": "book_367",
"distance": 0.08333333600000001,
"id": 450519760774181060,
"user_id": 67,
"word_count": 367
}
]
}