全部产品
Search
文档中心

对象存储 OSS:put-vector-index-fusion

更新时间:Oct 20, 2026

put-vector-index-fusion命令用于在向量Bucket中创建Fusion模式的向量索引。

说明

Fusion Mode 目前处于邀测阶段,仅在印度尼西亚(雅加达)地域提供。Standard 模式向量索引的创建请参见 put-vector-index。

权限说明

阿里云账号默认拥有全部权限。阿里云账号下的RAM用户或RAM角色默认没有任何权限,需要阿里云账号或账号管理员通过RAM Policy概述或Bucket Policy授予操作权限。

API

Action

说明

PutVectorIndexFusion

oss:PutVectorIndex

创建Fusion模式的向量索引。

命令格式

ossutil vectors-api put-vector-index-fusion --bucket value --index-name value --vector-mode value --schema-configuration value --account-id value

参数说明

参数

类型

说明

--account-id

string

阿里云账号ID。该选项为必填项,未指定时命令会返回AccountId is null错误。

--bucket

string

向量Bucket名称。

--index-name

string

向量索引名称。

--vector-mode

string

向量索引模式,创建Fusion模式索引时固定为fusion。

--schema-configuration

string

向量索引的Schema配置,JSON格式。当选项值包含file://前缀时,表示从文件中读取配置。各字段的含义请参见PutVectorIndexFusion接口文档。

--schema-configuration

--schema-configuration配置选项支持JSON语法,当选项值包含file://前缀时,表示从文件中读取配置。JSON语法如下:

{
    "fields": [
      {
        "name": "string",
        "type": "vector",
        "dataType": "float32",
        "dimension": int,
        "distanceMetric": "euclidean"
      },
      {
        "name": "string",
        "type": "long",
        "isArray": bool
      },
      {
        "name": "string",
        "type": "double",
        "isArray": bool
      },
      {
        "name": "string",
        "type": "ip"
      },
      {
        "name": "string",
        "type": "geoPoint"
      },
      {
        "name": "string",
        "type": "string",
        "isPartitionKey": bool
      },
      {
        "name": "string",
        "type": "string",
        "exactMatch": bool,
        "text": {
          "enabled": bool,
          "analyzer": "standard",
          "analyzerParameters": {
            "caseSensitive": bool,
            "delimitWord": bool
          }
        }
      },
      {
        "name": "string",
        "type": "string",
        "exactMatch": bool,
        "text": {
          "enabled": bool,
          "analyzer": "split",
          "analyzerParameters": {
            "caseSensitive": bool,
            "delimiter": "string"
          }
        }
      }
    ]
}
说明
  • 本命令需要ossutil 2.4.1及以上版本。更低版本请通过泛化命令invoke-operation调用PutVectorIndexFusion接口。

  • 关于支持的全局命令行选项,请参见支持的全局命令行选项。

使用示例

在名为examplebucket的向量Bucket中创建名为my_index的Fusion模式向量索引,该索引包含两个向量字段(text_vector、image_vector)、一个支持全文检索的字段(title)、一个数组类型标量字段(category)和一个数值字段(year)。

方式一:从JSON文件读取Schema配置。示例配置文件schema-configuration.json的内容如下:

{
  "fields": [
    {
      "name": "text_vector",
      "type": "vector",
      "dataType": "float32",
      "dimension": 4,
      "distanceMetric": "cosine"
    },
    {
      "name": "image_vector",
      "type": "vector",
      "dataType": "float32",
      "dimension": 4,
      "distanceMetric": "cosine"
    },
    {
      "name": "title",
      "type": "string",
      "exactMatch": false,
      "text": {
        "enabled": true,
        "analyzer": "standard",
        "analyzerParameters": {
          "caseSensitive": false,
          "delimitWord": false
        }
      }
    },
    {
      "name": "category",
      "type": "string",
      "isArray": true
    },
    {
      "name": "year",
      "type": "long"
    }
  ]
}
ossutil vectors-api put-vector-index-fusion --bucket examplebucket --index-name my_index --vector-mode fusion --schema-configuration file://schema-configuration.json --account-id 123456789012****

方式二:在命令行中直接传入JSON字符串。

ossutil vectors-api put-vector-index-fusion --bucket examplebucket --index-name my_index --vector-mode fusion --schema-configuration '{"fields":[{"name":"text_vector","type":"vector","dataType":"float32","dimension":4,"distanceMetric":"cosine"},{"name":"image_vector","type":"vector","dataType":"float32","dimension":4,"distanceMetric":"cosine"},{"name":"title","type":"string","exactMatch":false,"text":{"enabled":true,"analyzer":"standard","analyzerParameters":{"caseSensitive":false,"delimitWord":false}}},{"name":"category","type":"string","isArray":true},{"name":"year","type":"long"}]}' --account-id 123456789012****