Search
Conducts a similarity search on the vector field in a collection.
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, refer to Zilliz Cloud Console or use the Describe Cluster 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.
The name of the partitions to which this operation applies. Setting this parameter indicates that the search scope should be limited to the specified partitions. If not specified, the search scope is the entire collection.
partitionName
The filter used to find matches for the search
The maximum number of entities to return.
The sum of this value of that of offset
should be less than 16,384.
The number of entities to skip in the search results.
The sum of this value and that of limit
should not be greater than 16,384.
An array of fields to return along with the search results.
An output field name.
The query vector in the form of a list of floating numbers. The length of the query vector should match the dimension of the vector field in the collection.
A floating number representing one of the dimensions of the vector to search for.
List of search parameters
The angle where the vector with the least similarity resides.
Used in combination to filter vector field values whose similarity to the query vector falls into a specific range.
export TOKEN="db_admin:xxxxxxxxxxxxx"
curl --request POST \
--url "${CLUSTER_ENDPOINT}/v1/vector/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.
Response payload that carries the search results.
Search results. By default, each entity object carries the id
and distance
fields. If outputFields
is specified, the entity object also carries the specified fields.
The ID of the entity.
The similarity score of the entity to the query vector.
Returns an error message.
Response code.
Error message.
{
"code": 200,
"data": [
{
"color": "pink_8682",
"distance": 1,
"id": 0
},
{
"color": "red_7025",
"distance": 0.6290165,
"id": 1
},
{
"color": "red_4794",
"distance": 0.5975797,
"id": 4
}
]
}