メインコンテンツまでスキップ

Hybrid Search (V2)

This operation searches for entities based on vector similarity and scalar filtering and reranks the results using a specified strategy.

POST/v2/vectordb/entities/hybrid_search
Connection Endpoint

The base URL for this API is in the following format:

https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

📘Notes
  • Use the cluster endpoint if you are using serving clusters.
    • Free & Serverless

      https://{cluster-id}.serverless.{region}.vectordb.zillizcloud.com

    • Dedicated

      https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530

  • You need to fill in ${CLUSTER_ENDPOINT} with that of your Zilliz Cloud cluster.
  • To get the endpoint, use the Describe Cluster V2 API to extract the values from the responses.
export CLUSTER_ENDPOINT="https://{cluster-id}.{region}.vectordb.zillizcloud.com:19530"
Parameters
Authorizationstringheaderrequired

The authentication token should be an API key with appropriate privileges or a pair of colon-joined username and password, like username:password. If you are using a project endpoint, only a valid API key with sufficient permissions applies.

Example Value: Bearer {{TOKEN}}
Request Bodyapplication/json
dbNamestring

The name of the database.

collectionNamestringrequired

The name of the collection to which this operation applies.

partitionNamesarray

The name of the partitions to which this operation applies. Setting this parameter indicates that the search is within the specified partitions. Otherwise, the search is across all partitions in the collection.

[]partitionNamesstring

A partition name.

searcharrayrequired

The search parameters

[]searchobjectrequired

Search parameter for a vector field.

dataarrayrequired

A list of vector embeddings.Zilliz Cloud searches for the most similar vector embeddings to the specified ones.

[]datanumber<float32>

A vector embedding

annsFieldstringrequired

The name of the vector field.

filterstringrequired

A boolean expression filter.

groupingFieldstringrequired

The name of the field that serve as the aggregation criteria.

limitintegerrequired

The number of entities to return.

offsetintegerrequired

The number of entities to skip in the returned entities.

ignoreGrowingbooleanrequired

Whether to ignore the entities found in the growing segments.

paramsobject

Extra search parameters.

radiusnumber<float64>

Determines the threshold of least similarity. When setting metrictype to L2, ensure that this value is greater than that of rangefilter. Otherwise, this value should be lower than that of range_filter.

range_filternumber<float64>

Refines the search to vectors within a specific similarity range. When setting metric_type to IP or COSINE, ensure that this value is greater than that of radius. Otherwise, this value should be lower than that of radius.

exprParamsobject

Expression template parameter values for parameterized filter expressions.

rerankobject

The reranking strategy.

strategystring

The name of the reranking strategy.

paramsobjectrequired

A set of parameters related to the specified strategy

kintegerrequired

A tunable constant in the RRF algorithm. This applies only when the strategy is set to rrf.

limitinteger

The total number of entities to return. You can use this parameter in combination with offset in param to enable pagination. The sum of this value and offset in param should be less than 16,384.

groupSizeinteger

The number of entities to return for each group. This parameter is only valid when groupingField is specified.

strictGroupSizeboolean

Whether to return only the top k entities for each group. This parameter is only valid when groupingField is specified.

outputFieldsarray

An array of fields to return along with the search results.

[]outputFieldsstring

A field name

consistencyLevelstring

The consistency level of the search operation. The value should be the same as the consistency level of the target collection.

functionScoreobject

Function settings for the current search request.

namestring

The name of the function to apply.

descriptionstring

The description of the function to apply.

typestring

The type of the function to apply.

inputFieldNamesarray

A list of scalar fields to use as input for the function.

[]inputFieldNamesstring

A scalar field to use as input for the function.

outputFieldNamesarray

A list of vector fields to use as output for the function.

[]outputFieldNamesstring

A vector field to use as output for the function.

paramsobject

Extra parameters for the function in key-value pairs.

offsetinteger

Number of records to skip in the search results.

groupingFieldstring

Name of the field to group search results by.

export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/entities/hybrid_search" \
--header "Authorization: Bearer ${TOKEN}". \
--header "Request-Timeout: 10" \
--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"
]
}'
Responses200 - application/json
codeinteger

Response code.

costinteger

Cost of this operation. This applies to free and serverless clusters only, indicating the vCU usage of the current request.

dataarray

Search results

[]dataobject

An entity object.

topksarray

The number of top-K results returned for each query vector.

[]topksinteger
(To be added soon)
scanned_remote_bytesinteger

Returned when the deployment uses tiered storage with usage tracking enabled and the operation reads from remote/disk storage. Omitted when all data is served from local cache.

scanned_total_bytesinteger

Returned when the deployment uses tiered storage with usage tracking enabled and the operation reads from remote/disk storage. Omitted when all data is served from local cache.

cache_hit_rationumber

Returned when the deployment uses tiered storage with usage tracking enabled and the operation reads from remote/disk storage. Omitted when all data is served from local cache.

Returns an error message.

codeinteger

Response code.

messagestring

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
}
]
}