

# 删除向量索引
<a name="s3-vectors-index-delete"></a>

如果不再需要向量索引，可以将其删除。此操作永久移除索引和存储在其中的所有向量。

**重要**  
删除向量索引时，需要了解以下事项：  
即使向量索引包含向量，也可以删除向量索引。
存储在索引中的所有向量都将被永久删除
与这些向量关联的所有元数据都将永久丢失
操作无法撤消或反转
对索引的任何正在进行的操作都将立即失败
查询索引的应用程序将收到错误
索引名称可供在存储桶中重用

## 使用 AWS CLI
<a name="cli-delete-vector-index"></a>

在删除向量索引之前，请验证向量索引。有关如何检查索引详细信息的更多信息，请参阅《Amazon S3 API Reference》**中的 [GetIndex](https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetIndex.html)。有关如何列出索引内的向量以查看将要删除的内容的更多信息，请参阅[列出向量索引](s3-vectors-index-list.md)。

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

```
aws s3vectors delete-index --vector-bucket-name "amzn-s3-demo-vector-bucket" \
          --index-name "idx2"
```

有关如何验证是否索引已删除的更多信息，请参阅[列出向量索引](s3-vectors-index-list.md)。

## 使用 AWS SDK
<a name="sdk-delete-vector-index"></a>

------
#### [ 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 a vector index
response = s3vectors.delete_index(
    vectorBucketName="media-embeddings",
    indexName="movies")
```

------