milvus-logo
LFAI
< Docs
  • RESTful
    • v1

Query

Conducts a vector query in a collection.

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

Example

Query entities that meet specific conditions:

export MILVUS_URI="http://localhost:19530"


curl --request POST \
     --url "${MILVUS_URI}/v1/vector/query" \
     --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
     }'

Request

Parameters

  • No query parameters required

  • No path parameters required

Request Body

{
    "collectionName": "string",
    "dbName": "string",
    "filter": "string",
    "limit": "integer",
    "offset": "integer",
    "outputFields": []
}
ParameterDescription
dbNamestring
The name of the database.
collectionNamestring(required)
The name of the collection to which this operation applies.
filterstring(required)
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 maximum value is 16384.
outputFieldsarray
An array of fields to return along with the search results.

Response

Returns the search results.

Response Bodies

  • Response body if we process your request successfully
{
    "code": 200,
    "data": {}
}
  • Response body if we failed to process your request
{
    "code": integer,
    "message": string
}

Properties

The properties in the returned response are listed in the following table.

PropertyDescription
codeinteger
Indicates whether the request succeeds.
  • 200: The request succeeds.
  • Others: Some error occurs.
dataarray
A data array of objects.
messagestring
Indicates the possible reason for the reported error.

Possible Errors

Error CodeDescription
800database not found
1800user hasn't authenticate
1801can only accept json format request
1802missing required parameters
1805fail to parse search result