Delete Index
Permanently deletes a Pinecone index and all its data. This operation 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.
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).
- Environment - Your Pinecone environment (e.g.,
us-east-1-aws,us-west1-gcp,eu-west1-gcp). You can find this in your Pinecone console. - Index Name - Name of the index to delete.
Options
- API Key - Pinecone API key credential (optional - use this instead of Connection Id if not using Connect node).
Output
This node does not return any output variables. Success is indicated by successful execution without errors.
How It Works
The Delete Index node permanently removes a Pinecone index and all its vectors. When executed, the node:
- Validates required inputs (Environment, Index Name)
- Constructs a DELETE request to Pinecone's controller API
- Sends the request to delete the specified index
- Returns success if the deletion is initiated
This operation is PERMANENT and IRREVERSIBLE. All vectors, metadata, and index configuration will be lost forever. There is no way to recover a deleted index.
Requirements
- A valid Pinecone account and API key
- Valid environment identifier
- An existing index to delete
- Appropriate permissions to delete indexes
Error Handling
The node will return specific errors in the following cases:
- ErrInvalidArg - Environment is empty
- ErrInvalidArg - Index Name is empty
- ErrInvalidArg - Invalid Connection ID or missing API key
- ErrStatus - HTTP error from Pinecone API (index not found, permission denied, etc.)
Usage Notes
- Index deletion is permanent and cannot be undone
- All vectors and data in the index are permanently lost
- Pod resources are released and billing stops
- The index name becomes available for reuse after deletion
- Deletion may take a few minutes to complete
- You cannot delete an index that is already being deleted
Best Practices
- Always verify the index name before deletion
- Use List or Describe Indexes to confirm the correct index
- Back up important data before deletion (export vectors if needed)
- Consider deleting all vectors instead of the entire index if you might need it again
- Document why the index is being deleted
- Use this in cleanup workflows for temporary or test indexes
- Never delete production indexes without multiple confirmations
When to Delete an Index
Delete an index when:
- The index is no longer needed
- You're cleaning up test/development indexes
- You need to recreate an index with different configuration
- You're migrating to a different index
- The index contains outdated or incorrect data that needs complete refresh
Alternatives to Deletion
Before deleting, consider:
- Delete all vectors - Keeps the index structure, removes data
- Create a new index - Keep old index for backup
- Namespace isolation - Use namespaces instead of separate indexes
Example: Delete Test Index
// Configure node:
// Environment: us-east-1-aws
// Index Name: test-index-temp
console.log("⚠ Deleting test index permanently");
// After execution
console.log("✓ Test index deleted successfully");
Example: Cleanup Old Indexes
// Step 1: List all indexes
const allIndexes = msg.resListorDescribe;
// Step 2: Identify old test indexes
const testIndexes = allIndexes.filter(name =>
name.startsWith("test-") || name.includes("temp")
);
console.log(`Found ${testIndexes.length} test indexes to clean up`);
// Step 3: Delete each one
for (const indexName of testIndexes) {
console.log(`Deleting ${indexName}...`);
// Configure Delete Index node with:
// Index Name: indexName
console.log(`✓ ${indexName} deleted`);
}
Example: Safe Deletion with Confirmation
const indexToDelete = msg.indexName;
// Step 1: Verify index exists and get info
// Use List or Describe Indexes
const allIndexes = msg.resListorDescribe;
if (!allIndexes.includes(indexToDelete)) {
throw new Error(`Index '${indexToDelete}' does not exist`);
}
// Step 2: Get stats to show what will be lost
// Use Describe Index Stats
const stats = msg.resDescribeIndexStats;
const vectorCount = stats.totalVectorCount;
console.log(`⚠ WARNING: About to delete index '${indexToDelete}'`);
console.log(` - ${vectorCount.toLocaleString()} vectors will be lost`);
console.log(` - This action cannot be undone`);
// Step 3: Require explicit confirmation
if (msg.confirmDelete !== true) {
throw new Error("Deletion not confirmed - set confirmDelete to true");
}
// Step 4: Proceed with deletion
console.log("Proceeding with deletion...");
// Execute Delete Index node
Example: Delete and Recreate Pattern
const indexName = "my-index";
const environment = "us-east-1-aws";
// Step 1: Delete existing index
console.log(`Deleting existing index '${indexName}'...`);
// Execute Delete Index node
// Step 2: Wait for deletion to complete
console.log("Waiting for deletion...");
// Add delay (e.g., 30 seconds)
// Step 3: Create new index with updated configuration
console.log("Creating new index with updated configuration...");
// Execute Create Index node with new settings
console.log("Index recreated successfully");
Example: Conditional Deletion
// Only delete if index is empty or has very few vectors
const stats = msg.resDescribeIndexStats;
const vectorCount = stats.totalVectorCount;
const threshold = 100;
if (vectorCount > threshold) {
console.warn(`⚠ Index has ${vectorCount} vectors - skipping deletion`);
console.log("Manual review required for indexes with significant data");
msg.deletionSkipped = true;
} else {
console.log(`Index has ${vectorCount} vectors - proceeding with deletion`);
// Execute Delete Index node
msg.deletionSkipped = false;
}
Example: Migration Workflow
const oldIndex = "products-v1";
const newIndex = "products-v2";
// Step 1: Create new index
console.log(`Creating new index '${newIndex}'...`);
// Execute Create Index node
// Step 2: Wait for new index to be ready
// Use Describe Index to check status
// Step 3: Copy data from old to new
console.log("Migrating data...");
// Fetch vectors from old index and upsert to new index
// (This would require Query, Fetch, and Upsert operations)
// Step 4: Verify data migration
const oldStats = msg.oldIndexStats;
const newStats = msg.newIndexStats;
if (newStats.totalVectorCount === oldStats.totalVectorCount) {
console.log("✓ Migration verified - counts match");
// Step 5: Delete old index
console.log(`Deleting old index '${oldIndex}'...`);
// Execute Delete Index node
console.log("Migration complete");
} else {
console.error("✗ Migration failed - counts don't match");
throw new Error("Data migration verification failed");
}
Example: Bulk Cleanup with Safety Checks
const indexesToDelete = ["temp-1", "temp-2", "test-data"];
const safePrefixes = ["temp-", "test-"];
// Safety check - only delete if name matches safe patterns
const unsafeIndexes = indexesToDelete.filter(name =>
!safePrefixes.some(prefix => name.startsWith(prefix))
);
if (unsafeIndexes.length > 0) {
throw new Error(`Unsafe index names detected: ${unsafeIndexes.join(", ")}`);
}
// Proceed with deletion
console.log(`Deleting ${indexesToDelete.length} indexes...`);
for (const indexName of indexesToDelete) {
console.log(` - Deleting ${indexName}`);
// Execute Delete Index node
}
console.log("Cleanup complete");
Example: Delete with Backup Export
const indexName = "important-data";
// Step 1: Export all vectors (backup)
console.log("Creating backup...");
// Use Query or Fetch to export all vectors
// Save to file or external storage
const backupData = msg.allVectors;
const backupFile = `backup-${indexName}-${new Date().toISOString()}.json`;
// Save backup (use File System nodes)
console.log(`Backup saved to ${backupFile}`);
// Step 2: Verify backup
if (!backupData || backupData.length === 0) {
throw new Error("Backup failed - no data exported");
}
// Step 3: Delete index
console.log(`Backup complete - proceeding with deletion of '${indexName}'`);
// Execute Delete Index node
console.log("Index deleted - backup available at", backupFile);
Example: Environment-Specific Cleanup
const environments = ["dev", "staging"];
for (const env of environments) {
const environment = `${env}.us-east-1-aws`;
// List indexes in this environment
// Execute List Indexes node
const indexes = msg.resListorDescribe;
console.log(`Found ${indexes.length} indexes in ${env} environment`);
// Delete all indexes in non-production environments
for (const indexName of indexes) {
console.log(` Deleting ${indexName} from ${env}...`);
// Execute Delete Index node
}
}
console.log("Environment cleanup complete");
Monitoring Deletion
const indexName = msg.indexToDelete;
console.log(`Initiating deletion of '${indexName}'...`);
// Execute Delete Index node
console.log("Deletion initiated, verifying...");
// Wait a moment
// Add delay
// Try to list indexes to verify deletion
// Execute List Indexes node
const remainingIndexes = msg.resListorDescribe;
if (remainingIndexes.includes(indexName)) {
console.log("Index still exists - deletion in progress");
} else {
console.log("✓ Index successfully deleted");
}
Troubleshooting
Error: "Index Name cannot be empty"
- Ensure Index Name input is provided
- Check that the variable reference is correct
- Verify the index name string is not empty
Error: "Index not found"
- The index may already be deleted
- Check the index name for typos (case-sensitive)
- Verify you're using the correct environment
- Use List Indexes to see available indexes
Error: "Permission denied"
- Your API key may not have delete permissions
- Check your Pinecone account permissions
- Verify you're using the correct API key
Deletion seems stuck
- Index deletion can take several minutes
- Wait 2-5 minutes before checking again
- Check index status with List/Describe Indexes
- Contact Pinecone support if deletion is stuck for over 10 minutes
Cannot delete production index
- This is a safety feature - ensure you have the right permissions
- Verify this is intentional and documented
- Consider if you really need to delete (alternatives?)
Index name still unavailable after deletion
- Wait a few minutes for deletion to fully complete
- The name reservation may be temporarily cached
- Try again after 5-10 minutes
Accidentally deleted wrong index
- Unfortunately, this cannot be undone
- Restore from backup if available
- Contact Pinecone support immediately (they may have recent backups)
- Recreate index and re-ingest data from source
- This is why pre-deletion verification is critical