milvus-logo
LFAI
< Docs
  • Java

renameCollection()

This operation renames an existing collection.

public void renameCollection(RenameCollectionReq request)

Request Syntax

renameCollection(RenameCollectionReq.builder()
    .collectionName(String collectionName)
    .newCollectionName(String newCollectionName)
    .build()
)

BUILDER METHODS:

  • collectionName(String collectionName)

    The name of an existing collection.

    Setting this to a non-existing collection results in a MilvusException.

  • newCollectionName(String newCollectionName)

    The name of the target collection after this operation.

    Setting this to the value of old_name results in a MilvusException.

RETURNS:

void

EXCEPTIONS:

  • MilvusClientExceptions

    This exception will be raised when any error occurs during this operation.

Example

// rename collection "test" to "test2"
RenameCollectionReq renameCollectionReq = RenameCollectionReq.builder()
        .collectionName("test")
        .newCollectionName("test2")
        .build();
client.renameCollection(renameCollectionReq);