通過put-vector-index命令在向量Bucket中建立向量索引。
注意事項
單個向量 Bucket 中最多建立 100 張向量索引
向量索引 PutVectorIndex 請求每秒最大支援 5 個。
許可權說明
阿里雲帳號預設擁有全部許可權。阿里雲帳號下的RAM使用者或RAM角色預設沒有任何許可權,需要阿里雲帳號或帳號管理員通過RAM Policy或Bucket Policy授予操作許可權。
API | Action | 說明 |
PutVectorIndex |
| 建立向量索引。 |
命令格式
ossutil vectors-api put-vector-index --bucket value --index-name value [flags]參數說明
參數 | 類型 | 說明 |
--bucket | string | 向量Bucket名稱。 |
--data-type | string | 向量資料類型,當前暫不支援自訂。預設值:float32。 |
--dimension | int | 向量維度,支援1~4096維。預設為512。 |
--distance-metric | string | 距離度量函數。可選值如下:
|
--index-name | string | 索引名稱,使用者可自訂,預設為空白。
|
--metadata | string | 中繼資料配置的容器,僅支援填寫非過濾中繼資料。對於非過濾中繼資料配置,有如下輸入限制:
|
put-vector-index命令對應API介面PutVectorIndex。
關於支援的全域命令列選項,請參見支援的全域命令列選項。
使用樣本
為儲存桶
examplebucket建立index索引:向量維度 512,資料類型float32,距離度量 euclidean。ossutil vectors-api put-vector-index --bucket examplebucket --index-name index --data-type float32 --dimension 512 --distance-metric euclidean為儲存桶
examplebucket建立index索引:向量維度 512,資料類型float32,距離度量 euclidean,並配置非過濾中繼資料。ossutil vectors-api put-vector-index --bucket examplebucket --index-name index --data-type float32 --dimension 512 --distance-metric euclidean --metadata '{"nonFilterableMetadataKeys":["owner","createdBy"]}'