# MilvusClientV2

Package io.milvus.v2.client

## Class MilvusClientV2

- java.lang.Object
- - io.milvus.v2.client.MilvusClientV2

    public class MilvusClientV2
    extends java.lang.Object

### Constructor Summary

Constructors
`MilvusClientV2​(ConnectConfig connectConfig)` Creates a Milvus client instance.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `alterAlias​(AlterAliasReq request)` alter aliases
`void` `close​(long maxWaitSeconds)` close client
`void` `createAlias​(CreateAliasReq request)` create aliases
`void` `createCollection​(CreateCollectionReq request)` Creates a collection in Milvus.
`void` `createIndex​(CreateIndexReq request)` Creates an index for a specified field in a collection in Milvus.
`void` `createPartition​(CreatePartitionReq request)` Creates a partition in a collection in Milvus.
`void` `createRole​(CreateRoleReq request)` create role
`CreateCollectionReq.CollectionSchema` `createSchema()` Creates a collection schema.
`void` `createUser​(CreateUserReq request)` create user
`DeleteResp` `delete​(DeleteReq request)` Deletes vectors in a collection in Milvus.
`DescribeAliasResp` `describeAlias​(DescribeAliasReq request)` describe aliases
`DescribeCollectionResp` `describeCollection​(DescribeCollectionReq request)` Gets the collection info in Milvus.
`DescribeIndexResp` `describeIndex​(DescribeIndexReq request)` Checks whether an index exists for a specified field in a collection in Milvus.
`DescribeRoleResp` `describeRole​(DescribeRoleReq request)` describe role
`DescribeUserResp` `describeUser​(DescribeUserReq request)` describe user
`void` `dropAlias​(DropAliasReq request)` drop aliases
`void` `dropCollection​(DropCollectionReq request)` Drops a collection in Milvus.
`void` `dropIndex​(DropIndexReq request)` Drops an index for a specified field in a collection in Milvus.
`void` `dropPartition​(DropPartitionReq request)` Drops a partition in a collection in Milvus.
`void` `dropRole​(DropRoleReq request)` drop role
`void` `dropUser​(DropUserReq request)` drop user
`GetResp` `get​(GetReq request)` Gets vectors in a collection in Milvus.
`GetCollectionStatsResp` `getCollectionStats​(GetCollectionStatsReq request)` get collection stats for a collection in Milvus.
`java.lang.Boolean` `getLoadState​(GetLoadStateReq request)` Checks whether a collection is loaded in Milvus.
`void` `grantPrivilege​(GrantPrivilegeReq request)` grant privilege
`void` `grantRole​(GrantRoleReq request)` grant role
`java.lang.Boolean` `hasCollection​(HasCollectionReq request)` Checks whether a collection exists in Milvus.
`java.lang.Boolean` `hasPartition​(HasPartitionReq request)` Checks whether a partition exists in a collection in Milvus.
`InsertResp` `insert​(InsertReq request)` Inserts vectors into a collection in Milvus.
`ListAliasResp` `listAliases​(ListAliasesReq request)` list aliases
`ListCollectionsResp` `listCollections()` list milvus collections
`java.util.List<java.lang.String>` `listIndexes​(ListIndexesReq request)` Lists all indexes in a collection in Milvus.
`java.util.List<java.lang.String>` `listPartitions​(ListPartitionsReq request)` Lists all partitions in a collection in Milvus.
`java.util.List<java.lang.String>` `listRoles()` list roles
`java.util.List<java.lang.String>` `listUsers()` list users
`void` `loadCollection​(LoadCollectionReq request)` Loads a collection into memory in Milvus.
`void` `loadPartitions​(LoadPartitionsReq request)` Loads partitions in a collection in Milvus.
`QueryResp` `query​(QueryReq request)` Queries vectors in a collection in Milvus.
`void` `releaseCollection​(ReleaseCollectionReq request)` Releases a collection from memory in Milvus.
`void` `releasePartitions​(ReleasePartitionsReq request)` Releases partitions in a collection in Milvus.
`void` `renameCollection​(RenameCollectionReq request)` rename collection in a collection in Milvus.
`void` `revokePrivilege​(RevokePrivilegeReq request)` revoke privilege
`void` `revokeRole​(RevokeRoleReq request)` revoke role
`SearchResp` `search​(SearchReq request)` Searches vectors in a collection in Milvus.
`void` `updatePassword​(UpdatePasswordReq request)` change password
`UpsertResp` `upsert​(UpsertReq request)` Upsert vectors into a collection in Milvus.
`void` `useDatabase​(@NonNull java.lang.String dbName)` use Database

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### MilvusClientV2

    public MilvusClientV2​(ConnectConfig connectConfig)

Creates a Milvus client instance.

Parameters:
  `connectConfig` - Milvus server connection configuration

### Method Detail

#### useDatabase

    public void useDatabase​(@NonNull
                            @NonNull java.lang.String dbName)

use Database

Parameters:
  `dbName` - databaseName

#### createCollection

    public void createCollection​(CreateCollectionReq request)

Creates a collection in Milvus.

Parameters:
  `request` - create collection request

#### createSchema

    public CreateCollectionReq.CollectionSchema createSchema()

Creates a collection schema.

Returns:
  CreateCollectionReq.CollectionSchema

#### listCollections

    public ListCollectionsResp listCollections()

list milvus collections

Returns:
  List<String> collection names

#### dropCollection

    public void dropCollection​(DropCollectionReq request)

Drops a collection in Milvus.

Parameters:
  `request` - drop collection request

#### hasCollection

    public java.lang.Boolean hasCollection​(HasCollectionReq request)

Checks whether a collection exists in Milvus.

Parameters:
  `request` - has collection request
Returns:
  Boolean

#### describeCollection

    public DescribeCollectionResp describeCollection​(DescribeCollectionReq request)

Gets the collection info in Milvus.

Parameters:
  `request` - describe collection request
Returns:
  DescribeCollectionResp

#### getCollectionStats

    public GetCollectionStatsResp getCollectionStats​(GetCollectionStatsReq request)

get collection stats for a collection in Milvus.

Parameters:
  `request` - get collection stats request
Returns:
  GetCollectionStatsResp

#### renameCollection

    public void renameCollection​(RenameCollectionReq request)

rename collection in a collection in Milvus.

Parameters:
  `request` - rename collection request

#### loadCollection

    public void loadCollection​(LoadCollectionReq request)

Loads a collection into memory in Milvus.

Parameters:
  `request` - load collection request

#### releaseCollection

    public void releaseCollection​(ReleaseCollectionReq request)

Releases a collection from memory in Milvus.

Parameters:
  `request` - release collection request

#### getLoadState

    public java.lang.Boolean getLoadState​(GetLoadStateReq request)

Checks whether a collection is loaded in Milvus.

Parameters:
  `request` - get load state request
Returns:
  Boolean

#### createIndex

    public void createIndex​(CreateIndexReq request)

Creates an index for a specified field in a collection in Milvus.

Parameters:
  `request` - create index request

#### dropIndex

    public void dropIndex​(DropIndexReq request)

Drops an index for a specified field in a collection in Milvus.

Parameters:
  `request` - drop index request

#### describeIndex

    public DescribeIndexResp describeIndex​(DescribeIndexReq request)

Checks whether an index exists for a specified field in a collection in Milvus.

Parameters:
  `request` - describe index request
Returns:
  DescribeIndexResp

#### listIndexes

    public java.util.List<java.lang.String> listIndexes​(ListIndexesReq request)

Lists all indexes in a collection in Milvus.

#### insert

    public InsertResp insert​(InsertReq request)

Inserts vectors into a collection in Milvus.

Parameters:
  `request` - insert request
Returns:
  InsertResp

#### upsert

    public UpsertResp upsert​(UpsertReq request)

Upsert vectors into a collection in Milvus.

Parameters:
  `request` - upsert request
Returns:
  UpsertResp

#### delete

    public DeleteResp delete​(DeleteReq request)

Deletes vectors in a collection in Milvus.

Parameters:
  `request` - delete request
Returns:
  DeleteResp

#### get

    public GetResp get​(GetReq request)

Gets vectors in a collection in Milvus.

Parameters:
  `request` - get request
Returns:
  GetResp

#### query

    public QueryResp query​(QueryReq request)

Queries vectors in a collection in Milvus.

Parameters:
  `request` - query request
Returns:
  QueryResp

#### search

    public SearchResp search​(SearchReq request)

Searches vectors in a collection in Milvus.

Parameters:
  `request` - search request
Returns:
  SearchResp

#### createPartition

    public void createPartition​(CreatePartitionReq request)

Creates a partition in a collection in Milvus.

Parameters:
  `request` - create partition request

#### dropPartition

    public void dropPartition​(DropPartitionReq request)

Drops a partition in a collection in Milvus.

Parameters:
  `request` - drop partition request

#### hasPartition

    public java.lang.Boolean hasPartition​(HasPartitionReq request)

Checks whether a partition exists in a collection in Milvus.

Parameters:
  `request` - has partition request
Returns:
  Boolean

#### listPartitions

    public java.util.List<java.lang.String> listPartitions​(ListPartitionsReq request)

Lists all partitions in a collection in Milvus.

Parameters:
  `request` - list partitions request
Returns:
  List<String> partition names

#### loadPartitions

    public void loadPartitions​(LoadPartitionsReq request)

Loads partitions in a collection in Milvus.

Parameters:
  `request` - load partitions request

#### releasePartitions

    public void releasePartitions​(ReleasePartitionsReq request)

Releases partitions in a collection in Milvus.

Parameters:
  `request` - release partitions request

#### listUsers

    public java.util.List<java.lang.String> listUsers()

list users

Returns:
  List<String> usernames

#### describeUser

    public DescribeUserResp describeUser​(DescribeUserReq request)

describe user

Parameters:
  `request` - describe user request
Returns:
  DescribeUserResp

#### createUser

    public void createUser​(CreateUserReq request)

create user

Parameters:
  `request` - create user request

#### updatePassword

    public void updatePassword​(UpdatePasswordReq request)

change password

Parameters:
  `request` - change password request

#### dropUser

    public void dropUser​(DropUserReq request)

drop user

Parameters:
  `request` - drop user request

#### listRoles

    public java.util.List<java.lang.String> listRoles()

list roles

Returns:
  List<String> role names

#### describeRole

    public DescribeRoleResp describeRole​(DescribeRoleReq request)

describe role

Parameters:
  `request` - describe role request
Returns:
  DescribeRoleResp

#### createRole

    public void createRole​(CreateRoleReq request)

create role

Parameters:
  `request` - create role request

#### dropRole

    public void dropRole​(DropRoleReq request)

drop role

Parameters:
  `request` - drop role request

#### grantPrivilege

    public void grantPrivilege​(GrantPrivilegeReq request)

grant privilege

Parameters:
  `request` - grant privilege request

#### revokePrivilege

    public void revokePrivilege​(RevokePrivilegeReq request)

revoke privilege

Parameters:
  `request` - revoke privilege request

#### grantRole

    public void grantRole​(GrantRoleReq request)

grant role

Parameters:
  `request` - grant role request

#### revokeRole

    public void revokeRole​(RevokeRoleReq request)

revoke role

Parameters:
  `request` - revoke role request

#### createAlias

    public void createAlias​(CreateAliasReq request)

create aliases

#### dropAlias

    public void dropAlias​(DropAliasReq request)

drop aliases

#### alterAlias

    public void alterAlias​(AlterAliasReq request)

alter aliases

#### listAliases

    public ListAliasResp listAliases​(ListAliasesReq request)

list aliases

Returns:
  List<String> alias names

#### describeAlias

    public DescribeAliasResp describeAlias​(DescribeAliasReq request)

describe aliases

Returns:
  DescribeAliasResp

#### close

    public void close​(long maxWaitSeconds)
               throws java.lang.InterruptedException

close client

Parameters:
  `maxWaitSeconds` - max wait seconds
Throws:
  `java.lang.InterruptedException`