kgrag/app_pkg/examples/create_index.py
2026-06-30 13:35:52 +08:00

18 lines
421 B
Python

from pymilvus import Collection, utility, connections, db
conn = connections.connect(host="192.168.1.156", port=19530)
db.using_database("sample_db")
index_params = {
"metric_type": "IP",
"index_type": "IVF_FLAT",
"params": {"nlist": 1024}
}
collection = Collection("word_vector")
collection.create_index(
field_name="embeding",
index_params=index_params
)
utility.index_building_progress("word_vector")