[BUG] Pinecone search by id is returning incorrect result




The search result by vector id gives incorrect result. In most cases the desired vector is not even in the top 10.

Created an issue at [Bug] Pinecone vector search by id returns incorrect vectors. · Issue #346 · pinecone-io/pinecone-python-client · GitHub

@ayan.s,

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

@ZacharyProser Thanks for pointing to the documentation. That was really helpful. I want to suggest a few things here

  • When a user is querying vector by an ID it is expected behaviour to get that particular vector as the first hit and then the nearest neighbours as other hits. Stating that this limitation can be fixed by using fetch seems like an excuse to avoid a possible elegant implementation.
  • On the UI is it possible to do a a fetch ? If not why not show the fetch the vector id and show the result first and then show the result of ANN search?
  • 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 actually exists, you should have the ID in the results. Otherwise the product design is not consistent.

These maybe minor issues, and maynot be relevant for pinecone as a product. But these issues dictate if services like pinecone can be used in production or not.

Thanks,
Ayan