Serverless: How to Delete specific records by metadata?

Hi Pinecone Support,

I recently upgraded to the serverless version of Pinecone and encountered an issue with deleting specific vectors. In the free version, I used metadata (UserID and filename) to identify and delete specific vectors, as shown in the following code snippet:

const fileToDelete = user.files.find(file => file.fileid === fileId && file.filename === filename);

// Delete file from Pinecone
const pineconeIndex = pinecone.Index(PINECONE_INDEX_NAME);
const deleteRequest = {
  namespace: PINECONE_NAME_SPACE,
  filter: {
    'userId': { $eq: fileToDelete.userId },
    'filename': { $eq: fileToDelete.filename },
  },
};
await pineconeIndex._delete({ deleteRequest: deleteRequest });

However, I understand from the (Manage RAG documents) that serverless indexes do not support deletion by metadata. Could you please confirm if this is the case? Additionally, I would appreciate any guidance or examples on how to implement record deletion by ID prefix, as suggested in the docs, to achieve similar functionality.

Thank you for your assistance.

Best regards, Robin

1 Like

Hi @rd.intermac, apologies for the late reply!

You are correct that serverless indexes do not support delete by metadata functionality. For a complete list of serverless index limitations, many of which only apply to the ongoing public preview period, please see Limits.

You can find an example of fetching the records by prefix at Fetch all records for a parent document. You can then take the IDs you fetch and Delete specific records by ID.

You may find it helpful to review the List and Delete operations in the API Reference. Let us know if you have any questions!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.