milvus-logo
LFAI
< Docs
  • RESTful
    • v2

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

    ParameterDescription
    Request-Timeoutinteger
    The timeout duration for this operation.
    Setting this to None indicates that this operation timeouts when any response arrives or any error occurs.
    Authorizationstring
    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": []
}
ParameterDescription
dbNamestring
The name of the database.
collectionName *string
The name of the collection to which this operation applies.
dataarray
A list of vector embeddings.
MilvusZilliz Cloud searches for the most similar vector embeddings to the specified ones.
data[]number
A vector embedding
annsField *string
The name of the vector field.
filterstring
The filter used to find matches for the search.
limitinteger
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.
offsetinteger
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.
groupingFieldstring
The name of the field that serves as the aggregation criteria.
outputFieldsarray
An array of fields to return along with the search results.
outputFields[]string
A field name
searchParamsobject
The parameter settings specific to this operation.
searchParams.metricTypestring
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.paramsobject
Extra search parameters.
searchParams.params.radiusinteger
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_filterinteger
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.
partitionNamesarray
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.

PropertyDescription
codeinteger
Indicates whether the request succeeds.
  • 200: The request succeeds.
  • Others: Some error occurs.
dataarray
data[]object
messagestring
Indicates the possible reason for the reported error.
Feedback

Was this page helpful?