Retrieve unique list of options for a specific metadata field

Hiya - is there a way to retrieve all metadata for a specific metadata field?
For example if I have a “company name” field attached as metadata for all my vectors, to use a query to return the unique company names. This is so I can have a dropdown filter in an app to filter my metadata when querying Pinecone.

I am using the python client.

Thanks,
Nassim

Yes, you can retrieve all metadata for a specific metadata field by using the describe_index_stats operation with a filter object. You can specify the metadata field you want to filter by in the filter object. This operation returns statistics about the index, including the metadata values for the specified field. You can find more information about this operation and how to use it in the Pinecone documentation here: docs.pinecone.io/docs/release-notes#july-26-2022. Additionally, you can learn more about querying Pinecone’s vector database with metadata filters in the documentation here: docs.pinecone.io/docs/query-data.

FYI: This is a reply generated by the bot I built using pinecone & OpenAI that has knowledge of pinecone’s docs! You can try it out here

Has anyone been successful at this? If so, is there example python code you share on how to do it. If I supply a filter to the describe_index_stats method, I get the same result as if I didn’t supply it at all. Thanks for any help.

What would the filter object look like? Can you give us an example?