milvus-logo
LFAI
< Docs
  • Java
    • v1

listAliases()

A MilvusClient interface. This method alters an alias from one collection to another.

R<ListAliasesResponse> listAliases(ListAliasesParam requestParam);

ListAliasesParam

Use the ListAliasesParam.Builder to construct a ListAliasesParam object.

import io.milvus.param.ListAliasesParam;
ListAliasesParam.Builder builder = ListAliasesParam.newBuilder();

Methods of ListAliasesParam.Builder:

Method Description Parameters

withCollectionName(String collectionName)
Sets the target collection name. Collection name cannot be empty or null. collectionName: The name of the target collection to list the aliases.
build() Constructs a ListAliasesParam object. N/A

The ListAliasesParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<RpcStatus> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and the error message of the exception.

  • If the API succeeds, it returns a valid ListAliasesResponse held by the R template. You can use ListAliasesResponse to get the information of aliases.

Example

import io.milvus.param.*;

ListAliasesParam param = ListAliasesParam.newBuilder()
        .withCollection(COLLECTION_NAME)
        .build();
R<ListAliasesResponse> response = client.listAliases(param)
if (response.getStatus() != R.Status.Success.getCode()) {
    System.out.println(response.getMessage());
}