Connections

connect()

This method connects the client to a Milvus connection.

Invocation

connect(alias, **kwargs)

Parameters

ParameterDescriptionTypeRequired
aliasConnection aliasStringTrue
kwargs
  • host
  • port
  • user
  • password

  • IP address of the Milvus connection
  • Port of the Milvus connection
  • Authenticate username
  • Password of the authenticate user

  • String
  • Integer
  • String
  • String

  • True
  • True
  • False
  • False

Return

No return.

Raises

  • NotImplementedError -- error if the handler in connection parameters is not gRPC.
  • ParamError -- error if the parameter is invalid.
  • Exception -- error if the server specified in parameters is not ready.

Example

from pymilvus import connections
connections.connect(
  alias="default", 
  host='localhost', 
  port='19530'
)

add_connection()

This method adds a Milvus connection.

Invocation

add_connection(**kwargs)

Parameters

ParameterDescriptionTypeRequired
kwargs
  • alias
  • host
  • port

  • Connection alias
  • IP address of the Milvus connection
  • Port of the Milvus connection

  • String
  • String
  • Integer

  • True
  • True
  • True

Return

No return.

Raises

Example

from pymilvus import connections
connections.add_connection(
  default={"host": "localhost", "port": "19530"}
)

disconnect()

This method disconnects the client from the specified Milvus connection.

Invocation

disconnect(alias)

Parameters

ParameterDescriptionTypeRequired
aliasAlias of the connection to disconnect fromStringTrue

Return

No return.

Raises

Example

from pymilvus import connections
connections.disconnect("default")

get_connection_addr()

This method retrieves the configuration of the specified Milvus connection.

Invocation

get_connection_addr(alias)

Parameters

ParameterDescriptionTypeRequired
aliasAlias of the connection to retrieveStringTrue

Return

The configuration of the specified Milvus connection

Raises

Example

from pymilvus import connections
connections.get_connection_addr("default")

list_connections()

This methods lists all Milvus connections.

Invocation

list_connections()

Parameters

Return

A list of names of all Milvus connections.

Raises

Example

from pymilvus import connections
connections.list_connections()

remove_connection()

This method removes the specified Milvus connection.

Invocation

remove_connection(alias)

Parameters

ParameterDescriptionTypeRequired
aliasAlias of the connection to removeStringTrue

Return

No return.

Raises

Example

from pymilvus import connections
connections.remove_connection("default")