文档

获取Collection列表

更新时间:

本文介绍如何通过Java SDK获取所有已创建的Collection名称列表。

前提条件

接口定义

// class DashVectorClient

public Response<List<String>> list();

接口使用

说明

需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。

import com.aliyun.dashvector.DashVectorClient;
import com.aliyun.dashvector.DashVectorCollection;
import com.aliyun.dashvector.common.DashVectorException;

public class Main {
    public static void main(String[] args) throws DashVectorException {
        DashVectorClient client = new DashVectorClient("YOUR_API_KEY", "YOUR_CLUSTER_ENDPOINT");
      
        Response<List<String>> response = client.list();
      
        System.out.println(response);
        // example output:
        // {
        //     "code":0,
        //     "message":"",
        //     "requestId":"5de1a75e-2996-4496-a284-9b958dfdad53",
        //     "output":[
        //         "simple",
        //         "quickstart"
        //     ]
        // }
    }
}

入参描述

出参描述

说明

返回结果为Response<List<String>>对象,Response<List<String>>对象中可获取本次操作结果信息,如下表所示。

方法

类型

描述

示例

getCode()

int

返回值,参考返回状态码说明

0

getMessage()

String

返回消息

success

getRequestId()

String

请求唯一id

19215409-ea66-4db9-8764-26ce2eb5bb99

getOutput()

List<String>

所有Collection名称列表

['my_collection1', 'my_collection2']

isSuccess()

Boolean

判断请求是否成功

true

  • 本页导读 (0)
文档反馈