調用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 |
目標向量索引不存在。 |