|
本文介绍如何通过Java SDK获取已创建的Collection的状态和Schema信息。
前提条件
- 已创建Cluster
- 已获得API-KEY
- 已安装最新版SDK
接口定义
Java - // class DashVectorClient
- public Response<CollectionMeta> describe(String name);
复制代码使用示例
说明
-
需要使用您的api-key替换示例中的YOUR_API_KEY、您的Cluster Endpoint替换示例中的YOUR_CLUSTER_ENDPOINT,代码才能正常运行。
-
本示例需要参考新建Collection-使用示例提前创建好名称为quickstart的Collection。
Java - import com.aliyun.dashvector.DashVectorClient;
- import com.aliyun.dashvector.common.DashVectorException;
- import com.aliyun.dashvector.models.CollectionMeta;
- import com.aliyun.dashvector.models.responses.Response;
- public class Main {
- public static void main(String[] args) throws DashVectorException {
- DashVectorClient client = new DashVectorClient("YOUR_API_KEY", "YOUR_CLUSTER_ENDPOINT");
- Response<CollectionMeta> response = client.describe("quickstart");
- System.out.println(response);
- // example output:
- // {
- // "code":0,
- // "message":"",
- // "requestId":"cb468965-d86b-405a-87a4-a596e61c1240",
- // "output":{
- // "name":"quickstart",
- // "dimension":4,
- // "dataType":"FLOAT",
- // "metric":"dotproduct",
- // "status":"SERVING",
- // "fieldsSchema":{
- // "name":"STRING",
- // "weight":"FLOAT",
- // "age":"INT",
- // "id":"LONG"
- // },
- // "partitionStatus":{
- // "default":"SERVING"
- // }
- // }
- // }
- }
- }
复制代码 来源:程序园用户自行投稿发布,如果侵权,请联系站长删除 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |