24 lines
485 B
Python
24 lines
485 B
Python
|
|
from pymilvus import MilvusClient, Collection
|
||
|
|
|
||
|
|
client = MilvusClient(
|
||
|
|
uri="http://10.1.1.240:19530",
|
||
|
|
token="root:Milvus",
|
||
|
|
db_name="mixi"
|
||
|
|
)
|
||
|
|
|
||
|
|
index_params = client.prepare_index_params()
|
||
|
|
index_params.add_index(
|
||
|
|
field_name="id",
|
||
|
|
index_type="STL_SORT"
|
||
|
|
)
|
||
|
|
index_params.add_index(
|
||
|
|
field_name="vector",
|
||
|
|
index_type="IVF_FLAT",
|
||
|
|
metric_type="L2",
|
||
|
|
params={"nlist": 1024}
|
||
|
|
)
|
||
|
|
client.create_index(
|
||
|
|
collection_name="mixi_outfit",
|
||
|
|
index_params=index_params
|
||
|
|
)
|