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 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.
The target number of entities to return within each group in a grouping search. For example, setting groupSize=2
instructs the system to return up to 2 of the most similar entities (e.g., document passages or vector representations) within each group. Without setting groupSize
, the system defaults to returning only 1 entity per group.
This Boolean parameter dictates whether groupSize
should be strictly enforced. When groupStrictSize=True
, the system will attempt to fill each group with exactly groupSize
results, as long as sufficient data exists within each group. If there is an insufficient number of entities in a group, it will return only the available entities, ensuring that groups with adequate data meet the specified groupSize
.
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 "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 } ]}