In Milvus, each collection is designed to store a set of vectors along with some scalar fields. Vectors are typically high-dimensional data points such as embeddings that are generated by machine learning models.
In simple terms, you can think of a Milvus collection as a complex table where each row contains a unique identifier, various scalar fields, and one vector field.
What Is Milvus CLI
Milvus CLI is a command-line tool that allows us to connect and interact with the Milvus database server. It allows us to connect, manage the database, and import or export the data from the server.
In this tutorial, we will learn how to configure the Milvus CLI and use it to create a Milvus collection.
NOTE: We will demonstrate the installation of the Milvus CLI on Ubuntu 22.04. However, the instructions works on any system with the pip package manager installed.
Install Milvus CLI – PIP on Ubuntu
The simplest method to install Milvus CLI is using the pip package manager. For example, we can run the command as follows:
If you don’t have pip installed, you can run the following command:
Once completed, you can verify by checking the CLI version with the following command:
Output:
Milvus Create Collection Command
The “create-collection” command in the Milvus CLI allows us to create a new Milvus collection. The command syntax is as follows:
- -c, –collection-name TEXT – The collection name to specify the alias.
- -p, –schema-primary-field TEXT – The primary field name.
- -a, –schema-auto-id – It enables the auto id.
- -d, –schema-description TEXT – The description details.
- -f, –schema-field TEXT – The FieldSchema. Usage is “<Name>:<DataType>:<Dim(if vector) or Description>”.
Create a Collection Using Milvus CLI
Let us demonstrate a basic example on how we create a collection using the Milvus CLI.
Start by connecting to the Milvus server with the following command:
For Example:
This should connect to the Milvus instance on localhost and the default port.
Create a Collection in Milvus
To create a collection, we can run the following command:
For Example:
The previous command creates a book collection with the defined schema fields.
Conclusion
We explored the concept of collections in the Milvus database. We also learned how to install the Milvus CLI and how to use it to create a simple Milvus collection.