全部文档
当前文档

暂无内容

如果没有找到您期望的内容,请尝试其他搜索词

文档中心

query-vectors

最近更新时间:2026-11-11 10:30:20

query-vectors 命令用于向量相似性检索。

命令格式

ks3util vectors-api query-vectors --vector-bucket-name value --index-name value --query-vector value --top-k value [options]

参数说明

参数

说明

--vector-bucket-name

向量桶名称。

--index-name

向量索引名称。

--index-krn

向量索引 KRN,与 --vector-bucket-name + --index-name 二选一。

--query-vector

查询向量,JSON 字符串,维度须与索引匹配,如 '{"float32":[32]}'。

--top-k

返回最相似的 K 个向量,取值范围 1-100。

--filter

元数据过滤条件,JSON 字符串或 file:// 指定文件。

--return-data

返回向量数据,默认不返回。

--return-metadata

返回向量元数据,默认不返回。

--return-distance

返回相似距离,默认不返回。

使用示例

用查询向量检索最近邻的 10 条向量。

ks3util vectors-api query-vectors --vector-bucket-name examplebucket --index-name index1 --query-vector '{"float32":[1,2,3,4]}' --top-k 10

检索前先按元数据过滤。

ks3util vectors-api query-vectors --vector-bucket-name examplebucket --index-name index1 --query-vector '{"float32":[1,2,3,4]}' --top-k 10 --filter '{"color":{"$eq":"red"}}'

检索并返回向量数据、元数据与距离。

ks3util vectors-api query-vectors --vector-bucket-name examplebucket --index-name index1 --query-vector '{"float32":[1,2,3,4]}' --top-k 10 --return-data --return-metadata --return-distance

按索引 KRN 检索。

ks3util vectors-api query-vectors --index-krn krn:ksc:ks3vectors:beijing:uid:bucket/examplebucket/index/index1 --query-vector '{"float32":[1,2,3,4]}' --top-k 10

文档导读
纯净模式常规模式

纯净模式

点击可全屏预览文档内容
文档反馈