Get number of unique values of a metadata field


I’d like to get the number of unique vectors in my Pinecone index but with grouping by a metadata field.
In the other words, get the number of unique values of a metadata field.

Is it possible in Pinecone?

There’s no GROUP BY analog in Pinecone if that’s what you’re trying to do. But there are other options you can explore. One would be to use ID prefixes and the List operation to get the list of all vectors with a given ID prefix. You could then iterate through the paginated results to gather a count of the vectors. Note that List is only available on serverless indexes, not pod-based.

What is it you’re working on? And how would a GROUP BY a metadata field help with that?