milvus-logo

Milvus_CLI Command Reference

Milvus Command-Line Interface (CLI) is a command-line tool that supports database connection, data operations, and import and export of data.

This topic introduces all supported commands and the corresponding options. Some examples are also included for your reference.

clear

Clears the screen.

Syntax

clear

Options

Option Full name Description
--help n/a Displays help for using the command.

connect

Connects to Milvus.

Syntax

connect [-uri (text)] [-t (text)]

Options

Option Full name Description
-uri --uri (Optional) The uri name. The default is "http://127.0.0.1:19530".
-t --token (Optional) The zilliz cloud apikey or username:password. The default is None.
--help n/a Displays help for using the command.

Example

milvus_cli > connect -uri http://127.0.0.1:19530 

create Database

Create Database in Milvus

Syntax

create database -db (text) 

Options

Option Full name Description
-db --database [Required] The database name in milvus.
--help n/a Displays help for using the command.

Examples

Example 1

The following example create the database testdb in milvus.

milvus_cli > create database -db testdb

use Database

Use Database in Milvus

Syntax

use database -db (text) 

Options

Option Full name Description
-db --database [Required] The database name in milvus.
--help n/a Displays help for using the command.

Examples

Example 1

The following example use the database testdb in milvus.

milvus_cli > use database -db testdb

List Databases

List Databases in Milvus

Syntax

list databases 

Examples

Example 1

The following example list the databases in milvus.

milvus_cli > list databases

Delete Database

Delete Database in Milvus

Syntax

delete database -db (text) 

Options

Option Full name Description
-db --database [Required] The database name in milvus.
--help n/a Displays help for using the command.

Examples

Example 1

The following example delete the database testdb in milvus.

milvus_cli > delete database -db testdb

create user

Create user in Milvus

Syntax

create user -u (text) -p (text)

Options

Option Full name Description
-p --password The user password in milvus. The default is "None".
-u --username The username in milvus. The default is "None".
--help n/a Displays help for using the command.

Examples

Example 1

The following example create the user zilliz and password zilliz in milvus.

milvus_cli > create user -u zilliz -p zilliz

create alias

Specifies unique aliases for a collection.

A collection can have multiple aliases. However, an alias corresponds to a maximum of one collection.

Syntax

create alias -c (text) -a (text) [-A] 

Options

Option Full name Description
-c --collection-name The name of the collection.
-a --alias-name The alias.
-A --alter (Optional) Flag to transfer the alias to a specified collection.
--help n/a Displays help for using the command.

Examples

Example 1

The following example creates the carAlias1 and carAlias2 aliases for the car collection.

milvus_cli > create alias -c car -a carAlias1

Example 2

Example 2 is based on Example 1.

The following example transfers the carAlias1 alias from the car collection to the car2 collection.

milvus_cli > create alias -c car2 -A -a carAlias1

create collection

Creates a collection.

Syntax

create collection -c (text) -f (text) -p (text) [-a] [-d (text)]

Options

Option Full name Description
-c --collection-name The nam of the collection.
-f --schema-field (Multiple) The field schema in the <fieldName>:<dataType>:<dimOfVector/desc> format.
-p --schema-primary-field The name of the primary key field.
-a --schema-auto-id (Optional) Flag to generate IDs automatically.
-desc --schema-description (Optional) The description of the collection.
-level --consistency-level (Optional) Consistency level: Bounded,Session,Strong, Eventual .
-d --is-dynamic (Optional) Collection schema supports dynamic fields or not.
-s --shards-num (Optional) Shards number
--help n/a Displays help for using the command.

Example

## For array field: --schema-field support <fieldName>:<dataType>:<maxCapacity>:<elementDataType>(:<maxLength>if Varchar)

milvus_cli > create collection -c car -f id:INT64:primary_field -f vector:FLOAT_VECTOR:128 -f color:INT64:color -f brand:ARRAY:64:VARCHAR:128 -p id -A -d 'car_collection'

create partition

Creates a partition.

Syntax

create partition -c (text) -p (text) [-d (text)]

Options

Option Full name Description
-c --collection-name The name of the collection.
-p --partition The partition name.
-d --description (Optional) The description of the partition.
--help n/a Displays help for using the command.

Example

milvus_cli > create partition -c car -p new_partition -d test_add_partition

create index

Creates an index for a field.

Currently, a collection supports a maximum of one index.

Syntax

create index

Options

Option Full name Description
--help n/a Displays help for using the command.

Example

To create an index for a field and be prompted for the required input:

milvus_cli > create index

Collection name (car, car2): car2

The name of the field to create an index for (vector): vector

Index name: vectorIndex

# Default is ''
Index type (FLAT, IVF_FLAT, IVF_SQ8, IVF_PQ, RNSG, HNSW, ANNOY, AUTOINDEX, DISKANN, GPU_IVF_FLAT, GPU_IVF_PQ, SCANN, STL_SORT, Trie, ) []: IVF_FLAT  

# Default is ''
Index metric type (L2, IP, HAMMING, TANIMOTO, COSINE, ) []: 

Timeout []:

delete user

Deletes a user

Syntax

delete user -u (text)

Options

Option Full name Description
-u --username The username.
--help n/a Displays help for using the command.

Example

milvus_cli > delete user -u zilliz

delete alias

Deletes an alias.

Syntax

delete alias -a (text) 

Options

Option Full name Description
-a --alias-name The alias.
--help n/a Displays help for using the command.

delete collection

Deletes a collection.

Syntax

delete collection -c (text) 

Options

Option Full name Description
-c --collection-name The name of the collection to be deleted.
--help n/a Displays help for using the command.

Example

milvus_cli > delete collection -c car

delete entities

Deletes entities.

Syntax

delete entities -c (text) -p (text) 

Options

Option Full name Description
-c --collection-name The name of the collection that entities to be deleted belongs to.
-p --partition (Optional) The name of the partition to be deleted.
--help n/a Displays help for using the command.

Example

milvus_cli > delete entities -c car

The expression to specify entities to be deleted, such as "film_id in [ 0, 1 ]": film_id in [ 0, 1 ]

You are trying to delete the entities of collection. This action cannot be undone!

Do you want to continue? [y/N]: y

delete partition

Deletes a partition.

Syntax

delete partition -c (text) -p (text)

Options

Option Full name Description
-c --collection-name The name of the collection that the partition to be deleted belongs to.
-p --partition The name of the partition to be deleted.
--help n/a Displays help for using the command.

Example

milvus_cli > delete partition -c car -p new_partition

delete index

Deletes an index and the corresponding index files.

Currently, a collection supports a maximum of one index.

Syntax

delete index -c (text) -in (text)

Options

Option Full name Description
-c --collection-name The name of the collection.
-in --index-name The name of the index name.
--help n/a Displays help for using the command.

Example

milvus_cli > delete index -c car -in indexName

show collection

Shows the detailed information of a collection.

Syntax

show collection -c (text)

Options

Option Full name Description
-c --collection-name The name of the collection.
--help n/a Displays help for using the command.

Example

milvus_cli > show collection -c test_collection_insert

show partition

Shows the detailed information of a partition.

Syntax

show partition -c (text) -p (text)

Options

Option Full name Description
-c --collection-name The name of the collection that the partition belongs to.
-p --partition The name of the partition.
--help n/a Displays help for using the command.

Example

milvus_cli > show partition -c test_collection_insert -p _default

show index

Shows the detailed information of an index.

Syntax

show index -c (text) -in (text)

Options

Option Full name Description
-c --collection-name The name of the collection.
-in --index-name The name of the index.

| --help | n/a | Displays help for using the command. |

Example

milvus_cli > show index -c test_collection -in index_name

exit

Closes the command line window.

Syntax

exit

Options

Option Full name Description
--help n/a Displays help for using the command.

help

Displays help for using a command.

Syntax

help <command>

Commands

Command Description
clear Clears the screen.
connect Connects to Milvus.
create Create collection, database, partition,user and index.
delete Delete collection, database, partition,alias,user or index.
exit Closes the command line window.
help Displays help for using a command.
insert Imports data into a partition.
list List collections,databases, partitions,users or indexes.
load Loads a collection or partition.
query Shows query results that match all the criteria that you enter.
release Releases a collection or partition.
search Performs a vector similarity search or hybrid search.
show Show connection, database,collection, loading_progress or index_progress.
rename Rename collection
use Use database
version Shows the version of Milvus_CLI.

import

Imports local or remote data into a partition.

Syntax

import -c (text)[-p (text)] <file_path>

Options

Option Full name Description
-c --collection-name The name of the collection that the data are inserted into.
-p --partition (Optional) The name of the partition that the data are inserted into. Not passing this partition option indicates choosing the "_default" partition.
--help n/a Displays help for using the command.

Example 1

The following example imports a local CSV file.
milvus_cli > import -c car 'examples/import_csv/vectors.csv'

Reading csv file...  [####################################]  100%

Column names are ['vector', 'color', 'brand']

Processed 50001 lines.

Inserting ...

Insert successfully.
--------------------------  ------------------
Total insert entities:                   50000
Total collection entities:              150000
Milvus timestamp:           428849214449254403
--------------------------  ------------------

Example 2

The following example imports a remote CSV file.
milvus_cli > import -c car 'https://raw.githubusercontent.com/milvus-
io/milvus_cli/main/examples/import_csv/vectors.csv'

Reading file from remote URL.

Reading csv file...  [####################################]  100%

Column names are ['vector', 'color', 'brand']

Processed 50001 lines.

Inserting ...

Insert successfully.

--------------------------  ------------------
Total insert entities:                   50000
Total collection entities:              150000
Milvus timestamp:           428849214449254403
--------------------------  ------------------

list users

Lists all users.

Syntax

list users

Options

| Option | Full name | Description | | --help | n/a | Displays help for using the command. |

list collections

Lists all collections.

Syntax

list collections

Options

Option Full name Description
--help n/a Displays help for using the command.

list indexes

Lists all indexes for a collection.

Currently, a collection supports a maximum of one index.

Syntax

list indexes -c (text)

Options

Option Full name Description
-c --collection-name The name of the collection.
--help n/a Displays help for using the command.

list partitions

Lists all partitions of a collection.

Syntax

list partitions -c (text)

Options

Option Full name Description
-c --collection-name The name of the collection.
--help n/a Displays help for using the command.

load

Loads a collection or partition from hard drive space into RAM.

Syntax

load -c (text) [-p (text)]

Options

Option Full name Description
-c --collection-name The name of the collection that the partition belongs to.
-p --partition (Optional/Multiple) The name of the partition.
--help n/a Displays help for using the command.

query

Shows query results that match all the criteria that you enter.

Syntax

query

Options

Option Full name Description
--help n/a Displays help for using the command.

Example

Example 1

To perform a query and be prompted for the required input:

milvus_cli > query

Collection name: car

The query expression: id in [ 428960801420883491, 428960801420883492,
428960801420883493 ]

Name of partitions that contain entities(split by "," if multiple) []:
default

A list of fields to return(split by "," if multiple) []: color, brand

timeout []:

Guarantee timestamp. This instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date. [0]:
Graceful time. Only used in bounded consistency level. If graceful_time is set, PyMilvus will use current timestamp minus the graceful_time as the guarantee_timestamp. This option is 5s by default if not set. [5]:

Example 2

To perform a query and be prompted for the required input:

milvus_cli > query

Collection name: car

The query expression: id > 428960801420883491

Name of partitions that contain entities(split by "," if multiple) []:
default

A list of fields to return(split by "," if multiple) []: id, color,
brand

timeout []:

Guarantee timestamp. This instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date. [0]:
Graceful time. Only used in bounded consistency level. If graceful_time is set, PyMilvus will use current timestamp minus the graceful_time as the guarantee_timestamp. This option is 5s by default if not set. [5]:

release

Releases a collection or partition from RAM.

Syntax

release -c (text) [-p (text)]

Options

Option Full name Description
-c --collection-name The name of the collection that the partition belongs to.
-p --partition (Optional/Multiple) The name of the partition.
--help n/a Displays help for using the command.

Performs a vector similarity search or hybrid search.

search
Option Full name Description
--help n/a Displays help for using the command.

To perform a search on a csv file and be prompted for the required input:

milvus_cli > search

Collection name (car, test_collection): car

The vectors of search data(the length of data is number of query (nq), the dim of every vector in data must be equal to vector field’s of collection. You can also import a csv file
out headers): examples/import_csv/search_vectors.csv

The vector field used to search of collection (vector): vector

Metric type: L2

Search parameter nprobe's value: 10

The max number of returned record, also known as topk: 2

The boolean expression used to filter attribute []: id > 0

The names of partitions to search (split by "," if multiple) ['_default'] []: _default

timeout []:

Guarantee Timestamp(It instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date) [0]:

To perform a search on an indexed collection and be prompted for the required input:

milvus_cli > search

Collection name (car, test_collection): car

The vectors of search data(the length of data is number of query (nq), the dim of every vector in data must be equal to vector field’s of collection. You can also import a csv file without headers):
    [[0.71, 0.76, 0.17, 0.13, 0.42, 0.07, 0.15, 0.67, 0.58, 0.02, 0.39, 0.47, 0.58, 0.88, 0.73, 0.31, 0.23, 0.57, 0.33, 0.2, 0.03, 0.43, 0.78, 0.49, 0.17, 0.56, 0.76, 0.54, 0.45, 0.46, 0.05, 0.1, 0.43, 0.63, 0.29, 0.44, 0.65, 0.01, 0.35, 0.46, 0.66, 0.7, 0.88, 0.07, 0.49, 0.92, 0.57, 0.5, 0.16, 0.77, 0.98, 0.1, 0.44, 0.88, 0.82, 0.16, 0.67, 0.63, 0.57, 0.55, 0.95, 0.13, 0.64, 0.43, 0.71, 0.81, 0.43, 0.65, 0.76, 0.7, 0.05, 0.24, 0.03, 0.9, 0.46, 0.28, 0.92, 0.25, 0.97, 0.79, 0.73, 0.97, 0.49, 0.28, 0.64, 0.19, 0.23, 0.51, 0.09, 0.1, 0.53, 0.03, 0.23, 0.94, 0.87, 0.14, 0.42, 0.82, 0.91, 0.11, 0.91, 0.37, 0.26, 0.6, 0.89, 0.6, 0.32, 0.11, 0.98, 0.67, 0.12, 0.66, 0.47, 0.02, 0.15, 0.6, 0.64, 0.57, 0.14, 0.81, 0.75, 0.11, 0.49, 0.78, 0.16, 0.63, 0.57, 0.18]]

The vector field used to search of collection (vector): vector

Metric type: L2

Search parameter nprobe's value: 10

The specified number of decimal places of returned distance [-1]: 5

The max number of returned record, also known as topk: 2

The boolean expression used to filter attribute []: id > 0

The names of partitions to search (split by "," if multiple) ['_default'] []: _default

timeout []:

Guarantee Timestamp(It instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date) [0]:

To perform a search on a non-indexed collection and be prompted for the required input:

milvus_cli > search

Collection name (car, car2): car

The vectors of search data(the length of data is number of query (nq), the dim of every vector in data must be equal to vector field’s of collection. You can also import a csv file without headers): examples/import_csv/search_vectors.csv

The vector field used to search of collection (vector): vector

The specified number of decimal places of returned distance [-1]: 5

The max number of returned record, also known as topk: 2

The boolean expression used to filter attribute []:

The names of partitions to search (split by "," if multiple) ['_default'] []:

timeout []:

Guarantee Timestamp(It instructs Milvus to see all operations performed before a provided timestamp. If no such timestamp is provided, then Milvus will search all operations performed to date) [0]:

List connection

List connections.

Syntax

list connections 

Options

Option Full name Description
--help n/a Displays help for using the command.

show index_progress

Shows the progress of entity indexing.

Syntax

show index_progress -c (text) [-i (text)]

Options

Option Full name Description
-c --collection-name The name of the collection that the entities belong to.
-i --index (Optional) The name of the index.
--help n/a Displays help for using the command.

show loading_progress

Shows the progress of entity loading.

Syntax

show loading_progress -c (text) [-p (text)]

Options

Option Full name Description
-c --collection-name The name of the collection that the entities belong to.
-p --partition (Optional/Multiple) The name of the loading partition.
--help n/a Displays help for using the command.

version

Shows the version of Milvus_CLI.

Syntax

version

Options

Option Full name Description
--help n/a Displays help for using the command.
You can also check the version of Milvus_CLI in a shell as shown in the following example. In this case, milvus_cli --version acts as a command.

Example

$ milvus_cli --version
Milvus_CLI v0.4.0
On this page