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": []
}
Parameter | Description |
---|---|
collectionName | string The name of the collection to which this operation applies. |
filter | string The filter used to find matches for the search. |
limit | integer 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. |
offset | integer 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. |
outputFields | array An array of fields to return along with the search results. |
outputFields[] | string |
Response
Returns the search results.
Response Body
{
"code": "integer",
"data": [
{}
]
}
Property | Description |
---|---|
code | integer Indicates whether the request succeeds.
|
data | array |
data[] | object |
Error Response
{
"code": integer,
"message": string
}
Property | Description |
---|---|
code | integer Indicates whether the request succeeds.
|
message | string Indicates the possible reason for the reported error. |