> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Delete

## Method

The `delete` method allows you to remove vectors from the index based on their identifiers.
The command accepts the following parameters:

* `ids`: A list of identifiers of vectors to be deleted.
* `prefix`: A string prefix to match vector IDs. All vectors with IDs that start with this prefix will be deleted.
* `filter`: A metadata filter to match vectors to be deleted.

<Note>Only one of `ids`, `prefix`, or `filter` can be provided.</Note>

It returns the following field in response:

* `deleted`: An integer indicating how many vectors were deleted with the command.

## Delete Example

```python theme={"system"}
from upstash_vector import Index

index = Index.from_env()

# Specify the identifiers of vectors to be deleted
ids_to_delete = ["id1", "id2", "id3"]

# Delete the specified vectors
delete_result = index.delete(ids=ids_to_delete)

# Display the number of vectors deleted
print("Number of Vectors Deleted:", delete_result.deleted)
```

Alternatively, you can delete a singular vector:

```python theme={"system"}
index.delete("id-4")
```

Also, you can specify a namespace to operate on. When no namespace
is provided, the default namespace will be used.

```python theme={"system"}
index.delete("id-4", namespace="ns")
```

## Delete with metadata filter

This will delete all vectors with metadata that matches the provided filter. For more information, see [Metadata Filtering](/vector/features/filtering).

```python theme={"system"}
index.delete(filter="age > 30")
```

## Delete with id prefix

This will delete all vectors with IDs that start with the prefix.

```python theme={"system"}
index.delete(prefix="id-")
```
