This tutorial teaches us how to use the Milvus CLI to drop an existing collection from the database.
Requirements:
To follow along with this tutorial, you are required with the following:
- Installed Milvus on your machine. You can use the Docker, a standalone install, or a remote instance.
- Installed Milvus CLI on your machine
- Attu Manager
Creating a Milvus Collection
Before learning how to drop an existing Milvus collection, let us start by setting up a sample Milvus collection for demonstration purposes.
Start by opening the Milvus CLI with the following command:
Next, login to your Milvus instance with the following command:
For example, the following command logs into a locally hosted Milvus instance on the default port and alias.
Once logged in, we can create a sample Milvus collection as shown in the following command:
We call the “create collection” command to create a new collection in Milvus.
Next, we use the -c parameter to specify the collection’s name. In this case, the collection name is “film.”
The -f parameter allows us to specify the fields of the collection and their corresponding types within the collection. In this collection, the fields are defined as follows:
id:INT64:primary_field – This specifies the field named “id” of type INT64, and it is marked as the primary field. The primary field is used to uniquely identify the records in the collection.
film_name VARCHAR:100 – This specifies the field named “film_name” of type VARCHAR with a maximum length of 100 characters.
release_year:INT64:release_year – This specifies the field named “release_year” of type INT64.
vector:FLOAT_VECTOR:8 – This specifies the field named “vector” as a vector field of type FLOAT_VECTOR with a dimension of 8.
The -p id parameter allows us to specify the primary key for the collection. In this case, we specify the primary key as the “id” field.
Finally, we use the -d parameter to specify the description for the collection.
Delete a Collection in Milvus
If you no longer need a collection, you can remove it using the “delete collection” command as shown in the following syntax:
For example, to remove the film collection, run the following command:
This should prompt you whether you wish to remove the collection. Press “Y” to accept.
Drop a Collection in Milvus Using Attu
You can also use the Attu manager to drop an existing collection. Launch the Attu manager and connect to your target server.
Once connected, navigate to the collections pane and locate the collection that you wish to delete. Select the target collection and choose the bin icon.
This will prompt you to confirm whether you wish to delete the collection.
Conclusion
This comprehensive tutorial taught us how to create and delete an existing Milvus collection from the server using the Milvus CLI and the Attu Manager.