< Docs
  • Java


A MilvusClient interface. This method renames the specified collection.

R<RpcStatus> renameCollection(RenameCollectionParam requestParam)


Use the RenameCollectionParam.Builder to construct a RenameCollectionParam object.

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

Methods of RenameCollectionParam.Builder:

Method Description Parameters
withOldCollectionName(String oldCollectionName) Sets the old collection name. Old collection name cannot be empty or null. oldCollectionName: The old name of the collection to rename.
withNewCollectionName(String newCollectionName) Sets the new collection name. New collection name cannot be empty or null. newCollectionName: The new name of the collection to rename.
build() Constructs a RenameCollectionParam object. N/A

The can throw the following exceptions:

  • ParamException: error if the parameter is invalid.


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 R.Status.Success.


import io.milvus.param.*;

RenameCollectionParam param = RenameCollectionParam.newBuilder()
R<Boolean> response = client.renameCollection(param);
if (response.getStatus() != R.Status.Success.getCode()) {