Search
This operation conducts a vector similarity search with an optional scalar filtering expression.
The base URL for this API is in the following format:
http://localhost:19530
export CLUSTER_ENDPOINT="http://localhost:19530"
The timeout duration for this operation. Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
The authentication token should be a pair of colon-joined username and password, like username:password
.
The name of the database.
The name of the collection to which this operation applies.
A list of vector embeddings. Milvus searches for the most similar vector embeddings to the specified ones.
A vector embedding
The name of the vector field.
The filter used to find matches for the search.
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.
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.
The name of the field that serves as the aggregation criteria.
An array of fields to return along with the search results.
A field name
The parameter settings specific to this operation.
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.
Extra search parameters.
Determines the threshold of least similarity. When setting metrictype to L2, ensure that this value is greater than that of rangefilter. Otherwise, this value should be lower than that of range_filter.
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.
The name of the partitions to which this operation applies. Setting this parameter indicates that the search is within the specified partitions. Otherwise, the search is across all partitions in the collection.
A partition name.
export TOKEN="root:Milvus"
curl --request POST \--url "${CLUSTER_ENDPOINT}/v2/vectordb/entities/search" \--header "Request-Timeout: 0" \--header "Authorization: Bearer ${TOKEN}" \--header "Content-Type: application/json" \-d '{ "collectionName": "quick_setup", "data": [ [ 0.3580376395471989, -0.6023495712049978, 0.18414012509913835, -0.26286205330961354, 0.9029438446296592 ] ], "annsField": "vector", "limit": 3, "outputFields": [ "color" ]}'
Response code.
A list of entity objects.
An entity object.
Returns an error message.
Response code.
Error message.
{ "code": 0, "data": [ { "color": "orange_6781", "distance": 1, "id": 448300048035776800 }, { "color": "red_4794", "distance": 0.9353201, "id": 448300048035776800 }, { "color": "grey_8510", "distance": 0.7733054, "id": 448300048035776800 } ]}