Search
This operation conducts a vector similarity search with an optional scalar filtering expression.
The base URL for this API is in the following format:
https://${CLUSTER_ENDPOINT}
- 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=""
The authentication token should be an API key with appropriate privileges or a pair of colon-joined username and password, like username:password
.
The name of the database.
The name of the collection to which this operation applies.
A list of vector embeddings. Zilliz Cloud searches for the most similar vector embeddings to the specified ones.
A vector embedding
The name of the vector field.
The filter used to find matches for the search.
Groups search results by a specified field to ensure diversity and avoid returning multiple results from the same group.
The number of entities to return for each group. This parameter is only valid when groupingField
is specified.
Whether to return only the top k entities for each group. This parameter is only valid when groupingField
is specified.
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.
The number of records to skip in the search result. You can use this parameter in combination with limit to enable pagination. The sum of this value and limit should be less than 16,384.
An array of fields to return along with the search results.
A field name
The parameter settings specific to this operation.
The name of the metric type that applies to the current search. The value should be the same as the metric type of the target collection.
Extra search parameters.
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.
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.
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.
A partition name.
The consistency level of the search operation. The value should be the same as the consistency level of the target collection.
A set of key-value pairs that can be filled back in to the filter
parameter to enable filtering templating. For details, refer to Filter Templating.
Function settings for the current search request.
The name of the function to apply.
The description of the function to apply.
The type of the function to apply.
A list of scalar fields to use as input for the function.
A scalar field to use as input for the function.
A list of vector fields to use as output for the function.
A vector field to use as output for the function.
Extra parameters for the function in key-value pairs.
Extra parameters for the search in key-value pairs.
export TOKEN="db_admin:xxxxxxxxxxxxx"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v2/vectordb/entities/search" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "quick_setup",
"data": [
[
0.3580376395471989,
-0.6023495712049978,
0.18414012509913835,
-0.26286205330961354,
0.9029438446296592
]
],
"annsField": "vector",
"limit": 3,
"outputFields": [
"color"
]
}'
Response code.
A list of entity objects.
An entity object.
Returns an error message.
Response code.
Error message.
{
"code": 0,
"data": [
{
"color": "orange_6781",
"distance": 1,
"id": 448300048035776800
},
{
"color": "red_4794",
"distance": 0.9353201,
"id": 448300048035776800
},
{
"color": "grey_8510",
"distance": 0.7733054,
"id": 448300048035776800
}
]
}