getIndex 用于查询索引 Index 详情。
public GetVikingdbIndexResponse getVikingdbIndex(GetVikingdbIndexRequest body) throws ApiException
参数 | 类型 | 是否必选 | 参数说明 |
|---|---|---|---|
projectName | String | 否 | 项目名称 |
collectionName | String | 2选1 | 数据集名称 |
resourceId | String | 数据集资源ID。请求必须指定ResourceId和CollectionName其中之一。 | |
indexName | string | 是 | 指定要查询的 Index 名称。
|
Java 调用执行上面的任务,返回 Index 实例。Index 实例包含的属性如下表所示。
参数 | 一级子参数 | 类型 | 描述 |
|---|---|---|---|
collectionName | String | 数据集名称 | |
projectName | String | 项目名称 | |
resourceId | String | 资源ID | |
indexName | String | 索引名称 | |
cpuQuota | Integer | 索引检索消耗的 CPU 配额。 | |
shardPolicy | String | 索引分片类型,auto为自动分片、custom为自定义分片。 | |
shardCount | Integer | 索引分片数 | |
description | String | 索引描述 | |
vectorIndex | VectorIndexForGetVikingdbIndexOutput | 向量索引配置 | |
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 | 标量字段列表
| |
defaultValue | Object | ||
dim | Integer | ||
fieldName | String | ||
actualCU | Integer | 实际CU用量 |
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.*; public class GetVikingdbIndex { 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); GetVikingdbIndexRequest request = new GetVikingdbIndexRequest() .collectionName("test_collection_for_sdk_with_vector") .indexName("idx_simple"); try { GetVikingdbIndexResponse response = api.getVikingdbIndex(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()); } } }