從向量索引刪除向量 - Amazon Simple Storage Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

從向量索引刪除向量

您可以使用 DeleteVectors API 指定向量索引鍵,從向量索引中刪除特定向量。此操作有助於移除過時或不正確的資料,同時能保留其餘向量資料。

若要刪除向量,請使用下列命令範例。以您自己的資訊取代使用者輸入預留位置

aws s3vectors delete-vectors \ --vector-bucket-name "amzn-s3-demo-vector-bucket" \ --index-name "idx" \ --keys '["vec2","vec3"]'
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"])