listIndexes 用于查询和数据集 Collection 关联的索引 Index列表。
public ListVikingdbIndexResponse listVikingdbIndex(ListVikingdbIndexRequest body) throws ApiException
参数 | 类型 | 是否必填 | 描述 |
|---|---|---|---|
pageNumber | Integer | 否 | 翻页页码。起始为1。 |
pageSize | Integer | 否 | 翻页每页的大小。 |
filter | FilterForListVikingdbIndexInput | 否 | 过滤条件,如下 |
参数 | 类型 | 描述 |
|---|---|---|
collectionName | List | 数据集名称 |
indexNameKeyword | String | 索引名 |
status | List | 状态 |
Java 调用执行上面的任务,返回 Index 实例列表。Index 实例包含的属性如下表所示。
参数 | 一级子参数 | 二级子参数 | 类型 | 描述 |
|---|---|---|---|---|
indexes | List | 向量库索引详情列表 | ||
collectionName | String | 数据集名称 | ||
projectName | String | 项目名称 | ||
resourceId | String | 资源ID | ||
indexName | String | 索引名称 | ||
description | String | 索引的自定义描述。 | ||
vectorIndex | VectorIndexForListVikingdbIndexOutput | 向量索引配置 | ||
indexType | IndexTypeEnum | 索引类型 | ||
distance | DistanceEnum | 距离类型,衡量向量之间距离的算法。取值如下: | ||
quant | QuantEnum | 量化方式。量化方式是索引中对向量的压缩方式,可以降低向量间相似性计算的复杂度。基于向量的高维度和大规模特点,采用向量量化可以有效减少向量的存储和计算成本。取值如下:
int8适用于hnsw、hnsw_hybrid、flat索引算法,距离方式为ip、consine。 float适用于hnsw、hnsw_hybrid、flat、diskann索引算法,距离方式为ip、l2、consine。 fix16适用于hnsw、hnsw_hybrid、flat索引算法,距离方式为ip、l2、consine。 pq适用于diskann、ivf索引算法,距离方式为ip、l2、consine。 | ||
hnswM | Integer | hnsw 索引参数,表示邻居节点个数。
| ||
hnswCef | Integer | hnsw 索引参数,表示构建图时搜索邻居节点的广度。
| ||
hnswSef | Integer | hnsw 索引参数,表示线上检索的搜索广度。
| ||
diskannM | Integer | diskann参数,标识邻居节点个数。
| ||
diskannCef | Integer | diskann参数,表示构建图时搜索邻居节点的广度。
| ||
pqCodeRatio | Float | diskann参数,向量维度编码的大小限制。值越大,召回率越高,但会增加内存使用量,范围 (0.0, 0.25]。
| ||
cacheRatio | Float | diskann参数,缓存节点数与原始数据的比率,较大的值会提高索引性能并增加内存使用量。范围 [0.0,0.3)。
| ||
scalarIndex | List | 标量字段列表 | ||
cpuQuota | Integer | 索引检索消耗的 CPU 配额。 | ||
shardPolicy | String | 索引分片类型,auto为自动分片、custom为自定义分片。 | ||
shardCount | Integer | 索引分片数 | ||
actualCU | Integer | 实际CU用量 | ||
pageSize | Integer | 请求时的PageSize值,如果请求时未指定,则为默认值。 | ||
pageNumber | Integer | 请求时的PageNumber值,如果请求时未指定,则为默认值。 | ||
totalCount | Integer | 查询结果的总数 |
package org.example.newsubproduct.console.index; import com.volcengine.ApiClient; import com.volcengine.ApiException; import com.volcengine.sign.Credentials; import com.volcengine.vikingdb.VikingdbApi; import com.volcengine.vikingdb.model.*; import java.util.Arrays; import java.util.Collections; public class ListVikingdbIndex { public static void main(String[] args) { String ak = System.getenv("AK"); // ak String sk = System.getenv("SK"); // sk String endpoint = "vikingdb.cn-beijing.volcengineapi.com"; // 填写向量库控制面v2的域名 https://www.volcengine.com/docs/84313/1792715 String region = "cn-beijing"; // 服务区域 ApiClient apiClient = new ApiClient() .setEndpoint(endpoint) .setCredentials(Credentials.getCredentials(ak, sk)) .setRegion(region); VikingdbApi api = new VikingdbApi(apiClient); ListVikingdbIndexRequest request = new ListVikingdbIndexRequest() .filter(new FilterForListVikingdbIndexInput() .collectionName(Arrays.asList("test_collection_for_sdk_with_vector", "test_collection_for_sdk_with_vectorize")) .indexNameKeyword("idx") .status(Collections.singletonList("ready")) ); try { ListVikingdbIndexResponse response = api.listVikingdbIndex(request); System.out.println("response body: " + response); System.out.println(); System.out.println("response meta RequestId: " + response.getResponseMetadata().getRequestId()); System.out.println("response meta Service: " + response.getResponseMetadata().getService()); System.out.println("response meta Region: " + response.getResponseMetadata().getRegion()); System.out.println("response meta Action: " + response.getResponseMetadata().getAction()); System.out.println("response meta Version: " + response.getResponseMetadata().getVersion()); } catch (ApiException e) { System.out.println("exception http code: " + e.getCode()); System.out.println("exception response body: " + e.getResponseBody()); System.out.println(); System.out.println("exception RequestId: " + e.getResponseMetadata().getRequestId()); System.out.println("exception Action: " + e.getResponseMetadata().getAction()); System.out.println("exception Region: " + e.getResponseMetadata().getRegion()); System.out.println("exception Service: " + e.getResponseMetadata().getService()); System.out.println("exception Error.Code: " + e.getResponseMetadata().getError().getCode()); System.out.println("exception Error.Message: " + e.getResponseMetadata().getError().getMessage()); } } }