全部产品
Search
文档中心

对象存储 OSS:query-vectors-fusion

更新时间:Oct 20, 2026

query-vectors-fusion命令用于对Fusion模式的向量索引进行检索。

说明

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

权限说明

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

API

Action

说明

QueryVectors

oss:QueryVectors

查询向量数据。

权限说明

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

API

Action

说明

QueryVectorsFusion

oss:QueryVectors和oss:GetVectors

查询Fusion模式向量数据。

命令格式

ossutil vectors-api query-vectors-fusion --bucket value --index-name value --account-id value [flags]

参数说明

参数

类型

说明

--bucket

string

向量Bucket名称。

--index-name

string

向量索引名称。

--account-id

string

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

--knn

string

向量检索条件,JSON格式。当选项值包含file://前缀时,表示从文件中读取配置。

--query

string

标量与全文过滤条件容器,JSON格式。当选项值包含file://前缀时,表示从文件中读取配置。

--retriever

string

多路召回融合配置,JSON格式,用于多路混合检索(如RRF融合、加权归一化融合)。

--limit

int

返回结果的条数。

--next-token

string

翻页的起始标记,取值为上一次请求返回的NextToken。

--partition-keys

stringArray

需要访问的分区键,可重复指定该选项以传入多个分区键。

--return-metadata

/

是否返回元数据。指定该选项时返回元数据。

--return-metadata-fields

stringArray

元数据中需要返回的字段,可重复指定该选项以传入多个字段。

--sort

string

返回结果的排序方式,JSON格式。

说明
  • 本命令需要ossutil 2.4.1及以上版本。更低版本请通过泛化命令invoke-operation调用QueryVectorsFusion接口。

  • --knn、--query、--retriever分别对应向量检索、标量与全文过滤、多路召回融合,可按需组合使用。

  • 使用--retriever时,仅允许同时指定--index-name、--limit、--partition-keys、--return-metadata、--return-metadata-fields选项。

  • --next-token仅在纯标量与全文过滤(即不指定--knn和--retriever)的检索场景下支持翻页。

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

使用示例

在名为examplebucket的向量Bucket中,对名为my_index的Fusion模式向量索引进行检索,返回与查询向量最相似的前 10 条向量及其元数据。

ossutil vectors-api query-vectors-fusion --bucket examplebucket --index-name my_index --knn '{"field":"text_vector","queryVector":[0.1,0.2,0.3],"topK":10,"numCandidates":100}' --return-metadata --account-id 123456789012****

在上述检索的基础上增加标量过滤,仅返回category为book的结果,限定返回20条,并指定元数据只返回title和year字段。

ossutil vectors-api query-vectors-fusion --bucket examplebucket --index-name my_index --knn '{"field":"text_vector","queryVector":[0.1,0.2,0.3],"topK":10,"numCandidates":100}' --query '{"category":{"$eq":"book"}}' --limit 20 --return-metadata --return-metadata-fields title --return-metadata-fields year --account-id 123456789012****