In the age of information explosion, we are producing voice, images, videos, and other unstructured data all the time. How do we efficiently analyze this massive amount of data? The emergence of neural networks enables unstructured data to be embedded as vectors, and the Milvus database is a basic data service software, which helps complete the storage, search, and analysis of vector data.
But how can we use the Milvus vector database quickly?
Some users have complained that APIs are hard to memorize and hope there could be simple command lines to operate the Milvus database.
We're thrilled to introduce Milvus_CLI, a command-line tool dedicated to the Milvus vector database.
Milvus_CLI is a convenient database CLI for Milvus, supporting database connection, data import, data export, and vector calculation using interactive commands in shells. The latest version of Milvus_CLI has the following features.
All platforms supported, including Windows, Mac, and Linux
Online and offline installation with pip supported
Portable, can be used anywhere
Built on the Milvus SDK for Python
Help docs included
You can install Milvus_CLI either online or offline.
Run the following command to install Milvus_CLI online with pip. Python 3.8 or later is required.
pip install milvus-cli
To install Milvus_CLI offline, download the latest tarball from the release page first.
After the tarball is downloaded, run the following command to install Milvus_CLI.
pip install milvus_cli-<version>.tar.gz
After Milvus_CLI is installed, run
milvus_cli > prompt that appears indicates that the command line is ready.
If you're using a Mac with the M1 chip or a PC without a Python environment, you can choose to use a portable application instead. To accomplish this, download a file on the release page corresponding to your OS, run
chmod +x on the file to make it executable, and run
./ on the file to run it.
The following example makes
milvus_cli-v0.1.8-fix2-macOS executable and runs it.
sudo chmod +x milvus_cli-v0.1.8-fix2-macOS ./milvus_cli-v0.1.8-fix2-macOS
If Milvus is installed on your localhost with the default port, run
Otherwise, run the following command with the IP address of your Milvus server. The following example uses
172.16.20.3 as the IP address and
19530 as the port number.
connect -h 172.16.20.3
This section introduces how to create a collection.
A collection consists of entities and is similar to a table in RDBMS. See Glossary for more information.
The following example creates a collection named
car collection has four fields which are
brand. The primary key field is
id. See create collection for more information.
create collection -c car -f id:INT64:primary_field -f vector:FLOAT_VECTOR:128 -f color:INT64:color -f brand:INT64:brand -p id -a -d 'car_collection'
Run the following command to list all collections in this Milvus instance.
Run the following command to check the details of the
describe collection -c car
Run the following command to import data into the
import -c car 'https://raw.githubusercontent.com/zilliztech/milvus_cli/main/examples/import_csv/vectors.csv'
query and enter
car as the collection name and
id>0 as the query expression when prompted. The IDs of the entities that meet the criteria are returned as shown in the following figure.
calc and enter appropriate values when prompted to calculate the distances between vector arrays.
Run the following command to delete the
delete collection -c car
Milvus_CLI is not limited to the preceding functions. Run
help to view all commands that Milvus_CLI includes and the respective descriptions. Run
<command> --help to view the details of a specified command.
Milvus_CLI Command Reference on GitHub
Milvus_CLI Command Reference under Milvus Docs
We hope Milvus_CLI could help you easily use the Milvus vector database. We will keep optimizing Milvus_CLI and your contributions are welcome.
If you have any questions, feel free to file an issue on GitHub.
Like the article? Spread the word
Follow our step-by-step guide to perform a Milvus 2.1 benchmark by yourself.
A Python user-friendly Milvus version that makes installation more flexible.
Use string data to streamline the process of building your own similarity search applications.