Documentation Index Fetch the complete documentation index at: https://docs.cyborg.co/llms.txt
Use this file to discover all available pages before exploring further.
Removes vectors from the index by their IDs. This operation permanently deletes the specified vectors and their associated data.
async delete ({
ids: string []
}): Promise < DeleteResponse >
Parameters
Parameter Type Description idsstring[]Array of vector IDs to delete from the index
Exceptions
Throws if the API request fails due to network connectivity issues.
Throws if authentication fails (invalid API key).
Throws if the encryption key is invalid for the specified index.
Throws if there are internal server errors preventing the deletion.
Throws if the ids parameter is null, undefined, or empty.
Throws if any of the provided IDs are invalid format.
Returns
Promise<DeleteResponse>: A Promise that resolves to a response object containing the operation status, message, and count of deleted vectors. See the DeleteResponse type for more details.
Example Usage
import { Client , DeleteResponse } from 'cyborgdb' ;
const client = new Client ({ baseUrl: 'http://localhost:8000' , apiKey: 'your-api-key' });
// Load an existing index
const indexKey = new Uint8Array ( Buffer . from ( 'your-stored-hex-key' , 'hex' ));
const index = await client . loadIndex ({ indexName: 'my-vector-index' , indexKey });
// Add some vectors first
await index . upsert ({
items: [
{ id: 'doc1' , vector: [ 0.1 , 0.2 , 0.3 ], metadata: { title: 'Document 1' } },
{ id: 'doc2' , vector: [ 0.4 , 0.5 , 0.6 ], metadata: { title: 'Document 2' } },
{ id: 'doc3' , vector: [ 0.7 , 0.8 , 0.9 ], metadata: { title: 'Document 3' } }
]
});
// Delete specific vectors
try {
const result : DeleteResponse = await index . delete ({ ids: [ 'doc1' , 'doc2' ] });
console . log ( 'Deletion result:' , result );
console . log ( `Status: ${ result . status } ` );
console . log ( `Deleted count: ${ result . deletedCount } ` );
// Verify deletion by trying to retrieve
const remaining = await index . get ({ ids: [ 'doc1' , 'doc2' , 'doc3' ] });
console . log ( `Remaining vectors: ${ remaining . length } ` ); // Should be 1 (only doc3)
} catch ( error ) {
console . error ( 'Failed to delete vectors:' , error . message );
}