

# 从向量索引中删除向量


您可以使用 [DeleteVectors](https://docs.amazonaws.cn/AmazonS3/latest/API/API_S3VectorBuckets_DeleteVectors.html) API 指定向量索引中的特定向量的向量键，从而删除这些向量。此操作可用于移除过时或不正确的数据，同时保留其余的向量数据。

## 使用 Amazon CLI


要删除向量索引，请使用以下示例命令。将*用户输入占位符*替换为您自己的信息。

```
aws s3vectors delete-vectors \
 --vector-bucket-name "amzn-s3-demo-vector-bucket" \
 --index-name "idx" \
 --keys '["vec2","vec3"]'
```

## 使用 Amazon SDK


------
#### [ SDK for Python ]

```
import boto3

# Create a S3 Vectors client in the AWS Region of your choice. 
s3vectors = boto3.client("s3vectors", region_name="us-west-2")

#Delete vectors in a vector index
response = s3vectors.delete_vectors(
    vectorBucketName="media-embeddings",
    indexName="movies",
    keys=["Star Wars", "Finding Nemo"])
```

------