Search
POST
http://${MILVUS_URI}/v2/vectordb/entities/search
This operation conducts a vector similarity search with an optional scalar filtering expression.
Example
export MILVUS_URI="localhost:19530"
curl --location --request POST "http://${MILVUS_URI}/v2/vectordb/entities/search" \
--header "Content-Type: application/json" \
--data-raw '{
"collectionName": "quick_setup",
"data": [
[0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592]
],
"annsField": "vector",
"limit": 3,
"outputFields": [
"color"
]
}'
Possible response is similar to the following .
{
"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
}
]
}
Request
Parameters
Header parameters
Parameter Description Request-Timeout
integer
The timeout duration for this operation.
Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.Authorization
string
The authentication token.No query parameters required
No path parameters required
Request Body
{
"dbName": "string",
"collectionName": "string",
"data": [],
"annsField": "string",
"filter": "string",
"limit": "integer",
"offset": "integer",
"groupingField": "string",
"outputFields": [],
"searchParams": {
"metricType": "string",
"params": {
"radius": "integer",
"range_filter": "integer"
}
},
"partitionNames": []
}
Parameter | Description |
---|---|
dbName | string The name of the database. |
collectionName * | string The name of the collection to which this operation applies. |
data | array A list of vector embeddings. |
data[] | number A vector embedding |
annsField * | string The name of the vector field. |
filter | string The filter used to find matches for the search. |
limit | integer The total number of entities to return. You can use this parameter in combination with offset in param to enable pagination. The sum of this value and offset in param should be less than 16,384. |
offset | integer The number of records to skip in the search result. You can use this parameter in combination with limit to enable pagination. The sum of this value and limit should be less than 16,384. |
groupingField | string The name of the field that serves as the aggregation criteria. |
outputFields | array An array of fields to return along with the search results. |
outputFields[] | string A field name |
searchParams | object The parameter settings specific to this operation. |
searchParams.metricType | string The name of the metric type that applies to the current search. The value should be the same as the metric type of the target collection. The value defaults to COSINE |
searchParams.params | object Extra search parameters. |
searchParams.params.radius | integer Determines the threshold of least similarity. When setting metric_type to L2, ensure that this value is greater than that of range_filter. Otherwise, this value should be lower than that of range_filter. |
searchParams.params.range_filter | integer Refines the search to vectors within a specific similarity range. When setting metric_type to IP or COSINE, ensure that this value is greater than that of radius. Otherwise, this value should be lower than that of radius. |
partitionNames | array The name of the partitions to which this operation applies. |
partitionNames[] | string PartitionName |
Response
Returns the search results.
Response Bodies
- Response body if we process your request successfully
{
"code": "integer",
"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.
Property | Description |
---|---|
code | integer Indicates whether the request succeeds.
|
data | array |
data[] | object |
message | string Indicates the possible reason for the reported error. |