🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz
Home
  • Tools

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.

Command Groups

Milvus CLI commands are organized into the following groups:

  • create: Create collection, database, partition, user, role, or index
  • delete: Delete collection, database, partition, alias, user, role, or index
  • list: List collections, databases, partitions, users, roles, grants, or indexes
  • show: Show connection, database, collection, loading_progress, or index_progress
  • grant: Grant role or privilege
  • revoke: Revoke role or privilege
  • load: Load collection or partition
  • release: Release collection or partition
  • use: Use database
  • rename: Rename collection
  • insert: Insert entities (file or row)

clear

Clears the screen.

Syntax

clear

Options

OptionFull nameDescription
–helpn/aDisplays help for using the command.

connect

Connects to Milvus.

Syntax

connect [-uri (text)] [-t (text)]
connect [-uri (text)] [-t (text)] [-tls (0|1)] [-cert (text)]

Options

OptionFull nameDescription
-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.
-tls–tlsmode(Optional) Set TLS mode: 0 (No encryption), 1 (One-way encryption), 2 (Two-way encryption not support yet). Default is 0
-cert–cert(Optional) Path to the client certificate file. Work with One-way encryption
–helpn/aDisplays 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

OptionFull nameDescription
-db–db_name[Required] The database name in milvus.
–helpn/aDisplays 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

OptionFull nameDescription
-db–db_name[Required] The database name in milvus.
–helpn/aDisplays 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

OptionFull nameDescription
-db–db_name[Required] The database name in milvus.
–helpn/aDisplays help for using the command.

Examples

Example 1

The following example delete the database testdb in milvus.

milvus_cli > delete database -db testdb

Warning! You are trying to delete the database. This action cannot be undone!
Do you want to continue? [y/N]: y

create user

Create user in Milvus

Syntax

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

Options

OptionFull nameDescription
-p–passwordThe user password in milvus. The default is "None".
-u–usernameThe username in milvus. The default is "None".
–helpn/aDisplays 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 role

Create role in Milvus

Syntax

create role -r (text)

Options

OptionFull nameDescription
-r–roleNameThe role name of milvus role.
–helpn/aDisplays help for using the command.

Examples

Example 1

The following example create the role role1 in milvus.

milvus_cli > create role -r role1

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

OptionFull nameDescription
-c–collection-nameThe name of the collection.
-a–alias-nameThe alias.
-A–alter(Optional) Flag to transfer the alias to a specified collection.
–helpn/aDisplays 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

Interactive Example

milvus_cli > create collection

Please input collection name: car
Please input auto id [False]: False
Please input description []: car collection
Is support dynamic field [False]: False
Please input consistency level(Strong(0),Bounded(1), Session(2), and Eventually(3)) [1]: 1
Please input shards number [1]: 1

Field name: id
Field type (INT64, VARCHAR, FLOAT_VECTOR, etc.): INT64
Field description []: primary key
Is id the primary key? [y/N]: y

Field name: vector
Field type (INT64, VARCHAR, FLOAT_VECTOR, etc.): FLOAT_VECTOR
Field description []: vector field
Dimension: 128

Field name: color
Field type (INT64, VARCHAR, FLOAT_VECTOR, etc.): INT64
Field description []: color field
Nullable [False]: False
Default value (type: INT64) [Not set]: 0

Do you want to add embedding function? [y/N]: n

create partition

Creates a partition.

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection.
-p–partitionThe partition name.
-d–description(Optional) The description of the partition.
–helpn/aDisplays 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

Interactive Example

milvus_cli > create index

Collection name (car, car2): car2
The name of the field to create an index for (vector): vector
Index name: vectorIndex
Index type (FLAT, IVF_FLAT, IVF_SQ8, IVF_PQ, RNSG, HNSW, ANNOY, AUTOINDEX, DISKANN, GPU_IVF_FLAT, GPU_IVF_PQ, SPARSE_INVERTED_INDEX, SCANN, STL_SORT, Trie, INVERTED): IVF_FLAT
Vector Index metric type (L2, IP, HAMMING, TANIMOTO, COSINE): L2
Index params nlist: 2
Timeout []:

delete user

Deletes a user

Syntax

delete user -u (text)

Options

OptionFull nameDescription
-u–usernameThe username.
–helpn/aDisplays help for using the command.

Example

milvus_cli > delete user -u zilliz

Warning! You are trying to delete the user in milvus. This action cannot be undone!
Do you want to continue? [y/N]: y

delete role

Delete role in Milvus

Syntax

delete role -r (text)

Options

OptionFull nameDescription
-r–roleNameThe role name of milvus role.
–helpn/aDisplays help for using the command.

Examples

The following example delete the role role1 in milvus.

milvus_cli > delete role -r role1

delete alias

Deletes an alias.

Syntax

delete alias -a (text)

Options

OptionFull nameDescription
-a–alias-nameThe alias.
–helpn/aDisplays help for using the command.

delete collection

Deletes a collection.

Syntax

delete collection -c (text)

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection to be deleted.
–helpn/aDisplays help for using the command.

Example

milvus_cli > delete collection -c car

Warning! You are trying to delete the collection. This action cannot be undone!
Do you want to continue? [y/N]: y

delete entities

Deletes entities.

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection that entities to be deleted belongs to.
-p–partition(Optional) The name of the partition to be deleted.
–helpn/aDisplays 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 ]

Warning! 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

OptionFull nameDescription
-c–collection-nameThe name of the collection that the partition to be deleted belongs to.
-p–partitionThe name of the partition to be deleted.
–helpn/aDisplays 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

OptionFull nameDescription
-c–collection-nameThe name of the collection.
-in–index-nameThe name of the index name.
–helpn/aDisplays help for using the command.

Example

milvus_cli > delete index -c car -in indexName

Warning! You are trying to delete the index of collection. This action cannot be undone!
Do you want to continue? [y/N]: y

grant role

Grant role to user

Syntax

grant role -r (text) -u (text)

Options

OptionFull nameDescription
-r–roleNameThe role name of milvus role.
-u–usernameThe username of milvus user.
–helpn/aDisplays help for using the command.

Example

milvus_cli > grant role -r role1 -u user1

grant privilege

Assigns a privilege to a role.

Syntax

grant privilege

Interactive Example

milvus_cli > grant privilege

Role name: role1
The type of object for which the privilege is to be assigned. (Global, Collection, User): Collection
The name of the object to control access for: object1
The name of the privilege to assign. (CreateCollection, DropCollection, etc.): CreateCollection
The name of the database to which the object belongs. [default]: default

revoke role

Revokes the role assigned to a user.

Syntax

revoke role -r (text) -u (text)

Options

OptionFull nameDescription
-r–roleNameThe role name of milvus role.
-u–usernameThe username of milvus user.
–helpn/aDisplays help for using the command.

Example

milvus_cli > revoke role -r role1 -u user1

revoke privilege

Revokes a privilege already assigned to a role.

Syntax

revoke privilege

Interactive Example

milvus_cli > revoke privilege

Role name: role1
The type of object for which the privilege is to be assigned. (Global, Collection, User): Collection
The name of the object to control access for: object1
The name of the privilege to assign. (CreateCollection, DropCollection, etc.): CreateCollection
The name of the database to which the object belongs. [default]: default

show collection

Shows the detailed information of a collection.

Syntax

show collection -c (text)

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection.
–helpn/aDisplays 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

OptionFull nameDescription
-c–collection-nameThe name of the collection that the partition belongs to.
-p–partitionThe name of the partition.
–helpn/aDisplays 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

OptionFull nameDescription
-c–collection-nameThe name of the collection.
-in–index-nameThe 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

OptionFull nameDescription
–helpn/aDisplays help for using the command.

help

Displays help for using a command.

Syntax

help <command>

Commands

CommandDescription
clearClears the screen.
connectConnects to Milvus.
createCreate collection, database, partition,user,role and index.
grantGrant role, privilege .
revokeRevoke role, privilege .
deleteDelete collection, database, partition,alias,user,role or index.
exitCloses the command line window.
helpDisplays help for using a command.
insertImports data into a partition.
listList collections,databases, partitions,users,roles,grants or indexes.
loadLoads a collection or partition.
queryShows query results that match all the criteria that you enter.
releaseReleases a collection or partition.
searchPerforms a vector similarity search or hybrid search.
showShow connection, database,collection, loading_progress or index_progress.
renameRename collection
useUse database
versionShows the version of Milvus_CLI.

insert

Imports local or remote data into a partition.

Syntax

insert file -c (text) [-p (text)] [-t (text)] <file_path>

Options

OptionFull nameDescription
-c–collection-nameThe 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.
-t–timeout(Optional) An optional duration of time in seconds to allow for the RPC. If timeout is not set, the client keeps waiting until the server responds or an error occurs.
–helpn/aDisplays help for using the command.

Example 1

The following example imports a local CSV file.

milvus_cli > insert file -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 > insert file -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
--------------------------  ------------------

insert row

Inserts a row of data into a collection.

Syntax

insert row

Interactive Example

milvus_cli > insert row

Collection name: car
Partition name [_default]: _default
Enter value for id (INT64): 1
Enter value for vector (FLOAT_VECTOR): [1.0, 2.0, 3.0]
Enter value for color (INT64): 100
Enter value for brand (VARCHAR): Toyota

Inserted successfully.

list users

Lists all users.

Syntax

list users

Options

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

List roles

List roles in Milvus

Syntax

list roles

Options

OptionFull nameDescription
–helpn/aDisplays help for using the command.

Examples

milvus_cli > list roles

List grants

List grants in Milvus

Options

OptionFull nameDescription
-r–roleNameThe role name of milvus role.
-o–objectNameThe object name of milvus object.
-t–objectTypeGlobal, Collection or User.
–helpn/aDisplays help for using the command.

Examples

milvus_cli > list grants -r role1 -o object1 -t Collection

list collections

Lists all collections.

Syntax

list collections

Options

OptionFull nameDescription
–helpn/aDisplays 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

OptionFull nameDescription
-c–collection-nameThe name of the collection.
–helpn/aDisplays help for using the command.

list partitions

Lists all partitions of a collection.

Syntax

list partitions -c (text)

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection.
–helpn/aDisplays help for using the command.

load

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

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection that the partition belongs to.
-p–partition(Optional/Multiple) The name of the partition.
–helpn/aDisplays help for using the command.

query

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

Syntax

query

Interactive Example

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]:

release

Releases a collection or partition from RAM.

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection that the partition belongs to.
-p–partition(Optional/Multiple) The name of the partition.
–helpn/aDisplays help for using the command.

Performs a vector similarity search or hybrid search.

search

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): examples/import_csv/search_vectors.csv

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

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]:

list connection

List connections.

Syntax

list connections

Options

OptionFull nameDescription
–helpn/aDisplays help for using the command.

show index_progress

Shows the progress of entity indexing.

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection that the entities belong to.
-i–index(Optional) The name of the index.
–helpn/aDisplays help for using the command.

show loading_progress

Displays the progress of loading a collection.

Syntax

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

Options

OptionFull nameDescription
-c–collection-nameThe name of the collection that the entities belong to.
-p–partition(Optional/Multiple) The name of the loading partition.
–helpn/aDisplays help for using the command.

version

Shows the version of Milvus_CLI.

Syntax

version

Options

OptionFull nameDescription
–helpn/aDisplays 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