milvus-logo
LFAI
< Docs
  • RESTful
    • v2

Hybrid Search

POST
http://${MILVUS_URI}/v2/vectordb/entities/hybrid_search

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": 0,
    "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",
    "partitionNames": [],
    "search": [
        {
            "data": [],
            "annsField": "string",
            "filter": "string",
            "groupingField": "string",
            "metricType": "string",
            "limit": "integer",
            "offset": "integer",
            "ignoreGrowing": "boolean",
            "params": {
                "radius": "integer",
                "range_filter": "integer"
            }
        }
    ],
    "rerank": "string",
    "limit": "integer",
    "outputFields": []
}
ParameterDescription
dbNamestring
The name of the database.
collectionName *string
The name of the collection to which this operation applies.
partitionNamesarray
The name of the partitions to which this operation applies.
partitionNames[]string
PartitionName
searcharray
search[]object
The parameter settings specific to this operation.
search[][].dataarray
A list of vector embeddings.MilvusZilliz Cloud searches for the most similar vector embeddings to the specified ones.
search[][].data[]number
A vector embedding
search[].annsFieldstring
search[].filterstring
search[].groupingFieldstring
search[].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
search[].limitinteger
search[].offsetinteger
search[].ignoreGrowingboolean
search[].paramsobject
Extra search parameters.
search[].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.
search[].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.
rerank *string
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.
outputFieldsarray
An array of fields to return along with the search results.
outputFields[]string
A field name

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.
messagestring
Indicates the possible reason for the reported error.
dataarray
data[]object