milvus的批量向量搜索

批量向量搜索允许在单个请求中进行多个向量相似性搜索。这种类型的搜索非常适合需要为一组查询向量查找相似向量的场景,可显著减少所需的时间和计算资源。

即:一次查询多个向量,吞吐。

系统会并行处理这些向量,为每个查询向量返回一个单独的结果集,每个结果集包含在collection中找到的最接近的匹配项。

import random
from pymilvus import (
    connections,
    Collection,
)

dim = 3

if __name__ == '__main__':
    connections.connect(
        alias="default",
        user='',
        password='',
        host='192.168.230.71',
        port='19530'
    )

    coll = Collection("hello_milvus")

    search_param = {
        "metric_type": "COSINE",
        "params": {"ef": 40}
    }
    search_data = [[0.20963513851165771,0.3974665701389313,0.12019053101539612],
                   [0.6947491765022278, 0.9535574913024902, 0.5454552173614502]]
    results = coll.search(
        data=search_data,
        anns_field="embeddings",
        param=search_param,
        limit=5,
        # expr=None,
        output_fields=['pk'],
        # consistency_level="Eventually"
    )
    print(results)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

shulu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值