This topic describes how to use the DashVector Java SDK to retrieve the status of an existing partition in a collection.
Prerequisites
You have created a cluster. For more information, see Create a cluster.
You have an API key. For more information, see Manage API keys.
You have installed the latest version of the DashVector SDK. For more information, see Install DashVector SDK.
API definition
// class DashVectorCollection
public Response<Status> describePartition(String name);Example
To run the sample code, you must replace YOUR_API_KEY and YOUR_CLUSTER_ENDPOINT with your API key and cluster endpoint.
This example requires a collection named
quickstart. For more information, see Create a collection.This example requires a partition named
shoes. For more information, see Create a partition.
import com.aliyun.dashvector.DashVectorClient;
import com.aliyun.dashvector.DashVectorCollection;
import com.aliyun.dashvector.common.DashVectorException;
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");
DashVectorCollection collection = client.get("quickstart");
// Describe the partition.
Response<Status> response = collection.describePartition("shoes");
System.out.println(response);
// example output:
// {"code":0,"message":"","requestId":"f554cde8-6147-42b5-b794-8cb9c0ae57da","output":"SERVING"}
}
}
Parameters
Parameter | Type | Required | Default | Description |
name | String | Yes | - | The partition name. |
Response
The returned result is a Response<Status> object. The Response<Status> object contains information about the result of this operation, as shown in the following table.
Method | Type | Description | Example |
getCode() | int | The status code of the response. For more information, see Status codes. | 0 |
getMessage() | String | The response message. | success |
getRequestId() | String | The request ID. | 19215409-ea66-4db9-8764-26ce2eb5bb99 |
getOutput() | String | The status of the partition. For more information, see Status. |
|
isSuccess() | Boolean | Indicates whether the request was successful. | true |