Retrieve the status, schema, and configuration of an existing DashVector collection by using the Java SDK.
Prerequisites
Before you begin, make sure that you have:
A DashVector cluster
An API key
The latest version of the DashVector SDK
API definition
// DashVectorClient
public Response<CollectionMeta> describe(String name);Request parameters
| Parameter | Type | Required | Default value | Description |
|---|---|---|---|---|
| name | String | Yes | - | The name of an existing collection. |
Example
The following example retrieves details for a collection named quickstart. Create this collection beforehand by following the example in Create a collection.
Replace the following placeholders with your actual values:
| Placeholder | Description |
|---|---|
<your-api-key> | Your API key |
<your-cluster-endpoint> | Your cluster endpoint |
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);
}
}Sample response:
{
"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"
}
}
}Response parameters
The describe method returns a Response<CollectionMeta> object. Use the following methods to access the response data:
| Method | Type | Description | Example |
|---|---|---|---|
| getCode() | int | The status code. For more information, see Status codes. | 0 |
| getMessage() | String | The response message. | success |
| getRequestId | String | The unique request ID. | 19215409-ea66-4db9-8764-26ce2eb5bb99 |
| getOutput() | CollectionMeta | The collection metadata. See the following table. | - |
| isSuccess() | Boolean | Whether the operation succeeded. | true |
The CollectionMeta object returned by getOutput() contains the following fields:
| Field | Type | Description |
|---|---|---|
| name | String | The collection name. |
| dimension | int | The vector dimension. |
| dataType | String | The vector data type, such as FLOAT. |
| metric | String | The distance metric, such as dotproduct. |
| status | String | The collection status. A value of SERVING indicates that the collection is ready to accept requests. |
| fieldsSchema | Map<String, String> | The scalar field definitions. Each entry maps a field name to its data type (STRING, FLOAT, INT, or LONG). |
| partitionStatus | Map<String, String> | The status of each partition. |
For the full type definition, see CollectionMeta.