Removes vectors from the index by their IDs. This operation permanently deletes the specified vectors and their associated data.
func (e *EncryptedIndex) Delete(ctx context.Context, ids []string) error

Parameters

ParameterTypeDescription
ctxcontext.ContextContext for cancellation and timeouts
ids[]stringSlice of vector IDs to delete

Error Handling

Example Usage

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/cyborginc/cyborgdb-go"
)

func main() {
    client, err := cyborgdb.NewClient(cyborgdb.ClientConfig{
        BaseURL: "http://localhost:8000",
        APIKey:  "your-api-key",
    })
    if err != nil {
        log.Fatal(err)
    }

    // Load an existing index
    indexKey := "your-64-character-hex-key"
    index, err := client.LoadIndex(context.Background(), cyborgdb.LoadIndexParams{
        IndexName: "my-vector-index",
        IndexKey:  indexKey,
    })
    if err != nil {
        log.Fatal(err)
    }

    // Delete specific vectors by ID
    ids := []string{"doc1", "doc2", "doc3"}
    
    err = index.Delete(context.Background(), ids)
    if err != nil {
        log.Fatalf("Delete failed: %v", err)
    }

    fmt.Printf("Successfully deleted %d vectors\n", len(ids))
}