Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when insert vectors with the same id, milvus won't check duplicate IDs and store them all. #464

Open
zhudd-hub opened this issue Mar 22, 2021 · 3 comments

Comments

@zhudd-hub
Copy link

zhudd-hub commented Mar 22, 2021

向milvus插入特征向量,指定特征的ID,将该特征重复多次插入,然后创建index,然后search,发现top K结果严重不全
A clear and concise description of what the bug is.

完整的实验代码如下

param = {'collection_name': 'test','dimension': 512}
milvus.create_collection(param)
feats=[[random.random() for _ in range(512)] for _ in range(2)]
for _ in range(4):
    status, ids = milvus.insert(collection_name=collection_name, records=feats, ids=[1,9])
    print(status)
param = {'collection_name': 'test','query_records': feats[0:1],'top_k': 4,'params': {}}
status, results = milvus.search(**param)
print(status)
results

————————————————————
代码输出:

Status(code=0, message='Add vectors successfully!')
Status(code=0, message='Add vectors successfully!')
Status(code=0, message='Add vectors successfully!')
Status(code=0, message='Add vectors successfully!')

[
[
(id:1, distance:0.0),
(id:1, distance:0.0),
(id:1, distance:0.0),
(id:1, distance:0.0)
]
]

期待只输出两个结果,其ID分别为1和9

@BossZou
Copy link
Contributor

BossZou commented Mar 24, 2021

@zhudd-hub , the duplicate ID check is not supported currently, so if user want to specify ID during inserting, they should make sure ID is unique.

@XuanYang-cn XuanYang-cn changed the title [BUG]重复插入同一特征,milvus库没有去重 when insert vectors with the same id, milvus won't check duplicate IDs and store them all. Apr 14, 2021
@keotic
Copy link

keotic commented Apr 22, 2021

What about the same id to different partitions on the same collection?

@XuanYang-cn
Copy link
Contributor

@keotic Looks ok to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants