栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python开发milvus2.0.2开发,快速上手,参考文档、手册、案例

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python开发milvus2.0.2开发,快速上手,参考文档、手册、案例

参考文档

开发案例:
https://gitee.com/AI-Mart/pymilvus/blob/master/examples/hello_milvus.py
https://github.com/milvus-io/pymilvus/blob/master/examples/hello_milvus.py
参考指南:
https://milvus.io/docs/v2.0.x/manage_connection.md
python开发api文档:
https://milvus.io/api-reference/pymilvus/v2.0.2/About.md

代码记录 1、创建集合
hello_milvus = Collection("hello_milvus", schema, consistency_level="Strong")
注意1
Milvus supports setting consistency level while creating a collection (only on PyMilvus currently). In this example, the consistency level of the collection is set as "Strong", meaning Milvus will read the most updated data view at the exact time point when a search or query request comes. By default, a collection created without specifying the consistency level is set with bounded consistency level, under which Milvus reads a less updated data view (usually several seconds earlier) when a search or query request comes. Besides collection creation, you can also set the consistency level specifically for search or query (only on PyMilvus currently). For other consistency level supported by Milvus, see Guarantee Timestamp in Search Requests.
注意2
The collection to create must contain a primary key field and a vector field. INT64 is the only supported data type for the primary key field in current release of Milvus.
2、 创建索引
# 4. create index
print(fmt.format("Start Creating index IVF_FLAT"))
index = {
    "index_type": "IVF_FLAT",
    "metric_type": "L2",
    "params": {"nlist": 128},
}

hello_milvus.create_index("embeddings", index)
注意1
# We are going to create an IVF_FLAT index for hello_milvus collection.
# create_index() can only be applied to `FloatVector` and `BinaryVector` fields.

Vector indexes are an organizational unit of metadata used to accelerate vector similarity search. Without index built on vectors, Milvus will perform a brute-force search by default
注意2
Current release of Milvus only supports index on vector field. Future releases will support index on scalar field.
By default, Milvus does not index a segment with less than 1,024 rows. To change this parameter, configure rootCoord.minSegmentSizeToEnableIndex in milvus.yaml.
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/859287.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号