Skip to main content

Delete

Deletes vectors from a Pinecone index by ID, metadata filter, or deletes all vectors in a namespace. This operation is permanent and cannot be undone.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Connection Id - Connection identifier from Connect node (optional if API Key credential is provided directly).
  • Host URL - Your index's host URL. Format: https://INDEX_NAME-PROJECT_ID.svc.ENVIRONMENT.pinecone.io. You can find this in your Pinecone console.

Options

  • API Key - Pinecone API key credential (optional - use this instead of Connection Id if not using Connect node).
  • Ids - Array of vector IDs to delete. You can add multiple ID fields. Optional if using Filter or Delete All.
  • Filter - Metadata filter object to select vectors for deletion. Only vectors matching the filter will be deleted. Optional if using Ids or Delete All.
  • Delete All - When enabled, deletes all vectors in the specified namespace. Default: false. Use with caution!
  • Name Space - Namespace to delete vectors from. Optional, defaults to the default namespace.

Output

  • Response - Object confirming the delete operation (typically an empty object {}).

How It Works

The Delete node removes vectors from your Pinecone index based on the specified criteria. When executed, the node:

  1. Validates required inputs (Host URL)
  2. Constructs the delete request with one of three deletion methods:
    • By IDs: Deletes specific vectors
    • By Filter: Deletes vectors matching metadata criteria
    • Delete All: Removes all vectors in the namespace
  3. Sends a POST request to the index's /vectors/delete endpoint
  4. Returns a confirmation response
warning

Delete operations are permanent and cannot be undone. Always verify your deletion criteria before executing, especially when using Delete All or Filter options.

Requirements

  • An existing Pinecone index with data
  • At least one deletion criterion (Ids, Filter, or Delete All)
  • Sufficient permissions to delete vectors

Error Handling

The node will return specific errors in the following cases:

  • ErrInvalidArg - Host URL is empty
  • ErrInvalidArg - Invalid Connection ID or missing API key
  • ErrInternal - Response format is not valid
  • ErrStatus - HTTP error from Pinecone API

Usage Notes

  • You can use Ids, Filter, or Delete All - use any one or combination
  • Deleting non-existent IDs does not cause an error
  • Filter-based deletion is eventually consistent
  • Delete All only affects the specified namespace
  • Deletion is asynchronous - vectors may not disappear immediately
  • Use Describe Index Stats to verify deletion completion

Deletion Methods

1. Delete by IDs

Delete specific vectors when you know their IDs.

// Configure Ids in the Delete node:
// Ids[0]: "doc_123"
// Ids[1]: "doc_456"
// Ids[2]: "doc_789"

2. Delete by Filter

Delete vectors matching metadata criteria.

msg.filter = {
category: "archived",
year: { "$lt": 2020 }
};

3. Delete All

Remove all vectors in a namespace (dangerous!).

Delete All: true
Name Space: "test-namespace"

Best Practices

  • Always test deletion logic in a non-production environment first
  • Use Describe Index Stats to verify deletions
  • For production data, prefer deleting by ID over Delete All
  • Document deletion criteria and reasons
  • Consider soft deletes (metadata flag) instead of hard deletes for important data
  • Use specific namespaces for data that may need bulk deletion
  • Back up important data before large deletion operations

Example: Delete Specific Vectors by ID

// In Delete node configuration:
// Ids[0]: "outdated_doc_1"
// Ids[1]: "outdated_doc_2"
// Ids[2]: "outdated_doc_3"

// After deletion
console.log("Deleted 3 vectors by ID");

// Verify deletion
// Use Describe Index Stats or Query to confirm

Example: Delete Old Content by Filter

// Delete articles older than 1 year
const oneYearAgo = new Date();
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1);

msg.filter = {
content_type: "article",
published_date: {
"$lt": oneYearAgo.toISOString()
}
};

// After Delete node executes
console.log("Deleted old articles");

Example: Delete by Category

// Remove all test data
msg.filter = {
category: "test",
environment: "staging"
};

msg.namespace = "test-data";

// After deletion
console.log("Test data cleaned up");

Example: Delete Inactive Users

// Delete vectors for users who haven't logged in for 90 days
const ninetyDaysAgo = new Date();
ninetyDaysAgo.setDate(ninetyDaysAgo.getDate() - 90);

msg.filter = {
last_login: {
"$lt": ninetyDaysAgo.toISOString()
},
status: "inactive"
};

msg.namespace = "user-embeddings";

Example: Clean Up Namespace

// Delete all vectors in a test namespace
// WARNING: This is permanent!

// In Delete node:
// Delete All: true
// Name Space: "temporary-test"

console.log("⚠ All vectors in 'temporary-test' namespace deleted");

Example: Conditional Deletion Based on Score

// Step 1: Query for low-quality vectors
msg.vector = someReferenceVector;
msg.topK = 100;

// After Query executes
const lowQualityIds = msg.resQuery.matches
.filter(match => match.score < 0.5)
.map(match => match.id);

console.log(`Found ${lowQualityIds.length} low-quality vectors`);

// Step 2: Configure Delete node with these IDs
// You would need to set these IDs in the Delete node configuration

Example: Batch Delete with Verification

// Before deletion - get count
// Run Describe Index Stats
const beforeCount = msg.resDescribeIndexStats.totalVectorCount;

// Configure deletion filter
msg.filter = {
marked_for_deletion: true
};

// After Delete executes
console.log("Deletion complete");

// Verify - run Describe Index Stats again
const afterCount = msg.resDescribeIndexStats.totalVectorCount;
const deleted = beforeCount - afterCount;

console.log(`Deleted ${deleted} vectors`);

Example: Delete by Multiple Criteria

// Delete vectors matching multiple conditions
msg.filter = {
"$and": [
{ category: "temporary" },
{ created_date: { "$lt": "2024-01-01" } },
{ status: { "$in": ["draft", "archived"] } }
]
};

console.log("Deleting vectors matching all criteria");

Example: Safe Deletion with Confirmation

// Check what will be deleted first
// Step 1: Query with the filter to see what matches
msg.filter = {
category: "old-products"
};

// Use Query or Describe Index Stats with filter first
// After seeing the count/results, proceed with deletion

const stats = msg.resDescribeIndexStats;
const countToDelete = stats.totalVectorCount;

if (countToDelete > 1000) {
console.warn(`⚠ About to delete ${countToDelete} vectors - confirm this is expected`);
// Add manual confirmation step or throw error
} else {
console.log(`Proceeding to delete ${countToDelete} vectors`);
// Proceed with Delete node
}

Example: Delete and Re-index

// Delete outdated product embeddings
const productIds = msg.outdatedProducts.map(p => p.id);

// Configure Delete node with these IDs

// After deletion
console.log(`Deleted ${productIds.length} outdated products`);

// Now upsert new embeddings
const newEmbeddings = await generateEmbeddings(msg.updatedProducts);
msg.ids = msg.updatedProducts.map(p => p.id);
msg.values = newEmbeddings;
msg.metadatas = msg.updatedProducts.map(p => p.metadata);

// Proceed to Upsert node

Example: Namespace Cleanup Workflow

// Clean up all temporary namespaces
const tempNamespaces = ["temp-1", "temp-2", "temp-3"];

for (const namespace of tempNamespaces) {
// Configure Delete node:
// Delete All: true
// Name Space: namespace

console.log(`Cleaning namespace: ${namespace}`);

// Execute Delete node for each namespace
// Add delay between deletions if needed
}

Example: Selective Field-Based Deletion

// Delete vectors missing required metadata
msg.filter = {
"$or": [
{ description: { "$exists": false } },
{ category: null },
{ title: "" }
]
};

console.log("Deleting vectors with incomplete metadata");

Monitoring Deletion

// Before deletion
const beforeStats = msg.resDescribeIndexStats;
const beforeNamespaceCount = beforeStats.namespaces[msg.targetNamespace]?.vectorCount || 0;

console.log(`Before: ${beforeNamespaceCount} vectors in namespace`);

// Configure and execute Delete node

// Wait a few seconds for eventual consistency
// Then check stats again

const afterStats = msg.resDescribeIndexStats;
const afterNamespaceCount = afterStats.namespaces[msg.targetNamespace]?.vectorCount || 0;

const deleted = beforeNamespaceCount - afterNamespaceCount;
console.log(`Deleted: ${deleted} vectors`);
console.log(`Remaining: ${afterNamespaceCount} vectors`);

Troubleshooting

Vectors not deleted immediately

  • Deletion is asynchronous and eventually consistent
  • Wait 1-2 seconds and check again with Describe Index Stats
  • For critical operations, add a delay after deletion

Delete All doesn't work

  • Ensure "Delete All" option is set to true
  • Check that the namespace is correct
  • Verify Host URL is correct

Filter-based deletion not working as expected

  • Verify filter syntax is correct
  • Check that metadata fields exist on vectors
  • Test filter with Query first to see what matches
  • Metadata values are case-sensitive

Error: "No vectors deleted"

  • This is not an error - no vectors matched the criteria
  • Verify IDs exist in the index
  • Check filter criteria
  • Confirm you're in the correct namespace

Deleted wrong vectors

  • Unfortunately, this cannot be undone
  • Restore from backup if available
  • Re-upsert data from source if possible
  • This is why testing deletion criteria is critical

Partial deletion occurred

  • Some IDs existed, others didn't
  • Filter matched only some vectors
  • Check which vectors were deleted using Describe Index Stats
  • Review deletion criteria

Performance issues with large deletions

  • Delete in smaller batches
  • Use filter-based deletion for bulk operations
  • Consider recreating the index if deleting over 80% of data
  • Monitor index fullness during large deletions