

# 列出向量索引
<a name="s3-vectors-index-list"></a>

可以查看向量存储桶中的所有向量索引。列出操作支持基于前缀的筛选，有助于您在存储桶中有许多索引时找到特定的索引。有关 `ListIndexes`、前缀限制和响应限制的更多信息，请参阅《Amazon Simple Storage Service API Reference》中的 [ListIndexes](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_ListIndexes.html)。

## 前缀搜索功能
<a name="s3-vectors-index-prefix-search-capability"></a>

前缀搜索支持您列出以特定前缀开头的索引，从而可以更轻松地整理和查找相关的向量索引。当您使用将相关索引分组在一起的命名约定时，这特别有用：
+ **按数据类型：**`text-embeddings-`、`image-features-`、`audio-vectors-`
+ **按模型：**`model1-embeddings-`、`model2-vectors-`、`custom-model-`
+ **按使用案例：**`search-index-`、`recommendation-`、`similarity-`
+ **按环境：**`prod-vectors-`、`staging-vectors-`、`dev-vectors-`

### 使用 S3 控制台
<a name="s3-vectors-index-list-console"></a>

**列出向量索引**

1. 登录到 AWS 管理控制台，然后通过以下网址打开 Amazon S3 控制台：[https://console.aws.amazon.com/s3/](https://console.aws.amazon.com/s3/)。

1. 在左侧导航窗格中，选择**向量存储桶**。

1. 在向量存储桶列表中，选择存储桶的名称，该存储桶包含您要查看的索引。

1. 控制台会显示存储桶中所有向量索引的完整列表，包括：
   + **名称**：每个索引的名称。
   + **创建日期**：创建索引的时间。
   + **Amazon 资源名称（ARN）**：每个索引的 Amazon 资源名称（ARN）。

**筛选列表**

1. 在索引列表上方的搜索框中输入索引名称或前缀。使用前缀来查找相关索引的分组。

1. 当您键入时，列表会实时更新。

### 使用 AWS CLI
<a name="s3-vectors-list-cli"></a>

使用以下示例命令，并将*用户输入占位符*替换为您自己的信息。

**列出向量存储桶中带有特定前缀的索引**

请求示例：

```
aws s3vectors list-indexes \
  --vector-bucket-name "amzn-s3-demo-bucket" \
  --prefix "idx" \
  --max-results 1
```

响应示例：

```
{
    "nextToken": "lObb29ZkzxMGtBXs97Rkbs26xdtKemu4brsnq2jX8DCocADkILv5cRphemXS3PXXFnQBihQBmESgEeKaGA",
    "indexes": [
        {
            "vectorBucketName": "amzn-s3-demo-bucket",
            "indexName": "idx",
            "indexArn": "arn:aws:s3vectors:aws-region:111122223333:bucket/amzn-s3-demo-vector-bucket/index/idx",
            "creationTime": "2025-06-12T15:50:23+00:00"
        }
    ]
}
```

**使用分页列出索引**

请求示例：

```
aws s3vectors list-indexes \
  --vector-bucket-name "amzn-s3-demo-bucket" \
  --prefix "idx" \
  --next-token "lObb29ZkzxMGtBXs97Rkbs26xdtKemu4brsnq2jX8DCocADkILv5cRphemXS3PXXFnQBihQBmESgEeKaGA"
```

响应示例：

```
{
    "indexes": [
        {
            "vectorBucketName": "amzn-s3-demo-bucket",
            "indexName": "idx2",
            "indexArn": "arn:aws:s3vectors:aws-region:111122223333:bucket/amzn-s3-demo-vector-bucket/index/idx2",
            "creationTime": "2025-06-12T15:45:37+00:00"
        }
    ]
}
```

### 使用 AWS SDK
<a name="s3-vectors-list-sdk"></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")

#List vector indexes in your vector bucket
response = s3vectors.list_indexes(vectorBucketName="media-embeddings")
indexes = response["indexes"]
print(indexes)
```

------