Skip to main content

Query

Conducts a query on scalar fields in a collection.


POST
https://${CLUSTER_ENDPOINT}/v1/vector/query

Example

Notes

You can use either of the following ways to authorize:

  • An API Key with appropriate permissions.
  • A colon-joined username and password of the target cluster. For example, username:p@ssw0rd.

Currently, data of the JSON and Array types are not supported in RESTful API requests..

Query entities that meet specific conditions. For details on how to build filters, refer to Boolean Expression Rules.

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

When setting outputFields to count(\*), you need to set limit to 0 to get the total count of entities that meet the specified conditions.

Request

Parameters

  • No query parameters required

  • No path parameters required

  • No header parameters required

Request Body

{
"collectionName": "string",
"filter": "string",
"limit": "integer",
"offset": "integer",
"outputFields": []
}
ParameterDescription
collectionNamestring
The name of the collection to which this operation applies.
filterstring
The filter used to find matches for the search.
limitinteger
The maximum number of entities to return.
The sum of this value and that of offset should be less than 16384.
The value defaults to 100
The value ranges from 1 to 100.
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.
The value is less than or equal to 16384.
outputFieldsarray
An array of fields to return along with the search results.
outputFields[]string

Response

Returns the search results.

Response Body

{
"code": "integer",
"data": [
{}
]
}
PropertyDescription
codeinteger
Indicates whether the request succeeds.
  • 0: The request succeeds.
  • Others: Some error occurs.
dataarray
data[]object

Error Response

{
"code": integer,
"message": string
}
PropertyDescription
codeinteger
Indicates whether the request succeeds.
  • 0: The request succeeds.
  • Others: Some error occurs.
messagestring
Indicates the possible reason for the reported error.