import json
import random


MILVUS_HOST = "127.0.0.1"
MILVUS_PORT = "19530"

from pymilvus import (
    connections,
    Collection,
)

# create connect
connections.connect("default", host=MILVUS_HOST, port=MILVUS_PORT)

collection = Collection("todos")

with open("question_vec.json", "r") as f:
    vec = f.read()
    vec = json.loads(vec)

mr = collection.insert([
    [9999 + random.randint(0, 1000)],
    ["test todo.awa.im"],
    ["test title"],
    ["test desc"],
    ["test text"],
    ["zh_CN"],
    [9999 + random.randint(0, 1000)],
    [vec],
])


# get id
print(mr.primary_keys)