Skip to main content

Query

Conducts a query on scalar fields in a collection.

POST
/v1/vector/query
Cluster Endpoint

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

https://${CLUSTER_ENDPOINT}

📘Notes
  • 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=""
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.

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.

[]partitionNamesstring

PartitionName

filterstringrequired

The filter used to find matches for the query.

limitinteger

The maximum number of entities to return.
The sum of this value and that of offset should be less than 16384.

Value Range: ≥ 1≤ 16384
offsetinteger

The number of entities to skip in the search results.
The sum of this value and that of limit should be less than 16384.

Value Range: 0≤ 16384
outputFieldsarray

An array of fields to return along with the search results. When setting this to count(*), you need to set limit to 0 to get the total count of the entities that match the filter.

[]outputFieldsstring

An output field name.

export TOKEN="db_admin:xxxxxxxxxxxxx"

curl --request POST \
--url "${CLUSTER_ENDPOINT}/v1/vector/query" \
--header "Authorization: Bearer ${TOKEN}" \
--header "Content-Type: application/json" \
-d '{
"collectionName": "medium_articles",
"outputFields": [
"id",
"title",
"link"
],
"filter": "id in [443300716234671427, 443300716234671426]",
"limit": 100,
"offset": 0
}'
Responses200 - application/json
codeinteger

Response code.

dataarray

Response payload which is an array of objects that contain the specified output fields and their corresponding values.

[]dataobject

Response payload which is an object that contains the specified output fields and their corresponding values.

Returns an error message.

codeinteger

Response code.

messagestring

Error message.

{
"code": 200,
"data": [
{
"color": "red_7025",
"id": 1
},
{
"color": "red_4794",
"id": 4
},
{
"color": "red_9392",
"id": 6
}
]
}