Does Pinecone support removing one namespace as a whole?

Hi Pinecone experts,

I am now evaluating a mechanism that using index for an embedding space, and uses namespace for each specific embedding version, per our logic we only need to keep the last 7 days’ versions, so I am wondering if there is any API to delete the old versions, aka. older namespaces.

I checked the APIs it seems that I can only delete embeddings by Ids or delete the whole index and deleting a namespace is not yet supported.
Delete (pinecone.io)

Hi zhenglaizhang,

The API of delete supports deleting a whole namespace. It is done by using delete_all flag.
e.g. calling index.delete(delete_all=True, namespace="example") will delete all vectors inside “example” namespace and only them.

EDIT: Fixed a syntax issue :slight_smile:

2 Likes

This is great, is the delete call async? How can we check the deletion progress and completion?

Yes, the delete call is async.
You can check the completion of namespace deletion by polling the describe_index_stats API call until its response doesn’t contain the deleted namespace.

1 Like

Sad it’s not available on Starter plan. That means we can’t delete data.

1 Like

Hi @ssimarpreet11
The deleteAll functionality is currently unavailable due to some ongoing behind-the-scene changes, but it will be reintroduced soon.
In the meantime, you can try deleting and re-creating the index to achieve the same effect.
Let me know if the workaround works for you.
Thanks
Ben

This is a critical piece of functionality for a system we are building. Can you provide some info on when this functionality will be available again? I don’t see any mention of this not working in the API docs.

1 Like

Is the option to delete individual namespaces going to come back? I also need this functionality without deleting an entire index and rebuilding.

Its a dev/test setup so want to keep cycling through namespaces as required

Thanks

1 Like

Hi, @hiranya911 @semuify

The delete_all function, which allows for the deletion of an entire namespace, is available even on the Starter plan. As far as I know, this function has never been temporarily disabled.

Have you confirmed that this function is not working as expected? I just tested it and the delete_all function is working without any issues. If you’re just performing a simple check using HTTP, it should take about a minute.

This does indeed seem to work as expected in testing. I was thrown off by this comment earlier:

The deleteAll functionality is currently unavailable due to some ongoing behind-the-scene changes, but it will be reintroduced soon.

Whatever this was, it seems to be resolved now.

I am trying this in the pinecone-client python library and it doesn’t seem to work.

 pinecone.init(api_key='1234', environment='some_region')
 index = pinecone.Index(index_name=index_name)
 try: 
        delete_response = index.delete(namespace=namespace , delete_all = True)

‘delete_response’ is always empty. I am trying to verify if deletion is working using index.describe_index_stats() and it doesn’t seem to have changed. I am currently on the starter plan.

Not sure whats going wrong here, any help is appreciated!

1 Like

This works for me on a paid plan. But interesting to note, if you specify the project name in the init call, the delete throws an error. Seems like a bug.

Circling back to this one: index.delete() returns an empty result if no errors exist, so the behavior described is accurate. If you want to confirm that the deletion has completed, you should run index.describe_index_stats().

But keep in mind that the deletes are happening behind the scenes so the numbers may not reflect in the output for describe_index_stats() immediately. It can take a couple of minutes on very large indexes (billions of vectors) for the work to complete.