You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Pinecone vector search by id returns incorrect vectors. #346
I believe this is a new bug in the Pinecone Python Client
I have searched the existing issues, and I could not find an existing issue for this bug
Current Behavior
If you query pinecone index with a vector ID with topk=1, the returned vectors sometimes have different id. If you keep top_k > 1, sometimes the correct vector is found in positions k>1.
Expected Behavior
If I search using vector id, the whole point is to get the vector whose id matches the query. Then find other vectors with high similarity scores.
@zackproser Thanks for pointing to the documentation. That was really helpful. I want to suggest two things here
When a user is querying vector by an ID it is expected behaviour to get that particulat vector as the first hit and then the nearestest neighbours as other hits.
If I search by an ID that doesn't exist in the database, we get the response that the ID doesn't exists. That indicates, when you search by an ID that exixts, you should have the ID in the results. Otherwise the product design is not consistent.
When a user is querying vector by an ID it is expected behaviour to get that particulat vector as the first hit and then the nearestest neighbours as other hits.
I think @ayansengupta17 is right, it should be the first hit when query with the ID. Below is what I'm using in another vector database, it return the ID in first hit as I expected
Activity
zackproser commentedon May 14, 2024
Hi @ayansengupta17,
Thank you for your post, and thank you for taking the time to get screenshots and file an issue on GitHub.
I’ve discussed this with the relevant teams to double-check, but this is actually not a bug!
Please see our guide on the Limitations of querying by ID to understand why this is happening.
If you want to ensure your results contain the vector you’re requesting by ID, you can use fetch instead, as outlined here.
I hope this helps!
Best,
Zack
ayansengupta17 commentedon May 15, 2024
@zackproser Thanks for pointing to the documentation. That was really helpful. I want to suggest two things here
likid1412 commentedon May 29, 2024
I think @ayansengupta17 is right, it should be the first hit when query with the ID. Below is what I'm using in another vector database, it return the ID in first hit as I expected
ref: 向量数据库 基于 Doc ID 相似度检索-SDK 参考-文档中心-腾讯云
fix(tooling): smoke cleanup iterates the index Paginator instead of r…
test(db_data): prove the 2026-07 SDK still serves legacy indexes (pin…