调用GetVectorIndex接口获取向量索引的详细信息。
权限说明
阿里云账号默认拥有全部权限。阿里云账号下的RAM用户或RAM角色默认没有任何权限,需要阿里云账号或账号管理员通过RAM Policy概述或Bucket Policy授予操作权限。
|
API |
Action |
说明 |
|
GetVectorIndex |
|
获取向量索引信息。 |
请求语法
POST /?getVectorIndex HTTP/1.1
Host: examplebucket-123***456.cn-hangzhou-internal.oss-vectors.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue
{
"indexName": "string"
}
请求头
此接口仅涉及公共请求头。更多信息,请参见公共HTTP头定义。
请求参数
|
名称 |
数据类型 |
是否必选 |
示例值 |
描述 |
|
indexName |
字符串 |
是 |
vectorindex1 |
索引名称。 |
响应头
此接口仅涉及公共响应头。更多信息,请参见公共HTTP头定义。
响应元素
|
名称 |
数据类型 |
示例值 |
描述 |
|
index |
容器 |
- |
保存向量索引信息的容器。 |
|
bucketArn |
字符串 |
acs:ossvector:cn-hangzhou:174****:my-vector-bucket |
索引所属向量Bucket的资源名称(ARN),格式为 acs:ossvector:{region}:{accountId}:{bucketName}。 父节点:index |
|
indexName |
字符串 |
vectorindex1 |
索引名称。 父节点:index |
|
createTime |
字符串 |
2025-04-17T10:56:21.000Z |
索引的创建时间,格式为GMT时间。 父节点:index |
|
dataType |
字符串 |
float32 |
向量数据类型。 父节点:index |
|
dimension |
整型 |
1024 |
向量维度。 父节点:index |
|
distanceMetric |
字符串 |
euclidean |
距离度量函数。 父节点:index |
|
metadata |
容器 |
- |
元数据配置。 父节点:index |
|
nonFilterableMetadataKeys |
字符串数组 |
["category", "timestamp"] |
非过滤元数据字段列表。 父节点:metadata |
|
status |
字符串 |
enable |
索引当前的状态。取值:
|
|
mode |
字符串 |
fusion |
索引模式。取值:
父节点:index |
上述响应元素为 Standard 模式索引返回的字段。对于 Fusion 模式索引,除 index、bucketArn、indexName、createTime、mode、status 等基础属性外,还会返回创建索引时定义的完整 Schema 配置(schemaConfiguration),而不返回 dataType、dimension、distanceMetric 等 Standard 模式字段。同一向量Bucket下可同时存在 Standard 模式与 Fusion 模式的索引。
示例
Standard 模式
请求示例
POST /?getVectorIndex HTTP/1.1
Host: examplebucket-123***456.cn-hangzhou-internal.oss-vectors.aliyuncs.com
Date: Thu, 17 Apr 2025 01:33:47 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218
{
"indexName": "vectorindex1"
}
返回示例
HTTP/1.1 200 OK
x-oss-request-id: 534B371674E88A4D8906****
Date: Thu, 17 Apr 2025 01:33:47 GMT
Connection: keep-alive
Server: AliyunOSS
Content-type: application/json
{
"index": {
"bucketArn": "acs:ossvector:cn-hangzhou:174****:my-vector-bucket",
"createTime": "2025-04-17T10:56:21.000Z",
"indexName": "vectorindex1",
"mode": "standard",
"dataType": "float32",
"dimension": 1024,
"distanceMetric": "euclidean",
"metadata": {
"nonFilterableMetadataKeys": ["category", "timestamp"]
},
"status": "enable"
}
}
Fusion 模式
请求示例
POST /?getVectorIndex HTTP/1.1
Host: examplebucket-123***456.cn-hangzhou-internal.oss-vectors.aliyuncs.com
Date: Thu, 17 Apr 2025 01:33:47 GMT
Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218
{
"indexName": "vectorindex1"
}
返回示例
HTTP/1.1 200 OK
x-oss-request-id: 534B371674E88A4D8906****
Date: Thu, 17 Apr 2025 01:33:47 GMT
Connection: keep-alive
Server: AliyunOSS
Content-type: application/json
{
"index": {
"bucketArn": "acs:ossvector:cn-hangzhou:174****:my-vector-bucket",
"createTime": "2025-04-17T10:56:21.000Z",
"indexName": "vectorindex1",
"mode": "fusion",
"schemaConfiguration": {
"fields": [
{
"name": "vector_1",
"type": "vector",
"dataType": "float32",
"dimension": 1024,
"distanceMetric": "euclidean"
},
{
"name": "price",
"type": "double"
},
{
"name": "tag",
"type": "string"
},
{
"name": "user_id",
"type": "string",
"isPartitionKey": true
}
]
},
"status": "enable"
}
}
SDK
GetVectorIndex接口所对应的各语言SDK如下:
命令行工具ossutil
GetVectorIndex接口所对应的ossutil命令,请参见get-vector-index。
错误码
|
错误码 |
HTTP状态码 |
描述 |
|
VectorIndexParameterInvalid |
400 |
请求中提供的向量索引参数不合法。 |
|
MalformedJson |
400 |
请求体中的 JSON 格式不符合规范。 |
|
AccessDenied |
403 |
返回该错误的可能原因如下:
|
|
NoSuchVectorIndex |
404 |
目标向量索引不存在。 |