From 737f327d065b74d06272fe6e8260cf0e09fb76e4 Mon Sep 17 00:00:00 2001 From: AnthonyTsu1984 <115786031+AnthonyTsu1984@users.noreply.github.com> Date: Thu, 28 Nov 2024 10:56:19 +0800 Subject: [PATCH] update docs Signed-off-by: AnthonyTsu1984 <115786031+AnthonyTsu1984@users.noreply.github.com> --- .../v2.4.x/v1/Alias/alterAlias.md | 75 +++++ .../v2.4.x/v1/Alias/createAlias.md | 75 +++++ .../v2.4.x/v1/Alias/dropAlias.md | 69 +++++ .../v2.4.x/v1/Alias/listAliases.md | 69 +++++ .../v1/Authentication/createCredential.md | 70 +++++ .../v1/Authentication/deleteCredential.md | 64 ++++ .../v2.4.x/v1/Authentication/listCredUsers.md | 53 ++++ .../v1/Authentication/updateCredential.md | 82 ++++++ .../v2.4.x/v1/BulkInsertOps/bulkInsert.md | 85 ++++++ .../v1/BulkInsertOps/getBulkInsertState.md | 194 ++++++++++++ .../v1/BulkInsertOps/listBulkInsertTasks.md | 70 +++++ .../v2.4.x/v1/BulkWriter/LocalBulkWriter.md | 123 ++++++++ .../v2.4.x/v1/BulkWriter/RemoteBulkWriter.md | 258 ++++++++++++++++ .../v2.4.x/v1/Collection/alterCollection.md | 85 ++++++ .../v2.4.x/v1/Collection/createCollection.md | 261 ++++++++++++++++ .../v2.4.x/v1/Collection/delete.md | 82 ++++++ .../v1/Collection/describeCollection.md | 152 ++++++++++ .../v2.4.x/v1/Collection/dropCollection.md | 76 +++++ .../v2.4.x/v1/Collection/flush.md | 98 ++++++ .../v1/Collection/getCollectionStatistics.md | 111 +++++++ .../v2.4.x/v1/Collection/getLoadState.md | 81 +++++ .../v1/Collection/getLoadingProgress.md | 81 +++++ .../v1/Collection/getPersistentSegmentInfo.md | 127 ++++++++ .../v1/Collection/getQuerySegmentInfo.md | 72 +++++ .../v2.4.x/v1/Collection/getReplicas.md | 77 +++++ .../v2.4.x/v1/Collection/insert.md | 193 ++++++++++++ .../v2.4.x/v1/Collection/insertAsync.md | 64 ++++ .../v2.4.x/v1/Collection/loadCollection.md | 98 ++++++ .../v2.4.x/v1/Collection/releaseCollection.md | 69 +++++ .../v2.4.x/v1/Collection/renameCollection.md | 80 +++++ .../v2.4.x/v1/Collection/showCollections.md | 150 ++++++++++ .../v2.4.x/v1/Collection/upsert.md | 106 +++++++ .../v2.4.x/v1/Collection/upsertAsync.md | 39 +++ .../v2.4.x/v1/Connections/MilvusClient.md | 258 ++++++++++++++++ .../v1/Connections/MilvusClientV1Pool.md | 168 +++++++++++ .../v2.4.x/v1/Database/alterDatabase.md | 181 ++++++++++++ .../v2.4.x/v1/Database/createDatabase.md | 74 +++++ .../v2.4.x/v1/Database/dropDatabase.md | 64 ++++ .../v2.4.x/v1/Database/listDatabases.md | 26 ++ .../v1/HighlevelAPI/createCollection.md | 119 ++++++++ .../v2.4.x/v1/HighlevelAPI/delete.md | 89 ++++++ .../v2.4.x/v1/HighlevelAPI/get.md | 96 ++++++ .../v2.4.x/v1/HighlevelAPI/insert.md | 115 ++++++++ .../v2.4.x/v1/HighlevelAPI/listCollections.md | 63 ++++ .../v2.4.x/v1/HighlevelAPI/query.md | 101 +++++++ .../v2.4.x/v1/HighlevelAPI/search.md | 105 +++++++ .../v2.4.x/v1/Index/alterIndex.md | 76 +++++ .../v2.4.x/v1/Index/createIndex.md | 113 +++++++ .../v2.4.x/v1/Index/describeIndex.md | 148 ++++++++++ .../v2.4.x/v1/Index/dropIndex.md | 75 +++++ .../v1/Index/getIndexBuildingProgress.md | 80 +++++ .../v2.4.x/v1/Index/getIndexState.md | 80 +++++ .../v1/Management/getCompactionState.md | 99 +++++++ .../Management/getCompactionStateWithPlans.md | 74 +++++ .../v2.4.x/v1/Management/getFlushAllState.md | 60 ++++ .../v2.4.x/v1/Management/getFlushState.md | 87 ++++++ .../v2.4.x/v1/Management/getMetrics.md | 67 +++++ .../v2.4.x/v1/Management/loadBalance.md | 99 +++++++ .../v2.4.x/v1/Management/manualCompact.md | 76 +++++ .../v2.4.x/v1/Misc/ConsistencyLevelEnum.md | 31 ++ .../v2.4.x/v1/Misc/Constant.md | 48 +++ .../v2.4.x/v1/Misc/DataType.md | 101 +++++++ .../v2.4.x/v1/Misc/IndexType.md | 116 ++++++++ .../v2.4.x/v1/Misc/LogLevel.md | 31 ++ .../v2.4.x/v1/Misc/MetricType.md | 39 +++ .../milvus-sdk-java/v2.4.x/v1/Misc/RT.md | 220 ++++++++++++++ .../v2.4.x/v1/Partition/createPartition.md | 75 +++++ .../v2.4.x/v1/Partition/dropPartition.md | 75 +++++ .../v1/Partition/getPartitionStatistics.md | 109 +++++++ .../v2.4.x/v1/Partition/hasPartition.md | 77 +++++ .../v2.4.x/v1/Partition/loadPartitions.md | 105 +++++++ .../v2.4.x/v1/Partition/releasePartitions.md | 80 +++++ .../v2.4.x/v1/Partition/showPartitions.md | 147 +++++++++ .../v2.4.x/v1/QuerySearch/hybridSearch.md | 278 ++++++++++++++++++ .../v2.4.x/v1/QuerySearch/query.md | 232 +++++++++++++++ .../v2.4.x/v1/QuerySearch/queryAsync.md | 29 ++ .../v2.4.x/v1/QuerySearch/queryIterator.md | 160 ++++++++++ .../v2.4.x/v1/QuerySearch/search.md | 254 ++++++++++++++++ .../v2.4.x/v1/QuerySearch/searchAsync.md | 31 ++ .../v2.4.x/v1/QuerySearch/searchIterator.md | 208 +++++++++++++ .../v2.4.x/v1/RBAC/addUserToRole.md | 70 +++++ .../v2.4.x/v1/RBAC/createRole.md | 64 ++++ .../v2.4.x/v1/RBAC/dropRole.md | 64 ++++ .../v2.4.x/v1/RBAC/grantRolePrivilege.md | 92 ++++++ .../v2.4.x/v1/RBAC/removeUserFromRole.md | 70 +++++ .../v2.4.x/v1/RBAC/revokeRolePrivilege.md | 82 ++++++ .../v2.4.x/v1/RBAC/selectGrantForRole.md | 69 +++++ .../v1/RBAC/selectGrantForRoleAndObject.md | 76 +++++ .../v2.4.x/v1/RBAC/selectRole.md | 69 +++++ .../v2.4.x/v1/RBAC/selectUser.md | 69 +++++ .../v1/ResourceGroup/createResourceGroup.md | 64 ++++ .../v1/ResourceGroup/describeResourceGroup.md | 64 ++++ .../v1/ResourceGroup/dropResourceGroup.md | 64 ++++ .../v1/ResourceGroup/listResourceGroups.md | 54 ++++ .../v2.4.x/v1/ResourceGroup/transferNode.md | 76 +++++ .../v1/ResourceGroup/transferReplica.md | 82 ++++++ .../v2.4.x/v1/System/checkHealth.md | 28 ++ .../v2.4.x/v1/System/getVersion.md | 37 +++ 98 files changed, 9622 insertions(+) create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/alterAlias.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/createAlias.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/dropAlias.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/listAliases.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/createCredential.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/deleteCredential.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/listCredUsers.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/updateCredential.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/bulkInsert.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/getBulkInsertState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/listBulkInsertTasks.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/LocalBulkWriter.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/RemoteBulkWriter.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/alterCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/createCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/delete.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/describeCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/dropCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/flush.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getCollectionStatistics.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadingProgress.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getPersistentSegmentInfo.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getQuerySegmentInfo.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getReplicas.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insert.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insertAsync.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/loadCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/releaseCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/renameCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/showCollections.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsert.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsertAsync.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClient.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClientV1Pool.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Database/alterDatabase.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Database/createDatabase.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Database/dropDatabase.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Database/listDatabases.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/createCollection.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/delete.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/get.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/insert.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/listCollections.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/query.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/search.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/alterIndex.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/createIndex.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/describeIndex.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/dropIndex.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexBuildingProgress.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionStateWithPlans.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushAllState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushState.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getMetrics.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/loadBalance.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Management/manualCompact.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/ConsistencyLevelEnum.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/Constant.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/DataType.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/IndexType.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/LogLevel.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/MetricType.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/RT.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/createPartition.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/dropPartition.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/getPartitionStatistics.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/hasPartition.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/loadPartitions.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/releasePartitions.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/showPartitions.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/hybridSearch.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/query.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryAsync.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryIterator.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/search.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchAsync.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchIterator.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/addUserToRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/createRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/dropRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/grantRolePrivilege.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/removeUserFromRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/revokeRolePrivilege.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRoleAndObject.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectRole.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectUser.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/createResourceGroup.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/describeResourceGroup.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/dropResourceGroup.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/listResourceGroups.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferNode.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferReplica.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/System/checkHealth.md create mode 100644 API_Reference/milvus-sdk-java/v2.4.x/v1/System/getVersion.md diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/alterAlias.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/alterAlias.md new file mode 100644 index 000000000..0ec081b0e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/alterAlias.md @@ -0,0 +1,75 @@ +# alterAlias() + +A MilvusClient interface. This method alters an alias from one collection to another. + +```java +R alterAlias(AlterAliasParam requestParam); +``` + +#### AlterAliasParam + +Use the `AlterAliasParam.Builder` to construct an `AlterAliasParam` object. + +```java +import io.milvus.param.AlterAliasParam; +AlterAliasParam.Builder builder = AlterAliasParam.newBuilder(); +``` + +Methods of `AlterAliasParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters


withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the target collection to alter the alias to.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withAlias(String alias)

Sets the collection alias to alter. Collection alias cannot be empty or null.

alias: The alias to alter.

build()

Constructs a CreateAliasParam object.

+ +The `AlterAliasParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +AlterAliasParam param = AlterAliasParam.newBuilder() + .withCollection(COLLECTION_NAME) + .withAlias("alias1") + .build(); +R response = client.alterAlias(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/createAlias.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/createAlias.md new file mode 100644 index 000000000..ccb55aa3e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/createAlias.md @@ -0,0 +1,75 @@ +# createAlias() + +A MilvusClient interface. This method creates an alias for a collection. Alias cannot be duplicated. The same alias cannot be assigned to different collections. Instead, you can specify multiple aliases for each collection. + +```java +R createAlias(CreateAliasParam requestParam); +``` + +#### CreateAliasParam + +Use the `CreateAliasParam.Builder` to construct a `CreateAliasParam` object. + +```java +import io.milvus.param.CreateAliasParam; +CreateAliasParam.Builder builder = CreateAliasParam.newBuilder(); +``` + +Methods of `CreateAliasParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(
String collectionName)

Sets the target collection name.
Collection name cannot be empty or null.

collectionName: The name of the target collection to create an alias for.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withAlias(String alias)

Sets the collection alias.
Collection alias cannot be empty or null.

alias: The alias of the target collection.

build()

Constructs a CreateAliasParam object.

N/A

+ +`CreateAliasParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +CreateAliasParam param = CreateAliasParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withAlias("alias1") + .build(); +R response = client.createAlias(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/dropAlias.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/dropAlias.md new file mode 100644 index 000000000..2066838e8 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/dropAlias.md @@ -0,0 +1,69 @@ +# dropAlias() + +A MilvusClient interface. This method drops an alias for the specified collection. + +```java +R dropAlias(DropAliasParam requestParam); +``` + +#### DropAliasParam + +Use the `DropAliasParam.Builder` to construct a `DropAliasParam` object. + +```java +import io.milvus.param.DropAliasParam; +DropAliasParam.Builder builder = DropAliasParam.newBuilder(); +``` + +Methods of `DropAliasParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withAlias(String alias)

Sets the collection alias.
The alias cannot be empty or null.

alias: The alias to drop.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a CreateAliasParam object.

N/A

+ +The `DropAliasParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +DropAliasParam param = DropAliasParam.newBuilder() + .withAlias("alias1") + .build(); +R response = client.dropAlias(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/listAliases.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/listAliases.md new file mode 100644 index 000000000..3b988b665 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Alias/listAliases.md @@ -0,0 +1,69 @@ +# listAliases() + +A MilvusClient interface. This method lists the aliases of a collection. + +```java +R listAliases(ListAliasesParam requestParam); +``` + +#### ListAliasesParam + +Use the `ListAliasesParam.Builder` to construct a `ListAliasesParam` object. + +```java +import io.milvus.param.ListAliasesParam; +ListAliasesParam.Builder builder = ListAliasesParam.newBuilder(); +``` + +Methods of `ListAliasesParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters


withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the target collection to list the aliases.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a ListAliasesParam object.

N/A

+ +The `ListAliasesParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `ListAliasesResponse` held by the `R` template. You can use `ListAliasesResponse` to get the information of aliases. + +#### Example + +```java +import io.milvus.param.*; + +ListAliasesParam param = ListAliasesParam.newBuilder() + .withCollection(COLLECTION_NAME) + .build(); +R response = client.listAliases(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/createCredential.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/createCredential.md new file mode 100644 index 000000000..cb60ef426 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/createCredential.md @@ -0,0 +1,70 @@ +# createCredential() + +A MilvusClient interface. This method creates a credential using the given username and password. + +```java +R createCredential(CreateCredentialParam requestParam); +``` + +#### CreateCredentialParam + +Use the `CreateCredentialParam.Builder` to construct a `CreateCredentialParam` object. + +```java +import io.milvus.param.CreateCredentialParam; +CreateCredentialParam.Builder builder = CreateCredentialParam.newBuilder(); +``` + +Methods of `CreateCredentialParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name used to create the credential.

withPassword(String password)

Sets the password. Password cannot be empty or null.

password: The corresponding password to create the credential.

build()

Constructs a CreateCredentialParam object.

N/A

+ +The `CreateCredentialParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +CreateCredentialParam param = CreateCredentialParam.newBuilder() + .withUsername("user") + .withPassword("password") + .build(); +R response = client.createCredential(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/deleteCredential.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/deleteCredential.md new file mode 100644 index 000000000..80e29f74c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/deleteCredential.md @@ -0,0 +1,64 @@ +# deleteCredential() + +A MilvusClient interface. This method deletes the credentials of a corresponding username. + +```java +R deleteCredential(DeleteCredentialParam requestParam); +``` + +#### DeleteCredentialParam + +Use the `DeleteCredentialParam.Builder` to construct a `DeleteCredentialParam` object. + +```java +import io.milvus.param.DeleteCredentialParam; +DeleteCredentialParam.Builder builder = DeleteCredentialParam.newBuilder(); +``` + +Methods of `DeleteCredentialParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name used to delete a credential.

build()

Constructs a DeleteCredentialParam object.

N/A

+ +The `DeleteCredentialParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +DeleteCredentialParam param = DeleteCredentialParam.newBuilder() + .withUsername("user") + .build(); +R response = client.deleteCredential(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/listCredUsers.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/listCredUsers.md new file mode 100644 index 000000000..c65dbbf60 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/listCredUsers.md @@ -0,0 +1,53 @@ +# listCredUsers() + +A MilvusClient interface. This method lists all user names. + +```java +R listCredUsers(ListCredUsersParam requestParam); +``` + +#### ListCredUsersParam + +Use the `ListCredUsersParam.Builder` to construct a `ListCredUsersParam` object. + +```java +import io.milvus.param.ListCredUsersParam; +ListCredUsersParam.Builder builder = ListCredUsersParam.newBuilder(); +``` + +Methods of `ListCredUsersParam.Builder`: + + + + + + + + + + + + +

Method

Description

Parameters

build()

Constructs a ListCredUsersParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `ListCredUsersResponse` held by the `R` template. You can use `ListCredUsersResponse` to get the information of users. + +#### Example + +```java +import io.milvus.param.*; + +ListCredUsersParam param = ListCredUsersParam.newBuilder().build(); +R response = client.listCredUsers(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/updateCredential.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/updateCredential.md new file mode 100644 index 000000000..d4408935c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Authentication/updateCredential.md @@ -0,0 +1,82 @@ +# updateCredential() + +A MilvusClient interface. This method updates the password corresponding to a given username. The original username and password must be provided to check if the update operation is valid. + +
+ +

the milvus client will not update the corresponding connection when the credential is updated. therefore, the original connection might be invalid.

+ +
+ +```java +R updateCredential(UpdateCredentialParam requestParam); +``` + +#### UpdateCredentialParam + +Use the `UpdateCredentialParam.Builder` to construct an `UpdateCredentialParam` object. + +```java +import io.milvus.param.UpdateCredentialParam; +UpdateCredentialParam.Builder builder = UpdateCredentialParam.newBuilder(); +``` + +Methods of `UpdateCredentialParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name.

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name.

withOldPassword(String password)

Sets the old password. Old password cannot be empty or null.

password: The old password.

withNewPassword(String password)

Sets the new password. New password cannot be empty or null.

password: The new password.

build()

Constructs a UpdateCredentialParam object.

N/A

+ +The `UpdateCredentialParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +UpdateCredentialParam param = UpdateCredentialParam.newBuilder() + .withUsername("user") + .withOldPassword("old_password") + .withNewPassword("new_password") + .build(); +R response = client.updateCredential(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/bulkInsert.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/bulkInsert.md new file mode 100644 index 000000000..c5be0cd6a --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/bulkInsert.md @@ -0,0 +1,85 @@ +# bulkInsert() + +A MilvusClient interface. This method imports data from external files, currently supports JSON/Numpy/Parquet files. Read [the doc](https://milvus.io/docs/v2.3.x/bulk_insert.md) for details. + +```java +R bulkInsert(BulkInsertParam requestParam); +``` + +#### BulkInsertParam + +Use the `BulkInsertParam.Builder` to construct a `BulkInsertParam` object. + +```java +import io.milvus.param.BulkInsertParam; +BulkInsertParam.Builder builder = BulkInsertParam.newBuilder(); +``` + +Methods of `BulkInsertParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the target collection.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Sets the partition name. partition name can be null.

partitionName: The name of the target partition.

withFiles(List<String> files)

Sets the path of the files. The paths cannot be empty or null.
Each file path must be a relative path under the Milvus storage bucket.

files: A file paths list. Currently, you can only input one row-based JSON file for each call.

addFile(String file)

Set a file path to be imported.The paths cannot be empty or null.

file: A file path.

build()

Constructs a BulkInsertParam object.

N/A

+ +The `BulkInsertParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `ImportResponse` held by the `R` template. You can use `ImportResponse` to get the task ID. + +#### Example + +```java +import io.milvus.param.bulkinsert.*; + +List files = Arrays.asList("/path_to_bucket/data.json"); +R response = milvusClient.bulkInsert(BulkInsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withFiles(files) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/getBulkInsertState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/getBulkInsertState.md new file mode 100644 index 000000000..7c4d15525 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/getBulkInsertState.md @@ -0,0 +1,194 @@ +# getBulkInsertState() + +A MilvusClient interface. This method gets the state of a bulkinsert task. + +```java +R getBulkInsertState(GetBulkInsertStateParam requestParam); +``` + +#### GetBulkInsertStateParam + +Use the `GetBulkInsertStateParam.Builder` to construct a `GetBulkInsertStateParam` object. + +```java +import io.milvus.param.GetBulkInsertStateParam; +GetBulkInsertStateParam.Builder builder = GetBulkInsertStateParam.newBuilder(); +``` + +Methods of `GetBulkInsertStateParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withTask(Long task)

Set the bulk insert task id returned by bulkInsert() to query.

task: A task id.

build()

Constructs a GetBulkInsertStateParam object

N/A

+ +The `GetBulkInsertStateParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `GetImportStateResponse` held by the `R` template which you can use the task state. + +#### GetBulkInsertStateWrapper + +A tool class to encapsulate the GetImportStateResponse. + +```java +import io.milvus.response.GetBulkInsertStateWrapper; +GetBulkInsertStateWrapper wrapper = new GetBulkInsertStateWrapper(response); +``` + +Methods of `GetBulkInsertStateWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getTaskID()

Gets ID of the bulk import task.

N/A

long

getAutoGeneratedIDs()

Gets the long ID array for auto-id primary key, generated by bulk insert task.

N/A

List<Long>

getState()

Gets the state of the bulk insert task.

N/A

ImportState

getImportedCount()

Gets how many rows were imported by the bulk insert task.

N/A

long

getCreateTimestamp()

Gets the integer timestamp when this task is created.

N/A

long

getCreateTimeStr()

Gets the timestamp in string format when this task is created.

N/A

String

getFailedReason()

Gets fail reason of the bulk insert task if it failed.

N/A

String

getFiles()

Gets target files of the bulk insert task.

N/A

String

getCollectionName()

Gets target collection name of the bulk insert task.

N/A

String

getPartitionName()

Gets the target partition name of the bulk insert task.

N/A

String

getProgress()

Gets working progress percent value for a bulk insert task

N/A

int

+ +#### ImportState + +```java +package io.milvus.grpc; +public enum ImportState +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

State

Code

Description

Pending

0

The task is in the pending list

Failed

1

Task failed, use getFailedReason() to get the failed reason

Started

2

The task is dispatched to the data node, going to be executed.

Persisted

5

New segments have been generated and persisted.

Completed

6

The new segments have been accepted by the target collection. Datanode's work is done.

Failed and cleaned

7

The task failed, and the temporary data generated by this task has been cleaned.

+ +#### Example + +```java +import io.milvus.param.bulkinsert.*; + +R response = milvusClient.getBulkInsertState(GetBulkInsertStateParam.newBuilder() + .withTask(taskId) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/listBulkInsertTasks.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/listBulkInsertTasks.md new file mode 100644 index 000000000..31229251d --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkInsertOps/listBulkInsertTasks.md @@ -0,0 +1,70 @@ +# listBulkInsertTasks() + +A MilvusClient interface. This method lists bulk insert tasks. + +```java +R listBulkInsertTasks(ListBulkInsertTasksParam requestParam); +``` + +#### ListBulkInsertTasksParam + +Use the `ListBulkInsertTasksParam.Builder` to construct a `ListBulkInsertTasksParam` object. + +```java +import io.milvus.param.ListBulkInsertTasksParam; +ListBulkInsertTasksParam.Builder builder = ListBulkInsertTasksParam.newBuilder(); +``` + +Methods of `ListBulkInsertTasksParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name, list all tasks if the name is empty.

collectionName: The name of the target collection.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withLimit(Integer limit)

Specify limit count of returned tasks, list all tasks if the value is 0.
Default value is 0

limit: The limit value to control the numbe of tasks returned.

build()

Constructs a GetBulkInsertStateParam object.

N/A

+ +The `ListBulkInsertTasksParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +The `ListImportTasksResponse` contains a list of `GetImportStateResponse`, which you can use `GetBulkInsertStateWrapper` to parse. Call the `getTasksList()` of `ListImportTasksResponse` to get all the tasks. + +#### Example + +```java +import io.milvus.param.bulkinsert.*; + +R response = milvusClient.listBulkInsertTasks(ListBulkInsertTasksParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withLimit(10) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/LocalBulkWriter.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/LocalBulkWriter.md new file mode 100644 index 000000000..6ad42253a --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/LocalBulkWriter.md @@ -0,0 +1,123 @@ +# LocalBulkWriter + +A LocalBulkWriter instance rewrites your raw data locally in a format that Milvus understands. + +```java +LocalBulkWriter(LocalBulkWriterParam bulkWriterParam) +``` + +Methods of `LocalBulkWriter`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

appendRow(JsonObject rowData)

Append a row into buffer. Once the buffer size exceeds a threshold, the writer will persist the buffer to data file.

rowData: A gson.JsonObject to store the data of a row.
For each field:
- If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input;
- If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input;
- If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input;
- If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input;
- If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input;
- If dataType is JSON, use JsonObject.add(key, JsonElement) to input;

commit(boolean async)

Force persist data files and complete the writer.

async: Set to true to wait until all data files are persisted.

getBatchFiles()

Returns a List<List<String>gt; of the persisted data files. Each List<String> is a batch files that can be input as a job for the bulkinsert interface.

N/A

+ +#### LocalBulkWriterParam + +Use the `LocalBulkWriterParam.Builder` to construct a `LocalBulkWriterParam` object. + +```java +import io.milvus.bulkwriter.LocalBulkWriterParam; +LocalBulkWriterParam.Builder builder = LocalBulkWriterParam.newBuilder(); +``` + +Methods of `LocalBulkWriterParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionSchema(CollectionSchemaParam collectionSchema)

Sets the collection schema. See the CollectionSchemaParam description in the Collection.createCollection() section.

collectionSchema: collection schema

withLocalPath(tring localPath)

Sets the local path to output the data files.

localPath: A local path.

withChunkSize(int chunkSize)

Sets the maximum size of a data chunk.
While rewriting your raw data, This tool splits your raw data into chunks.
The value defaults to 128 MB.

chunkSize: the maximum size of a data chunk.

withFileType(BulkFileType fileType)

The type of the output file. Currently, only PARQUET is available.

fileType: The output file type.

build()

Constructs a LocalBulkWriterParam object

N/A

+ +#### Example + +```java +import io.milvus.bulkwriter.*; +import io.milvus.bulkwriter.common.clientenum.BulkFileType; +import io.milvus.param.collection.CollectionSchemaParam; + +CollectionSchemaParam collectionSchema = CollectionSchemaParam.newBuilder() + .addFieldType(FieldType.newBuilder() + .withName("id") + .withDataType(DataType.Int64) + .withPrimaryKey(true) + .withAutoID(false) + .build()) + .addFieldType(FieldType.newBuilder() + .withName("vector") + .withDataType(DataType.FloatVector) + .withDimension(DIM) + .build()) + .build(); + +LocalBulkWriterParam bulkWriterParam = LocalBulkWriterParam.newBuilder() + .withCollectionSchema(collectionSchema) + .withLocalPath("/tmp/bulk_writer") + .withFileType(fileType) + .withChunkSize(512 * 1024 * 1024) + .build(); + +try (LocalBulkWriter localBulkWriter = new LocalBulkWriter(bulkWriterParam)) { + Gson gson = new Gson(); + for (int i = 0; i < 100000; i++) { + JsonObject row = new JsonObject(); + row.addProperty("id", i); + row.add("vector", gson.toJsonTree(GeneratorUtils.genFloatVector(DIM))); + + localBulkWriter.appendRow(row); + } + + localBulkWriter.commit(false); + List> batchFiles = localBulkWriter.getBatchFiles(); + System.out.printf("Local writer done! output local files: %s%n", batchFiles); +} catch (Exception e) { + System.out.println("Local writer catch exception: " + e); + throw e; +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/RemoteBulkWriter.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/RemoteBulkWriter.md new file mode 100644 index 000000000..e6ef1c48f --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/BulkWriter/RemoteBulkWriter.md @@ -0,0 +1,258 @@ +# RemoteBulkWriter + +A RemoteBulkWriter instance writes your raw data in a format that Milvus understands into an AWS-S3-compatible bucket. + +```java +RemoteBulkWriter(RemoteBulkWriterParam bulkWriterParam) +``` + +Methods of `RemoteBulkWriter`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

appendRow(JsonObject rowData)

Append a row into buffer. Once the buffer size exceeds a threshold, the writer will persist the buffer to data file.

rowData: A gson.JsonObject to store the data of a row.
For each field:
- If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input;
- If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input;
- If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input;
- If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input;
- If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input;
- If dataType is JSON, use JsonObject.add(key, JsonElement) to input;

commit(boolean async)

Force persist data files and complete the writer.

async: Set to true to wait until all data files are persisted.

getBatchFiles()

Returns a List<List<String>gt; of the persisted data files. Each List<String> is a batch files that can be input as a job for the bulkinsert interface.

N/A

+ +#### RemoteBulkWriterParam + +Use the `RemoteBulkWriterParam.Builder` to construct a `RemoteBulkWriterParam` object. + +```java +import io.milvus.bulkwriter.RemoteBulkWriterParam; +RemoteBulkWriterParam.Builder builder = RemoteBulkWriterParam.newBuilder(); +``` + +Methods of `RemoteBulkWriterParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionSchema(CollectionSchemaParam collectionSchema)

Sets the collection schema. See the CollectionSchemaParam description in the Collection.createCollection() section.

collectionSchema: collection schema

withConnectParam(StorageConnectParam connectParam)

Sets the connect parameters for different storage remote services. Currently, two options are available: S3ConnectParam and AzureConnectParam.

connectParam: Connect parameters for remote storage service.

withRemotePath(String remotePath)

Sets the path on the remote storage service where to upload the data files.

remotePath: A path on the remote storage service.

withChunkSize(int chunkSize)

Sets the maximum size of a data chunk.
While rewriting your raw data, This tool splits your raw data into chunks.
The value defaults to 128 MB.

chunkSize: the maximum size of a data chunk.

withFileType(BulkFileType fileType)

The type of the output file. Currently, only PARQUET is available.

fileType: The output file type.

build()

Constructs a LocalBulkWriterParam object

N/A

+ +#### AzureConnectParam + +Use the `AzureConnectParam.Builder` to construct an `AzureConnectParam` object. + +```java +import io.milvus.bulkwriter.connect.AzureConnectParam; +AzureConnectParam.Builder builder = AzureConnectParam.newBuilder(); +``` + +Methods of `AzureConnectParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withContainerName(String containerName)

Sets the Azure container name.

containerName: The target container name.

withConnStr(String connStr)

Sets the connect string.

connStr: A connection string to an Azure Storage account, which can be parsed to an account_url and a credential.To generate a connection string, read this link: https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string

withAccountUrl(String accountUrl)

Sets the account url.

accountUrl: A string in format like https://<storage-account>.blob.core.windows.netRead this link for more info:https://learn.microsoft.com/en-us/azure/storage/common/storage-account-overview

withCredential(TokenCredential credential)

Set the credential.

credential: Account access key for the account, read this link for more info:https://learn.microsoft.com/en-us/azure/storage/common/storage-account-keys-manage?tabs=azure-portal#view-account-access-keys

build()

Constructs a AzureConnectParam object

N/A

+ +#### S3ConnectParam + +Use the `S3ConnectParam.Builder` to construct an `S3ConnectParam` object. + +```java +import io.milvus.bulkwriter.connect.S3ConnectParam; +S3ConnectParam.Builder builder = S3ConnectParam.newBuilder(); +``` + +Methods of `S3ConnectParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCloudName(String cloudName)

Sets the cloud name of the S3.

cloudName: The cloud name.

withBucketName(String bucketName)

Sets the bucket name.

bucketName: The bucket name.

withEndpoint(String endpoint)

Sets the endpoint.

endpoint: The endpoint.

withAccessKey(String accessKey)

Set the access key.

accessKey: The access key.

withSecretKey(String secretKey)

Set the secret key.

secretKey: The secret key.

withSessionToken(String sessionToken)

Set the session token.

sessionToken: The session token.

withRegion(String region)

Set the region name.

region: The region name.

withHttpClient(OkHttpClient httpClient)

Set the http client in necessary.

httpClient: http client.

build()

Constructs a S3ConnectParam object

N/A

+ +#### Example + +```java +import io.milvus.bulkwriter.*; +import io.milvus.bulkwriter.connect.StorageConnectParam; +import io.milvus.bulkwriter.common.clientenum.BulkFileType; +import io.milvus.param.collection.CollectionSchemaParam; + +CollectionSchemaParam collectionSchema = CollectionSchemaParam.newBuilder() + .addFieldType(FieldType.newBuilder() + .withName("id") + .withDataType(DataType.Int64) + .withPrimaryKey(true) + .withAutoID(false) + .build()) + .addFieldType(FieldType.newBuilder() + .withName("vector") + .withDataType(DataType.FloatVector) + .withDimension(DIM) + .build()) + .build(); + +StorageConnectParam connectParam = S3ConnectParam.newBuilder() + .withEndpoint(STORAGE_ENDPOINT) + .withCloudName(CLOUD_NAME) + .withBucketName(STORAGE_BUCKET) + .withAccessKey(STORAGE_ACCESS_KEY) + .withSecretKey(STORAGE_SECRET_KEY) + .withRegion(STORAGE_REGION) + .build(); + +RemoteBulkWriterParam bulkWriterParam = RemoteBulkWriterParam.newBuilder() + .withCollectionSchema(collectionSchema) + .withRemotePath("bulk_data") + .withFileType(BulkFileType.PARQUET) + .withChunkSize(512 * 1024 * 1024) + .withConnectParam(connectParam) + .build(); + +try (RemoteBulkWriter remoteBulkWriter = RemoteBulkWriter(bulkWriterParam)) { + Gson gson = new Gson(); + for (int i = 0; i < 10000; ++i) { + JsonObject row = new JsonObject(); + row.addProperty("id", i); + row.add("vector", gson.toJsonTree(CommonUtils.generateFloatVector(DIM))); + + remoteBulkWriter.appendRow(row); + } + System.out.printf("%s rows appends%n", remoteBulkWriter.getTotalRowCount()); + System.out.printf("%s rows in buffer not flushed%n", remoteBulkWriter.getBufferRowCount()); + System.out.println("Generate data files..."); + remoteBulkWriter.commit(false); + + List> batchFiles = remoteBulkWriter.getBatchFiles(); + System.out.printf("Data files have been uploaded: %s%n", batchFiles); + + for (List files : batchFiles) { + R response = milvusClient.bulkInsert(BulkInsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withFiles(files) + .build()); + } +} catch (Exception e) { + System.out.println("allTypesRemoteWriter catch exception: " + e); + throw e; +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/alterCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/alterCollection.md new file mode 100644 index 000000000..afda29581 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/alterCollection.md @@ -0,0 +1,85 @@ +# alterCollection() + +Alter collection properties. Currently, it supports modifying the time to live (TTL) of a collection's data and enabling MMap of a collection. + +```java +R alterCollection(AlterCollectionParam requestParam); +``` + +#### AlterCollectionParam + +Use the `AlterCollectionParam.Builder` to construct an `AlterCollectionParam` object. + +```java +import io.milvus.param.AlterCollectionParam; +AlterCollectionParam.Builder builder = AlterCollectionParam.newBuilder(); +``` + +Methods of `AlterCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to alter properties.

withDatabaseName(String databaseName)

Sets the database name. Database name can be null for default database.

databaseName: The name of the database.

withTTL(Integer ttlSeconds)

Collection time to live (TTL) is the expiration time of data in a collection. Expired data in the collection will be cleaned up and will not be involved in searches or queries. Specify TTL in the unit of seconds.
This method internally calls the withProperty() to set value.

ttlSeconds: The time to live value. The value should be 0 or greater.

withMMapEnabled(boolean enabledMMap)

Enable MMap or not for original data files.
This method internally calls the withProperty() to set value.

enabledMMap: Set to true to enable MMap.

withProperty(String key, String value)

Basic method to set a key-value property.

key: The key of a property.
value: The value of a property.

build()

Constructs a AlterCollectionParam object.

N/A

+ +The `AlterCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +AlterCollectionParam param = AlterCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withTTL(1800) + .build(); +R response = client.alterCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/createCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/createCollection.md new file mode 100644 index 000000000..061926e9e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/createCollection.md @@ -0,0 +1,261 @@ +# createCollection() + +A MilvusClient interface. This method creates a collection with the specified schema. + +```java +R createCollection(CreateCollectionParam requestParam); +``` + +#### CreateCollectionParam + +Use the `CreateCollectionParam.Builder` to construct a `CreateCollectionParam` object. + +```java +import io.milvus.param.CreateCollectionParam; +CreateCollectionParam.Builder builder = CreateCollectionParam.newBuilder(); +``` + +Methods of `CreateCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to create.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withShardsNum(int shardsNum)

Sets the shards number. The number must be greater or equal to zero.
The default value is 0, which means letting the server decide the value. The server set this value to 1 if user didn't specify it.

shardsNum: The number of shards to split the inserted data into. Multiple shards are processed by multiple nodes in Milvus.

withDescription(String description)

Sets the collection description. The description can be empty. The default description is "".

description: The description of the collection to create.

withFieldTypes(List<FieldType> fieldTypes)

Sets the collection schema. The collection schema cannot be empty.

fieldTypes: a list of FieldType objects, each representing a field schema.

addFieldType(FieldType fieldType)

Adds a field schema.

fieldType: The schema of a field to add in the collection.

withSchema(CollectionSchemaParam schema)

Sets the collection schema. It is recommended to use this method instead of withFieldTypes()

schema: The collection schema

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the consistency level. The default value is ConsistencyLevelEnum.BOUNDED

consistencyLevel: the consistency level of this collection

withPartitionsNum(int partitionsNum)

Sets the partitions number if there is partition key field. The number must be greater than zero.
The default value is 64(defined in server side). The upper limit is 4096(defined in server side).
Not allow to set this value if none of field is partition key. Only one partition key field is allowed in a collection.

partitionsNum: Defines the number of partition if there is a partition key field in the collection.

withReplicaNumber(int replicaNumber)

Sets the replica number in collection level, then if load collection doesn't have replica number, it will use this replica number.

replicaNumber: Sets the default replica number for this collection.

withResourceGroups(List<String> resourceGroups)

Sets the resource groups in collection level, then if load collection doesn't have resource groups, it will use this resource groups.

resourceGroups: resource group names

withProperty(String key, String value)

Basic method to set a key-value property.
You can use this method to set ttl or mmap for this collection. The withReplicaNumber() and withResourceGroups() actually call this method to pass properties.

key: A property key.
Options:
- Constant.TTLSECONDS
- Constant.MMAP
ENABLED
- Constant.COLLECTIONREPLICANUMBER
- Constant.COLLECTIONRESOURCEGROUPS
value: Property value.

build()

Constructs a CreateCollectionParam object

N/A

+ +The `CreateCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### FieldType + +A tool class to represent a field's schema. Use `FieldType.Builder` to build a `FieldType` object. + +```java +import io.milvus.param.FieldType; +FieldType.Builder builder = FieldType.newBuilder(); +FieldType ft = builder.build() +``` + +Methods of `FieldType.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withName(String name)

Sets the name of the field. The name cannot be empty or null.

name: The name of the field.

withPrimaryKey(boolean primaryKey)

Sets the field as the primary key field. Only fields whose data type is INT64 or VARCHAR can be set as the primary key field. The value is false by default.

primaryKey: A boolean value that defines if the field is the primary key field. The value true means that the field is the primary key field while the value false means it is not.

withDescription(String description)

Sets the field description. The description can be empty. The default value is an empty string.

description: The description of the field.

withDataType(DataType dataType)

Sets the data type for the field. Please refer to DataType in Misc.

dataType: The data type of the field.

withElementType(DataType elementType)

Sets the element type for Array type field.

Valid element types for Array: Int8, Int16, Int32, Int64, Varchar, Bool, Float, Double

elementType: element type of the array.

addTypeParam(String key, String value)

Adds a parameter pair for the field. This is mainly used to set extra parameters for the vector field and varchar field.

key: The parameter key.

value: The parameter value.

withDimension(Integer dimension)

Sets the dimension of a vector field. The dimension value must be greater than zero. This method internally calls addTypeParam() to store the dimension value.

dimension: The dimension of the vector field.

withMaxLength(Integer maxLength)

Sets the maximum length of a Varchar field. The value must be greater than zero. This method internally calls the addTypeParam() to store the maximum length value.

maxLength: The maximum length of the varchar field.

withMaxCapacity(Integer maxCapacity)

Sets the max capacity of an Array field. The valid capacity value range is [1, 4096]

maxCapacity: The max capacity of the array.

withAutoID(boolean autoID)

Enables auto-ID function for the field. Note that the auto-ID function can only be enabled on primary key field.If auto-ID function is enabled, Milvus automatically generates a unique ID for each entity so that values for the primary key field do not need to be provided during data insertion. If auto-ID is disabled, values for the primary key field need to be provided during data insertion.

autoID: A boolean value that defines if the primary keys are automatically generated. The value true means that auto-ID is enabled, while the value false means it is not.

withPartitionKey(boolean partitionKey)

Sets the field to be partition key.A partition key field's values are hashed and distributed to different logic partitions.Only int64 and varchar type fields can be a partition key. The primary key field can not be a partition key.

partitionKey: A boolean value that defines if this field is a partition key field. The value true is a partition key, false is not.

build()

Create a FieldType object.

N/A

+ +#### CollectionSchemaParam + +A tool class to represent a collection's schema. Use `CollectionSchemaParam.Builder` to build a `CollectionSchemaParam` object. + +```java +import io.milvus.param.collection.CollectionSchemaParam; +CollectionSchemaParam.Builder builder = CollectionSchemaParam.newBuilder(); +``` + +Methods of `CollectionSchemaParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withEnableDynamicField(boolean enableDynamicField)

Sets the collection if enableDynamicField.

enableDynamicField: enableDynamicField of the collection

withFieldTypes(List<FieldType> fieldTypes)

Sets the fieldTypes of the schema. The fieldTypes cannot be empty or null.

fieldTypes: A list of FieldType to defines the fields.

addFieldType( FieldType fieldType)

Adds a field schema.

fieldType: A field schema.

build()

Create a CollectionSchemaParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +List fieldsSchema = new ArrayList<>(); +FieldType field_1 = FieldType.newBuilder() + .withPrimaryKey(true) + .withAutoID(false) + .withDataType(DataType.Int64) + .withName("uid") + .withDescription("unique id") + .build(); + +fieldsSchema.add(field_1); + +FieldType field_2 = FieldType.newBuilder() + .withDataType(DataType.FloatVector) + .withName("embedding") + .withDescription("embeddings") + .withDimension(dimension) + .build(); +fieldsSchema.add(field_2); + +// create collection +CreateCollectionParam param = CreateCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withDescription("a collection for search") + .withFieldTypes(fieldsSchema) + .build(); + +R response = client.createCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/delete.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/delete.md new file mode 100644 index 000000000..05589223b --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/delete.md @@ -0,0 +1,82 @@ +# delete() + +A MilvusClient interface. This method deletes entity(s) based on the primary key filtered by boolean expression. + +```java +R delete(DeleteParam requestParam); +``` + +#### DeleteParam + +Use the `DeleteParam.Builder` to construct a `DeleteParam` object. + +```java +import io.milvus.param.DeleteParam; +DeleteParam.Builder builder = DeleteParam.newBuilder(); +``` + +Methods of `DeleteParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to delete the entity or entities from.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Sets the target partition name (Optional).

partitionName: The name of the partition to delete the entity or entities from.

withExpr(String expr)

Sets the expression filtering to pick out the entities to be deleted.

expr: The expression used for filtering.

build()

Constructs a DeleteParam object.

N/A

+ +The `DeleteParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `MutationResult` held by the `R` template. You can use `MutationResultWrapper` to get the returned information. See the corresponding section in `insert()` for more information about MutationResultWrapper. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.MutationResult; + +DeleteParam param = DeleteParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPartitionName(PARTITION_NAME) + .withExpr("id in [100, 200, 300]") + .build(); +R response = milvusClient.delete(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/describeCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/describeCollection.md new file mode 100644 index 000000000..4c3f8f7a6 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/describeCollection.md @@ -0,0 +1,152 @@ +# describeCollection() + +A MilvusClient interface. This method shows the details of a collection, e.g. name, schema. + +```java +R describeCollection(DescribeCollectionParam requestParam); +``` + +#### DescribeCollectionParam + +Use the `DescribeCollectionParam.Builder` to construct a `DescribeCollectionParam` object. + +```java +import io.milvus.param.DescribeCollectionParam; +DescribeCollectionParam.Builder builder = DescribeCollectionParam.newBuilder(); +``` + +Methods of `DescribeCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to release.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a ReleaseCollectionParam object.

N/A

+ +The `DescribeCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `DescribeCollectionResponse` held by the `R` template. You can use `DescCollResponseWrapper` to get the information. + +#### DescCollResponseWrapper + +A tool class to encapsulate the DescribeCollectionResponse. + +```java +import io.milvus.response.DescCollResponseWrapper; +DescCollResponseWrapper wrapper = new DescCollResponseWrapper(response); +``` + +Methods of `DescCollResponseWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getCollectionName()

Get the name of the collection.

N/A

String

getCollectionDescription()

Get the description of the collection.

N/A

String

getCollectionID()

Get the internal ID of the collection.

N/A

long

getShardNumber()

Get the shard number of the collection.

N/A

int

getCreatedUtcTimestamp()

Get UTC timestamp when the collection is created.

N/A

long

getAliases()

Get aliases of the collection.

N/A

List<String>

getFields()

Get the schema of the collection's fields.

N/A

List<FieldType>

getFieldByName(String fieldName)

Get the schema of a field by name.Return null if the field doesn't exist.

fieldName: The name of a field

FieldType

isDynamicFieldEnabled()

Get whether the collection dynamic field is enabled

N/A

boolean

getPartitionKeyField()

Get the partition key field.Return null if the partition key field doesn't exist.

N/A

FieldType

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.DescCollResponseWrapper; + +DescribeCollectionParam param = DescribeCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.describeCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +DescCollResponseWrapper wrapper = new DescCollResponseWrapper(response.getData()); +System.out.println("Shard number: " + wrapper.getShardNumber()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/dropCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/dropCollection.md new file mode 100644 index 000000000..210906f91 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/dropCollection.md @@ -0,0 +1,76 @@ +# dropCollection() + +A MilvusClient interface. This method drops a specified collection. + +
+ +

this method drops all data within the collection.

+ +
+ +```java +R dropCollection(DropCollectionParam requestParam); +``` + +#### DropCollectionParam + +Use the `DropCollectionParam.Builder` to construct a `DropCollectionParam` object. + +```java +import io.milvus.param.DropCollectionParam; +DropCollectionParam.Builder builder = DropCollectionParam.newBuilder(); +``` + +Methods of `DropCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to drop.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a DropCollectionParam object

N/A

+ +The `DropCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +DropCollectionParam dropParam = DropCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); + +R response = client.dropCollection(dropParam); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/flush.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/flush.md new file mode 100644 index 000000000..7f64b250d --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/flush.md @@ -0,0 +1,98 @@ +# flush() + +A MilvusClient interface. This method triggers a flush action in which all growing segments in the specified collection are marked as sealed and then flushed to storage. + +
+ +

notes

+ +

Typically, this method is called once all the data is ingested. You are advised not to call this method frequently since it could generate a lot of tiny segments and lead to unstable problems.

+ +
+ +```java +R flush(FlushParam requestParam); +``` + +#### FlushParam + +Use the `FlushParam.Builder` to construct a `FlushParam` object. + +```java +import io.milvus.param.FlushParam; +FlushParam.Builder builder = FlushParam.newBuilder(); +``` + +Methods of `FlushParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionNames(List<String> collectionNames)

Sets a list of collections to be flushed.

collectionNames: a list of the names of the collections to be flushed.

addCollectionName(String collectionName)

Adds a collection to be flushed.

collectionName: The name of the collection to be flushed.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withSyncFlush(Boolean syncFlush)

Sets the flush function to sync mode. With sync mode enabled, the client keeps waiting until all segments of the collection are successfully flushed. If sync mode is disabled, the client immediately returns the result after flush() is called.

syncFlush: A Boolean value to indicate if sync mode is enabled. Sync mode is enabled if the value is set to True.

withSyncFlushWaitingInterval(Long milliseconds)

Sets the waiting interval in sync mode. With sync mode enabled, the client will check segments status at intervals. The value must be greater than zero, and cannot be greater than Constant.MAXWAITINGFLUSHING_INTERVAL. The default value is 500 miliseconds.

milliseconds: The time interval in milliseconds for checking the flush status.


withSyncFlushWaitingTimeout(Long seconds)

Sets the timeout period for sync mode. The value must be greater than zero, and cannot be greater than Constant.MAXWAITINGFLUSHING_TIMEOUT. The default value is 60 seconds.

seconds: A during of time in seconds to wait till timeout.

build()

Constructs a FlushParam object.

N/A

+ +The `FlushParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `FlushResponse` held by the `R` template. The `FlushResponse` contains a map of the collection name and a corresponding list of flushed segments. The map is internally used by other SDK methods such as `createIndex()`. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.FlushResponse; + +FlushParam param = FlushParam.newBuilder() + .addCollectionName(COLLECTION_NAME) + .build(); +R response = client.flush(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getCollectionStatistics.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getCollectionStatistics.md new file mode 100644 index 000000000..afcd59258 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getCollectionStatistics.md @@ -0,0 +1,111 @@ +# getCollectionStatistics() + +A MilvusClient interface. This method shows the statistical information of the specified collection. + +
+ +

the current version only returns the row count of a collection. this method can be deprecated in the future.

+ +
+ +```java +R getCollectionStatistics(GetCollectionStatisticsParam requestParam); +``` + +#### GetCollectionStatisticsParam + +Use the `GetCollectionStatisticsParam.Builder` to construct a `GetCollectionStatisticsParam` object. + +```java +import io.milvus.param.GetCollectionStatisticsParam; +GetCollectionStatisticsParam.Builder builder = GetCollectionStatisticsParam.newBuilder(); +``` + +Methods of `GetCollectionStatisticsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection whose statistical information needs to be checked.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withFlush(Boolean flush)

Requests a flush action before retrieving collection statistics. The default value is False.

flush: Set the value to true to perform a flush action.

build()

Constructs a GetCollectionStatisticsParam object.

N/A

+ +The `GetCollectionStatisticsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `GetCollectionStatisticsResponse` held by the `R` template. You can use `GetCollStatResponseWrapper` to get the information. + +#### GetCollStatResponseWrapper + +A tool class to encapsulate the `GetCollectionStatisticsResponse`. + +```java +import io.milvus.response.GetCollStatResponseWrapper; +GetCollStatResponseWrapper wrapper = new GetCollStatResponseWrapper(getStatResponse); +``` + +Methods of `GetCollStatResponseWrapper`: + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getRowCount()

Gets the row count of a collection. Note that due to technical reasons, the deleted entities are not counted in the row count.

N/A

long

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.GetCollStatResponseWrapper; +import io.milvus.grpc.GetCollectionStatisticsResponse; + +GetCollectionStatisticsParam param = GetCollectionStatisticsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getCollectionStatistics(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetCollStatResponseWrapper wrapper = new GetCollStatResponseWrapper(response.getData()); +System.out.println("Row count: " + wrapper.getRowCount()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadState.md new file mode 100644 index 000000000..61dd3848c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadState.md @@ -0,0 +1,81 @@ +# getLoadState() + +A MilvusClient interface. This method gets the state of loading collection progress. + +```java +R getLoadState(GetLoadStateParam requestParam); +``` + +#### GetLoadStateParam + +Use the `GetLoadStateParam.Builder` to construct a GetLoadStateParam object. + +```java +import io.milvus.param.GetLoadStateParam; +GetLoadStateParam.Builder builder = GetLoadStateParam.newBuilder(); +``` + +Methods of `GetLoadStateParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to get state.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify query scope (Optional).

partitionNames:
A name list of partition to get state.

addPartitionName(String partitionName)

Adds a partition by name. Partition name cannot be empty or null.

partitionName: A partition name.

build()

Constructs a GetLoadStateParam object.

N/A

+ +The `GetLoadStateParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +GetLoadStateParam param = GetLoadStateParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getLoadState(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +System.out.println(response.getState()); +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadingProgress.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadingProgress.md new file mode 100644 index 000000000..3def1830d --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getLoadingProgress.md @@ -0,0 +1,81 @@ +# getLoadingProgress() + +A MilvusClient interface. This method gets loading collection progress. + +```java +R getLoadingProgress(GetLoadingProgressParam requestParam); +``` + +#### GetLoadingProgressParam + +Use the `GetLoadingProgressParam.Builder` to construct a `GetLoadingProgressParam` object. + +```java +import io.milvus.param.GetLoadingProgressParam; +GetLoadingProgressParam.Builder builder = GetLoadingProgressParam.newBuilder(); +``` + +Methods of `GetLoadingProgressParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to load.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify query scope(optional).

partitionNames:
The name list of partitions to be loaded.

addPartitionName(String partitionName)

Adds a partition name to specify query scope(optional).

partitionName: A partition name.

build()

Constructs a GetLoadingProgressParam object

N/A

+ +The `GetLoadingProgressParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +GetLoadingProgressParam param = GetLoadingProgressParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getLoadingProgress(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +System.out.println(response.getProgress()); +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getPersistentSegmentInfo.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getPersistentSegmentInfo.md new file mode 100644 index 000000000..ba709a69e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getPersistentSegmentInfo.md @@ -0,0 +1,127 @@ +# getPersistentSegmentInfo() + +A MilvusClient interface. This method gets the information of persistent segments from data node, including row count, persistence state (growing or flushed), and more. + +```java +R getPersistentSegmentInfo(GetPersistentSegmentInfoParam requestParam); +``` + +#### GetPersistentSegmentInfoParam + +Use the `GetPersistentSegmentInfoParam.Builder` to construct a `GetPersistentSegmentInfoParam` object. + +```java +import io.milvus.param.GetPersistentSegmentInfoParam; +GetPersistentSegmentInfoParam.Builder builder = GetPersistentSegmentInfoParam.newBuilder(); +``` + +Methods of `GetPersistentSegmentInfoParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection.

build()

Constructs a GetPersistentSegmentInfoParam object.

N/A

+ +The `GetPersistentSegmentInfoParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `GetPersistentSegmentInfoResponse` held by the `R` template. The `GetPersistentSegmentInfoResponse` object contains a list of `PersistentSegmentInfo`, and you can use `PersistentSegmentInfo.getState()` to get the state of the segment. + +#### SegmentState + +```java +package io.milvus.grpc; +public enum SegmentState +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Type

Code

Description

SegmentStateNone

0

For internal usage.

NotExist

1

For internal usage.

Growing

2

A growing segment in query node.

Sealed

3

The segment is sealed and waiting to be flushed.

Flushed

4

The segment has been flushed to storage.

Flushing

5

The server is flushing this segment.

Dropped

6

The segment has been marked as deleted.

Importing

7

Reserved for bulkinsert interface.

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetPersistentSegmentInfoResponse; +import io.milvus.grpc.PersistentSegmentInfo; + +GetPersistentSegmentInfoParam param = GetPersistentSegmentInfoParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getPersistentSegmentInfo(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetPersistentSegmentInfoResponse segmentInfo = response.getData(); +for (int i = 0; i < segmentInfo.getInfosCount(); i++) { + PersistentSegmentInfo info = segmentInfo.getInfos(i); + System.out.println("Segment ID: " + info.getSegmentID() + ", state: " + info.getState() + ", rows: " + info.getNumRows()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getQuerySegmentInfo.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getQuerySegmentInfo.md new file mode 100644 index 000000000..4aec802fa --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getQuerySegmentInfo.md @@ -0,0 +1,72 @@ +# getQuerySegmentInfo() + +A MilvusClient interface. This method gets the query information of segments in a collection from the query node, including row count, memory usage, index name, and more. + +```java +R getQuerySegmentInfo(GetQuerySegmentInfoParam requestParam); +``` + +#### GetQuerySegmentInfoParam + +Use the `GetQuerySegmentInfoParam.Builder` to construct a `GetQuerySegmentInfoParam` object. + +```java +import io.milvus.param.GetQuerySegmentInfoParam; +GetQuerySegmentInfoParam.Builder builder = GetQuerySegmentInfoParam.newBuilder(); +``` + +Methods of `GetQuerySegmentInfoParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to get the query information of the segment from.

build()

Constructs a GetQuerySegmentInfoParam object.

N/A

+ +The `GetQuerySegmentInfoParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns R.Status.Unknow and the error message of the exception. + +- If the API succeeds, it returns a valid `GetQuerySegmentInfoResponse` held by the R template. The GetQuerySegmentInfoResponse object contains a list of `QuerySegmentInfo`, and you can use `QuerySegmentInfo.getState()` to get the state of the segment. This process is similar to that of `PersistentSegmentInfo`. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetQuerySegmentInfoResponse; +import io.milvus.grpc.QuerySegmentInfo; + +GetQuerySegmentInfoParam param = GetQuerySegmentInfoParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getQuerySegmentInfo(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetQuerySegmentInfoResponse segmentInfo = response.getData(); +for (int i = 0; i < segmentInfo.getInfosCount(); i++) { + QuerySegmentInfo info = segmentInfo.getInfos(i); + System.out.println("Segment ID: " + info.getSegmentID() + ", state: " + info.getState() + ", rows: " + info.getNumRows()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getReplicas.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getReplicas.md new file mode 100644 index 000000000..aae17d236 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/getReplicas.md @@ -0,0 +1,77 @@ +# getReplicas() + +A MilvusClient interface. This method lists the replica information of a specified collection. + +```java +R getReplicas(GetReplicasParam requestParam); +``` + +#### GetReplicasParam + +Use the `GetReplicasParam.Builder` to construct a GetReplicasParam object. + +```java +import io.milvus.param.GetReplicasParam; +GetReplicasParam.Builder builder = GetReplicasParam.newBuilder(); +``` + +Methods of `GetReplicasParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection whose replica information needs to be listed.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a GetReplicasParam object.

N/A

+ +The `GetReplicasParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `GetReplicasResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetReplicasResponse; +import io.milvus.grpc.ReplicaInfo; + +GetReplicasParam param = GetReplicasParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.getReplicas(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetReplicasResponse replicas = response.getData(); +for (int i = 0; i < replicas.getReplicasCount(); i++) { + ReplicaInfo info = replicas.getReplicas(i); + System.out.println("Replica ID: " + info.getReplicaID() + ", nodes: " + info.getNodeIdsList().toString()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insert.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insert.md new file mode 100644 index 000000000..99a7beb47 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insert.md @@ -0,0 +1,193 @@ +# insert() + +A MilvusClient interface. This method inserts entities into a specified collection. + +```java +R insert(InsertParam requestParam); +``` + +#### InsertParam + +Use the `InsertParam.Builder` to construct an `InsertParam` object. + +```java +import io.milvus.param.InsertParam; +InsertParam.Builder builder = InsertParam.newBuilder(); +``` + +Methods of `InsertParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to insert data into.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Sets the target partition name(optional).

partitionName: The name of the partition to insert data into.

withFields(List<InsertParam.Field> fields)

Sets the data to be inserted. The field list cannot be empty.
Note that no input is required for the primary key field if auto_id is enabled.

fields: A list of Field objects, each representing a field.

withRows(List<gson.JsonObject> rows)

Sets the row-based data to be inserted. The row list cannot be empty.
Note that if the withFields() is called, the rows by withRows() will be ignored.

rows: A list of gson.JsonObject objects, each representing a row in key-value format.
For each field:
- If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input;
- If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input;
- If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input;
- If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input;
- If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input;
- If dataType is JSON, use JsonObject.add(key, JsonElement) to input;
Note:
1. For scalar numeric values, value will be cut according to the type of the field.
For example:
An Int8 field named "XX", you set the value to be 128 by JsonObject.addProperty("XX", 128), the value 128 is cut to -128.
An Int64 field named "XX", you set the value to be 3.9 by JsonObject.addProperty("XX", 3.9), the value 3.9 is cut to 3.
2. String value can be parsed to numeric/boolean type if the value is valid.
For example:
A Bool field named "XX", you set the value to be "TRUE" by JsonObject.addProperty("XX", "TRUE"), the string "TRUE" is parsed as true.
A Float field named "XX", you set the value to be "3.5" by JsonObject.addProperty("XX", "3.5", the string "3.5" is parsed as 3.5.

build()

Constructs an InsertParam object.

N/A

+ +
+ +

notes

+ +

In Java SDK versions v2.4.1 or earlier versions, the input is a fastjson.JSONObject. But fastjson is not recommended to use now because of its unsafe deserialization vulnerability. Therefore, replace fastjson with gson if you use the Java SDK of v2.4.2 or later releases.

+ +
+ +The `InsertParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Field + +A tool class to hold a data field. + +Methods of `InsertParam.Field`: + + + + + + + + + + + + +

Method

Description

Parameters

Field(String name, List<?> values)

This class only provides a constructor to create a Field object.

name: The name of the data field. values:

  • Requires List<Boolean> if the data type is Bool.
  • Requires List<Long> if the data type is Int64.
  • Requires List<Integer> or List<Short> if the data type is Int8/Int16/Int32.
  • Requires List<Float> if the data type is Float.
  • Requires List<Double> if the data type is Double.
  • Requires List<String> if the data type is Varchar.
  • Requires List<List<?>gt; if the data type is Array, the inner List type must be equal to the element type of the Array field.
  • Requires List<List<Float>gt;, if the data type is FloatVector.
  • Requires List<ByteBuffer>, if the data type is BinaryVector/Float16Vector/BFloat16Vector.
  • Requires List<SortedMap<Long, Float>gt; if the data type is SparseFloatVector.
+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `MutationResult` held by the `R` template. You can use `MutationResultWrapper` to get the returned information. + +#### MutationResultWrapper + +A tool class to encapsulate the MutationResult. + +```java +import io.milvus.response.MutationResultWrapper; +MutationResultWrapper wrapper = new MutationResultWrapper(mutationResult); +``` + +Methods of `MutationResultWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

getInsertCount()

Gets the row count of the inserted entities.

long

getLongIDs()

Gets the long ID array returned by the insert() interface if the primary key field is int64 type. Throw ParamException if the primary key type is not int64.

List<Long>

getStringIDs()

Gets the string ID array returned by the insert() interface if the primary key field is varchar type. Throw ParamException if the primary key type is not varchar type.

List<String>

getDeleteCount()

Gets the row count of the deleted entities. Currently, this value is always equal to the input row count.

long

getOperationTs()

Gets the timestamp of the operation marked by the server.

long

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +int rowCount = 10000; +List> vectors = generateFloatVectors(rowCount); + +// insert data by columns +List ids = new ArrayList<>(); +for (long i = 0L; i < rowCount; ++i) { + ids.add(i); +} + +List fields = new ArrayList<>(); +fields.add(new InsertParam.Field("id", ids)); +fields.add(new InsertParam.Field("vector", vectors)); + +R response = client.insert(InsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withFields(fields) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +MutationResultWrapper wrapper = new MutationResultWrapper(response.getData()); +System.out.println(wrapper.getInsertCount() + " rows inserted"); + +// insert data by rows +Gson gson = new Gson(); +List rows = new ArrayList<>(); +for (int i = 1; i <= rowCount; ++i) { + JsonObject row = new JsonObject(); + row.addProperty("id", (long)i); + row.add("vector", gson.toJsonTree(vectors.get(i))); + rows.add(row); +} + +response = client.insert(InsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withRows(rows) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insertAsync.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insertAsync.md new file mode 100644 index 000000000..5c9cd8a51 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/insertAsync.md @@ -0,0 +1,64 @@ +# insertAsync() + +A MilvusClient interface. This method inserts entities asynchronously into a specified collection. + +```java +ListenableFuture> insertAsync(InsertParam requestParam); +``` + +This method uses the same parameter as `insert()`, it invokes the RPC interface and returns a `ListenableFuture` object immediately. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +int rowCount = 10000; +List> vectors = generateFloatVectors(rowCount); + +// insert data by columns +List ids = new ArrayList<>(); +for (long i = 0L; i < rowCount; ++i) { + ids.add(i); +} + +List fields = new ArrayList<>(); +fields.add(new InsertParam.Field("id", ids)); +fields.add(new InsertParam.Field("vector", vectors)); + +ListenableFuture> response = client.insertAsync(InsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withFields(fields) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +R result = response.get(); // wait the result retutned +MutationResultWrapper wrapper = new MutationResultWrapper(result.getData()); +System.out.println(wrapper.getInsertCount() + " rows inserted"); + +// insert data by rows +Gson gson = new Gson(); +List rows = new ArrayList<>(); +for (int i = 1; i <= rowCount; ++i) { + JsonObject row = new JsonObject(); + row.addProperty("id", (long)i); + row.add("vector", gson.toJsonTree(vectors.get(i))); + rows.add(row); +} + +response = client.insertAsync(InsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withRows(rows) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +R result = response.get(); // wait the result retutned +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/loadCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/loadCollection.md new file mode 100644 index 000000000..76c08cccc --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/loadCollection.md @@ -0,0 +1,98 @@ +# loadCollection() + +A MilvusClient interface. This method loads the specified collection and all the data within to memory for search or query. + +```java +R loadCollection(LoadCollectionParam requestParam); +``` + +#### LoadCollectionParam + +Use the `LoadCollectionParam.Builder` to construct a `LoadCollectionParam` object. + +```java +import io.milvus.param.LoadCollectionParam; +LoadCollectionParam.Builder builder = LoadCollectionParam.newBuilder(); +``` + +Methods of `LoadCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to load.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withSyncLoad(Boolean syncLoad)

Enables sync mode when loading a collection. With sync mode enabled, the client keeps waiting until all segments of the collection are successfully loaded. If sync mode is disabled, the client returns instantly after loadCollection() is called.
Sync mode is enabled by default.

syncLoad:A boolean value to indicate if sync mode is enabled. If the value is set to True, this means sync mode is enabled.

withSyncLoadWaitingInterval(Long milliseconds)

Sets the waiting interval for sync mode. In sync mode, the client checks the collection load status at intervals. The value must be greater than zero, and cannot be greater than Constant.MAXWAITINGLOADING_INTERVAL. The default value is 500 milliseconds

milliseconds: The time interval in milliseconds for checking the data load status.

withSyncLoadWaitingTimeout(Long seconds)

Sets the timeout period for sync mode. The value must be greater than zero and cannot be greater than Constant.MAXWAITINGLOADING_TIMEOUT. The default value is 60 seconds.

seconds: A during of time in seconds to wait till timeout.

withReplicaNumber(Integer replicaNumber)

Specifies the number of replicas to load. The default value is 1.

replicaNumber: The number of the replicas to load when loading a collection.

withRefresh(Boolean refresh)

Whether to renew the segment list of this collection before loading. This flag must be set to FALSE when first time call the loadCollection(). After loading a collection, call loadCollection() again with refresh=TRUE, the server will look for new segments that are not loaded yet and tries to load them up.
This method is mainly for bulkinsert() interface.

refresh: The flag whether to renew segment list.

build()

Constructs a LoadCollectionParam object.

N/A

+ +The `LoadCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +LoadCollectionParam param = LoadCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withReplicaNumber(2) + .withSyncLoad(Boolean.TRUE) + .withSyncLoadWaitingInterval(500L) + .withSyncLoadWaitingTimeout(30L) + .build(); +R response = client.loadCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/releaseCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/releaseCollection.md new file mode 100644 index 000000000..78da907c6 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/releaseCollection.md @@ -0,0 +1,69 @@ +# releaseCollection() + +A MilvusClient interface. This method releases the specified collection and all data within it from memory. + +```java +R releaseCollection(ReleaseCollectionParam requestParam); +``` + +#### ReleaseCollectionParam + +Use the `ReleaseCollectionParam.Builder` to construct a `ReleaseCollectionParam` object. + +```java +import io.milvus.param.ReleaseCollectionParam; +ReleaseCollectionParam.Builder builder = ReleaseCollectionParam.newBuilder(); +``` + +Methods of `ReleaseCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to release.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a ReleaseCollectionParam object.

N/A

+ +The `ReleaseCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +ReleaseCollectionParam param = ReleaseCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build(); +R response = client.releaseCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/renameCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/renameCollection.md new file mode 100644 index 000000000..ee2211e35 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/renameCollection.md @@ -0,0 +1,80 @@ +# renameCollection() + +A MilvusClient interface. This method renames the specified collection. + +```java +R renameCollection(RenameCollectionParam requestParam) +``` + +#### RenameCollectionParam + +Use the `RenameCollectionParam.Builder` to construct a `RenameCollectionParam` object. + +```java +import io.milvus.param.RenameCollectionParam; +RenameCollectionParam.Builder builder = RenameCollectionParam.newBuilder(); +``` + +Methods of `RenameCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withOldCollectionName(String oldCollectionName)

Sets the old collection name. Old collection name cannot be empty or null.

oldCollectionName: The old name of the collection to rename.

withNewCollectionName(String newCollectionName)

Sets the new collection name. New collection name cannot be empty or null.

newCollectionName: The new name of the collection to rename.

withOldDatabaseName(String databaseName)

Sets the database name of the old collection. database name can be null for default database.

databaseName: The database name.

withNewDatabaseName(String databaseName)

Sets the database name of the new collection. database name can be null for default database.

databaseName: The database name.

build()

Constructs a RenameCollectionParam object.

N/A

+ +The `RenameCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +RenameCollectionParam param = RenameCollectionParam.newBuilder() + .withOldCollectionName(OLD_COLLECTION_NAME) + .withNewCollectionName(NEW_COLLECTION_NAME) + .build(); +R response = client.renameCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/showCollections.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/showCollections.md new file mode 100644 index 000000000..2f72c5448 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/showCollections.md @@ -0,0 +1,150 @@ +# showCollections() + +A MilvusClient interface. This method lists all the collections or gets the collection loading status*.* + +```java +R showCollections(ShowCollectionsParam requestParam); +``` + +#### ShowCollectionsParam + +Use the `ShowCollectionsParam.Builder` to construct a `ShowCollectionsParam` object. + +```java +import io.milvus.param.ShowCollectionsParam; +ShowCollectionsParam.Builder builder = ShowCollectionsParam.newBuilder(); +``` + +Methods of `ShowCollectionsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionNames(List<String> collectionNames)

Sets a list of collection names. If the list is empty, the method will return all the collections in database.
Collection name cannot be empty or null.

collectionNames: A list of the collection names to show.

addCollectionName(String collectionName)

Adds a collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to show.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Constructs a ShowCollectionsParam object.

N/A

+ +The `ShowCollectionsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `ShowCollectionsResponse` held by the `R` template. You can use `ShowCollResponseWrapper` to get the information. + +#### ShowCollResponseWrapper + +A tool class to encapsulate the ShowCollectionsResponse. + +```java +import io.milvus.response.ShowCollResponseWrapper; +ShowCollResponseWrapper wrapper = new ShowCollResponseWrapper(showCollectionsResponse); +``` + +Methods of `ShowCollResponseWrapper`: + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getCollectionsInfo()

Returns a list of CollectionInfo objects. Each CollectionInfo represents a collection.

N/A

List<CollectionInfo>

getCollectionInfoByName(String collectionName)

Gets a CollectionInfo object by collection name.

collectionName: The collection name.

CollectionInfo

+ +#### CollectionInfo + +A tool class to store a collection's information. + +Methods of `ShowCollResponseWrapper.CollectionInfo`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

getName()

Gets the name of the collection.

String

getId()

Gets the ID of the collection.

long

getUtcTimestamp()

Gets a UTC timestamp that indicates when this collection is created. This method is for internal usage.

long

getInMemoryPercentage()

Load percentage on query node.

long

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.ShowCollResponseWrapper; +import io.milvus.grpc.ShowCollectionsResponse; + +ShowCollectionsParam param = ShowCollectionsParam.newBuilder() + .addCollectionName(COLLECTION_NAME) + .build(); +R response = client.showCollections(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +ShowCollResponseWrapper wrapper = new ShowCollResponseWrapper(response.getData()); +System.out.println("Row count: " + wrapper.getRowCount()); + +List infos = wrapper.getCollectionsInfo(); +for (ShowCollResponseWrapper.CollectionInfo info : infos) { + System.out.println(info.getName() + " load percentage: " + info.getInMemoryPercentage() + "%"); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsert.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsert.md new file mode 100644 index 000000000..f2d6209a5 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsert.md @@ -0,0 +1,106 @@ +# upsert() + +A MilvusClient interface. This method inserts new entities into a specified collection, and replaces them if the entities already exist. + +```java +R upsert(UpsertParam requestParam); +``` + +#### UpsertParam + +Use the `UpsertParam.Builder` to construct an `UpsertParam` object. + +```java +import io.milvus.param.UpsertParam; +UpsertParam.Builder builder = UpsertParam.newBuilder(); +``` + +Methods of `UpsertParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to insert data into.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Sets the target partition name(optional).

partitionName: The name of the partition to insert data into.

withFields(List<InsertParam.Field> fields)

Sets the column-based data to be inserted. The fields list cannot be empty.
Note that no input is required for the primary key field if auto-id is enabled.

fields: A list of Field objects, each representing a field.

withRows(List<gson.JsonObject> rows)

Sets the row-based data to be inserted. The row list cannot be empty.
Note that if the withFields() is called, the rows by withRows() will be ignored.

rows: A list of gson.JsonObject objects, each representing a row in key-value format.
For each field:
- If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input;
- If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input;
- If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input;
- If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input;
- If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input;
- If dataType is JSON, use JsonObject.add(key, JsonElement) to input;
Note:
1. For scalar numeric values, value will be cut according to the type of the field.
For example:
An Int8 field named "XX", you set the value to be 128 by JsonObject.addProperty("XX", 128), the value 128 is cut to -128.
An Int64 field named "XX", you set the value to be 3.9 by JsonObject.addProperty("XX", 3.9), the value 3.9 is cut to 3.
2. String value can be parsed to numeric/boolean type if the value is valid.
For example:
A Bool field named "XX", you set the value to be "TRUE" by JsonObject.addProperty("XX", "TRUE"), the string "TRUE" is parsed as true.
A Float field named "XX", you set the value to be "3.5" by JsonObject.addProperty("XX", "3.5", the string "3.5" is parsed as 3.5.

build()

Constructs an InsertParam object.

N/A

+ +
+ +

notes

+ +

In Java SDK versions v2.4.1 or earlier versions, the input is a fastjson.JSONObject. But fastjson is not recommended to use now because of its unsafe deserialization vulnerability. Therefore, replace fastjson with gson if you use the Java SDK of v2.4.2 or later releases.

+ +
+ +The `UpsertParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `MutationResult` held by the `R` template. You can use `MutationResultWrapper` to get the returned information. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +List> vectors = generateFloatVectors(1); +List rows = new ArrayList<>(); +JsonObject row = new JsonObject(); +row.addProperty("id", (long)i); +row.add("vector", gson.toJsonTree(vectors.get(0))); +rows.add(row); + +UpsertParam param = UpsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withRows(rows) + .build(); + +R response = client.upsert(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +MutationResultWrapper wrapper = new MutationResultWrapper(response.getData()); +System.out.println(wrapper.getInsertCount() + " rows upserted"); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsertAsync.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsertAsync.md new file mode 100644 index 000000000..0da5c7474 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Collection/upsertAsync.md @@ -0,0 +1,39 @@ +# upsertAsync() + +A MilvusClient interface. This method inserts new entities into a specified collection, and replaces them if the entities already exist. + +```java +ListenableFuture> upsertAsync(UpsertParam requestParam); +``` + +This method uses the same parameter as `upsert()`, it invokes the RPC interface and returns a `ListenableFuture` object immediately. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +List> vectors = generateFloatVectors(1); +List rows = new ArrayList<>(); +JsonObject row = new JsonObject(); +row.addProperty("id", (long)i); +row.add("vector", gson.toJsonTree(vectors.get(0))); +rows.add(row); + +UpsertParam param = UpsertParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withRows(rows) + .build(); +ListenableFuture> response = client.upsertAsync(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +R result = response.get(); +MutationResultWrapper wrapper = new MutationResultWrapper(result.getData()); +System.out.println(wrapper.getInsertCount() + " rows upserted"); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClient.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClient.md new file mode 100644 index 000000000..a56168fd4 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClient.md @@ -0,0 +1,258 @@ +# MilvusClient + +MilvusClient is an abstract interface of the Milvus client. MilvusServiceClient class is the implementation. + +```java +package io.milvus.client; +MilvusServiceClient(ConnectParam connectParam) +``` + +Methods of MilvusClient for connection: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

withTimeout(long timeout, TimeUnit timeoutUnit)

Timeout setting for RPC call.

timeout: The timeout period when invoking a method.

timeoutUnit: The unit for timeout.

MilvusClient

withRetry(RetryParam retryParam)

Sets the parameters for retry.

retryParam: Parameter for retry on failure.

MilvusClient

close(long maxWaitSeconds)

Disconnects from a Milvus server with a configurable timeout value. Call this method before the application terminates.This method throws an InterruptedException exception if it is interrupted.

maxWaitSeconds: The timeout period to wait for the RPC channel to close.

N/A

setLogLevel(LogLevel level)

Set log level in runtime.Note: this method cannot change the log level configured by log4j configurations. It only hides some logs inside the MilvusClient class.

level: A log level

N/A

+ +#### ConnectParam + +Use the `ConnectParam.Builder` to construct a `ConnectParam` object for the MilvusClient. + +```java +import io.milvus.param.ConnectParam; +ConnectParam.Builder builder = ConnectParam.newBuilder(); +``` + +Methods of `ConnectParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Patameters

withHost(String host)

Sets the host name or address.

host: The name or address of the host.

withPort(int port)

Sets the connection port.
The value must be greater than zero and less than 65536.

port: The connection port.

withUri(String uri)

Sets the uri of remote service.

uri: The uri of remote service.

withToken(String token)

Sets the token of remote service.

token: serving as the key for identification and authentication purposes.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConnectTimeout(long connectTimeout, TimeUnit timeUnit)

Sets the connection timeout value of client channel. The timeout value must be greater than zero. The default value is 10 seconds.

connectTimeout: The connection timeout period.
timeUnit: The unit of timeout.

withKeepAliveTime(long keepAliveTime, TimeUnit timeUnit)

Sets the keep-alive time value of the client channel. The time value must be greater than zero. The default value is 55 seconds.

keepAliveTime: The keep-alive time period.
timeUnit: The unit of time.

withKeepAliveTimeout(long keepAliveTimeout, TimeUnit timeUnit)

Sets the keep-alive timeout value of client channel. The timeout value must be greater than zero. The default value is 20 seconds.

keepAliveTimeout: The keep-alive timeout value.
timeUnit: The unit of timeout.

keepAliveWithoutCalls(boolean enable)

Enables the keep-alive function for the client channel. The default value is false.

enable: Boolean value to indicate if the keep-alive function is enabled. The keep-alive function is enabled if the value is set to true.

secure(boolean enable)
withSecure(boolean enable)

Enables security for the client channel.

enable: Security is enabled if the value is set to true.

withIdleTimeout(long idleTimeout, TimeUnit timeUnit)

Sets the value of idle timeout of the client channel. The timeout value must be greater than zero. The default value is 24 hours.

idleTimeout: The idle timeout period of the client channel.
timeUnit: The unit of timeout.

withRpcDeadline(long deadline, TimeUnit timeUnit)

Set a deadline for how long you are willing to wait for a reply from the server.
With a deadline setting, the client will wait when encounter fast RPC fail caused by network fluctuations.
The deadline value must be larger than or equal to zero. Default value is 0, deadline is disabled.

deadline: deadline value
timeUnit: deadline unit

withAuthorization(String username, String password)

Sets the username and password for this connection.

username: The username of the current user.
password: The password corresponding to the username.

withClientKeyPath(String clientKeyPath)

Set the client.key path for tls two-way authentication, only takes effect when "secure" is True.

clientKeyPath: The local path of client.key

withClientPemPath(String clientPemPath)

Set the client.pem path for tls two-way authentication, only takes effect when "secure" is True.

clientPemPath: The local path of client.pem

withCaPemPath(String caPemPath)

Set the ca.pem path for tls two-way authentication, only takes effect when "secure" is True.

caPemPath: The local path of ca.pem

withServerPemPath(String serverPemPath)

Set the server.pem path for tls one-way authentication, only takes effect when "secure" is True.

serverPemPath: The local path of server.pem

withServerName(String serverName)

Set target name override for SSL host name checking, only takes effect when "secure" is True.
Note: this value is passed to grpc.ssltargetname_override

serverName: The override name for SSL host.

build()

Constructs a ConnectParam object.

N/A

+ +The `ConnectParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### RetryParam + +Use the `RetryParam.Builder` to construct a RetryParam object for the `MilvusClient`. + +```java +import io.milvus.param.RetryParam; +RetryParam.Builder builder = RetryParam.newBuilder(); +``` + +Methods of `RetryParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Patameters

withMaxRetryTimes(int maxRetryTimes)

Sets the max retry times on failure.Default value is 75.

maxRetryTimes: The maxinum times to retry.

withInitialBackOffMs(long initialBackOffMs)

Sets the first time interval between two retries, units: millisecond. Default value is 10ms.

initialBackOffMs: Retry initial interval value in milliseconds.

withMaxBackOffMs(long maxBackOffMs)

Sets the maximum time interval between two retries, units: millisecond. Default value is 3000ms.

maxBackOffMs: Retry maximum interval value in milliseconds.

withBackOffMultiplier(int backOffMultiplier)

Sets multiplier to increase time interval after each retry. Default value is 3.

backOffMultiplier: The multiplier to increase time interval after each retry.

withRetryOnRateLimie(boolean retryOnRateLimie)

Sets whether to retry when the returned error is rate limit. Default value is true.

retryOnRateLimit: Whether to retry when the returned error is rate limit.

build()

Constructs a RetryParam object.

N/A

+ +The `RetryParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Example + +- Without timeout setting for RPC call: + +```java +import io.milvus.param.*; +import io.milvus.client.*; + +ConnectParam connectParam = ConnectParam.newBuilder() + .withHost("localhost") + .withPort(19530) + .withAuthorization("root", "Milvus") + .build(); +RetryParam retryParam = RetryParam.newBuilder() + .withMaxRetryTimes(10) + .build(); +MilvusClient client = new MilvusServiceClient(connectParam).withRetry(retryParam); + +ShowCollectionsParam param = ShowCollectionsParam.newBuilder().build() +R response = client.showCollections(param); + +client.close(1); +``` + +- With timeout setting for RPC call: + +```java +import io.milvus.param.*; +import io.milvus.client.*; +import java.util.concurrent.TimeUnit; + +ConnectParam connectParam = ConnectParam.newBuilder() + .withHost("localhost") + .withPort(19530) + .withAuthorization("root", "Milvus") + .build(); +MilvusClient client = new MilvusServiceClient(connectParam); + +ShowCollectionsParam param = ShowCollectionsParam.newBuilder().build() +R response = client.withTimeout(2, TimeUnit.SECONDS).showCollections(param); + +client.close(1); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClientV1Pool.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClientV1Pool.md new file mode 100644 index 000000000..58612088a --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Connections/MilvusClientV1Pool.md @@ -0,0 +1,168 @@ +# MilvusClientV1Pool + +A MilvusClientV1Pool instance is a connection pool for MilvusClient objects. The number of MilvusClient objects automatically increases or decreases to avoid frequent opening and closing connections, improving your application's performance. + +Methods of MilvusClient for connection: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getClient(String key)

Get a client object that is idle from the pool.Once the caller holds the client, it will be marked as an active state and cannot be fetched by other callers.If the number of clients hits the MaxTotalPerKey value, this method will be blocked for MaxBlockWaitDuration.If no idle client is available after MaxBlockWaitDuration, this method will return a null object to the caller.

key: the key of a group where the client belongs

MilvusClient

returnClient(String key, MilvusClient grpcClient)

Return a client object. Once a client is returned, it becomes idle state and waits for the next caller.The caller should ensure the client is returned. Otherwise, the client will keep in active state and cannot be used by the next caller.Throw exceptions if the key doesn't exist or the client does not belong to this key group.

key: the key of a group where the client belongsgrpcClient: the client object to return

void

getIdleClientNumber(String key)

Return the number of idle clients of a key group.

key: the key of a group

int

getActiveClientNumber(String key)

Return the number of active clients of a key group.

key: the key of a group

int

getTotalIdleClientNumber()

Return the number of idle clients of all key groups.

int

getTotalActiveClientNumber()

Return the number of active clients of all key groups

int

clear(String key)

Release/disconnect idle clients of a key group.

key: the key of a group

void

clear()

Release/disconnect idle clients of all key groups.

void

close()

Release/disconnect all clients of all key groups, and close the pool.

void

+ +#### PoolConfig + +Use the PoolConfig.PoolConfigBuilder to construct a PoolConfig. + +```java +import io.milvus.pool.PoolConfig; +PoolConfig.PoolConfigBuilder builder = PoolConfig.builder(); +``` + +Methods of PoolConfig.PoolConfigBuilder: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Patameters

maxIdlePerKey(int maxIdlePerKey)

The maximum number of idle clients for each key. If the number of idle clients exceeds this number, some clients will be automatically closed. The default value is 5.

maxIdlePerKey: The maximum number of idle clients .

minIdlePerKey(int minIdlePerKey)

The minimize number of idle clients for each key. The default value is 0.

minIdlePerKey: The minimize number of idle clients.

maxTotalPerKey(int maxTotalPerKey)

The maximum number of clients for each key, including idle clients and active clients. The default value is 10.

maxTotalPerKey: The maximum number of clients

maxTotal(int maxTotal)

The maximum number of clients in total, including idle clients and active clients. The default value is 50.

maxTotal: The maximum number of clients.

blockWhenExhausted(boolean blockWhenExhausted)

Block the getClient() method for a duration when the maximum number of clients is hit and all the clients are active. If this flag is false, the getClient() will instantly throw an exception if the maximum number of clients is hit and all the clients are active. The default value is true.

blockWhenExhausted: Set to true for blocking getClient() when the pool is full.

maxBlockWaitDuration(Duration maxBlockWaitDuration)

Max block duration when the maximum number of clients is hit and all the clients are active. The default value is 3 seconds.

maxBlockWaitDuration: Duration of blocking getClient().

evictionPollingInterval(Duration evictionPollingInterval)

Trigger an eviction action to evict expired idle clients for each duration. The default value is 60 seconds.

evictionPollingInterval: Interval to trigger eviction action.

minEvictableIdleDuration(Duration minEvictableIdleDuration)

An idle client expires after this duration and can be evicted.

minEvictableIdleDuration: Duration to evict idle client.

testOnBorrow(boolean testOnBorrow)

If this flag is set to true, the pool will check if the grpc connection of a client is terminated or closed each time the getClient() is called.

testOnBorrow: Set to true to check connection when getClient() is called.

testOnReturn(boolean testOnReturn)

If this flag is set to true, the pool will check if the grpc connection of a client is terminated or closed each time the returnClient() is called.

testOnReturn: Set to true to check connection when returnClient() is called.

+ +#### Example + +```java +import io.milvus.param.ConnectParam +import io.milvus.pool.PoolConfig +import io.milvus.pool.MilvusClientV1Pool +import io.milvus.client.MilvusClient + +ConnectParam connectConfig = ConnectParam.newBuilder() + .withHost("localhost") + .withPort(19530) + .build(); +PoolConfig poolConfig = PoolConfig.builder() + .maxIdlePerKey(10) // max idle clients per key + .maxTotalPerKey(20) // max total(idle + active) clients per key + .maxTotal(100) // max total clients for all keys + .maxBlockWaitDuration(Duration.ofSeconds(5L)) // getClient() will wait 5 seconds if no idle client available + .minEvictableIdleDuration(Duration.ofSeconds(10L)) // if number of idle clients is larger than maxIdlePerKey, redundant idle clients will be evicted after 10 seconds + .build(); +MilvusClientV1Pool pool; + +MilvusClient client = pool.getClient("client_name"); +try { + // use the client to do something +} catch (Exception e) { +} finally { + pool.returnClient("client_name", client); // make sure the client is returned after use +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/alterDatabase.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/alterDatabase.md new file mode 100644 index 000000000..6d8eff09a --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/alterDatabase.md @@ -0,0 +1,181 @@ +# alterDatabase() + +The MilvusClient interface. This method alters a database. + +```java +R alterDatabase(AlterDatabaseParam requestParam); +``` + +#### AlterDatabaseParam + +Use the `AlterDatabaseParam.Builder` to construct an `AlterDatabaseParam` object. + +```java +import io.milvus.param.collection.AlterDatabaseParam; +AlterDatabaseParam.Builder builder = AlterDatabaseParam.newBuilder() +``` + +Methods of `AlterDatabaseParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the databaseName name. Database name cannot be empty or null.

databaseName: The database name

withReplicaNumber(int replicaNumber)

Sets the replica number in database level, then if load collection doesn't have replica number, it will use this replica number.

replicaNumber: replica number

WithResourceGroups(List<String> resourceGroups)

Sets the resource groups in database level, then if load collection doesn't have resource groups, it will use this resource groups.

resourceGroups: resource group names

build()

Construct a CreateDatabaseParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.collection.AlterDatabaseParam; + +AlterDatabaseParam param = AlterDatabaseParam.newBuilder() + .withDatabaseName("mydnb") + .withReplicaNumber(3) + .WithResourceGroups(Arrays.asList("rg1", "rg2", "rg3")) + .build(); + +R response = client.alterDatabase(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` + +## describeDatabase() + +The MilvusClient interface. This method describes a database. + +```java +R describeDatabase(DescribeDatabaseParam requestParam); +``` + +#### DescribeDatabaseParam + +Use the `DescribeDatabaseParam.Builder` to construct a `DescribeDatabaseParam` object. + +```java +import io.milvus.param.collection.DescribeDatabaseParam; +DescribeDatabaseParam.Builder builder = DescribeDatabaseParam.newBuilder() +``` + +Methods of `DescribeDatabaseParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the databaseName name. Database name cannot be empty or null.

databaseName: The database name

build()

Construct a DescribeDatabaseParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `DescribeDatabaseResponse` held by the R template. You can use DescDBResponseWrapper to get the information. + +#### DescDBResponseWrapper + +A tool class to encapsulate the `DescribeDatabaseResponse`. + +```java +import io.milvus.response.DescDBResponseWrapper; +DescDBResponseWrapper wrapper = new DescDBResponseWrapper(describeDBResponse); +``` + +Methods of `DescDBResponseWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getDatabaseName()

Returns the name of the database.

N/A

String

getReplicaNumber()

Returns database-level replica number.

N/A

int

getResourceGroups()

Returns resource groups of the database.

N/A

List<String>

getProperties()

Returns all properties of the database, including the replica number and resource groups.

N/A

Map<String, String>

+ +#### Example + +```java +import io.milvus.param.collection.DescribeDatabaseParam; +import io.milvus.response.DescDBResponseWrapper; + +DescribeDatabaseParam describeDBParam = DescribeDatabaseParam.newBuilder() + .withDatabaseName("mydb") + .build(); +R response = client.describeDatabase(describeDBParam); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +DescDBResponseWrapper describeDBWrapper = new DescDBResponseWrapper(response.getData()); +System.out.println(describeDBWrapper.getReplicaNumber()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/createDatabase.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/createDatabase.md new file mode 100644 index 000000000..609ccd1e8 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/createDatabase.md @@ -0,0 +1,74 @@ +# createDatabase() + +The MilvusClient interface. This method creates a database*.* + +```java +R createDatabase(CreateDatabaseParam requestParam); +``` + +#### CreateDatabaseParam + +Use the `CreateDatabaseParam.Builder` to construct a `CreateDatabaseParam` object. + +```java +import io.milvus.param.collection.CreateDatabaseParam; +CreateDatabaseParam.Builder builder = CreateDatabaseParam.newBuilder() +``` + +Methods of `CreateDatabaseParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the database name. Database name cannot be empty or null.

databaseName: The database name.

withReplicaNumber(int replicaNumber)

Sets the replica number in database level, then if load collection doesn't have replica number, it will use this replica number.

replicaNumber: Replica number

withResourceGroups(List<String> resourceGroups)

Sets the resource groups in database level, then if load collection doesn't have resource groups, it will use this resource groups.

resourceGroups: Resource group names

build()

Construct a CreateDatabaseParam object.

N/A

+ +The `CreateDatabaseParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.collection.CreateDatabaseParam; + +CreateDatabaseParam param = CreateDatabaseParam.newBuilder() + .withDatabaseName("mydb") + .build(); +R response = client.createDatabase(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/dropDatabase.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/dropDatabase.md new file mode 100644 index 000000000..62613982e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/dropDatabase.md @@ -0,0 +1,64 @@ +# dropDatabase() + +The MilvusClient interface. This method drops a database. Note that this method drops all data in the database. + +```java +R dropDatabase(DropDatabaseParam requestParam); +``` + +#### DropDatabaseParam + +Use the `DropDatabaseParam.Builder` to construct a `DropDatabaseParam` object. + +```java +import io.milvus.param.collection.DropDatabaseParam; +DropDatabaseParam.Builder builder = DropDatabaseParam.newBuilder() +``` + +Methods of `DropDatabaseParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the databaseName name. Database name cannot be empty or null.

databaseName: The database name

build()

Construct a CreateDatabaseParam object.

N/A

+ +The `DropDatabaseParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.collection.DropDatabaseParam; + +DropDatabaseParam param = DropDatabaseParam.newBuilder() + .withDatabaseName("mydb") + .build(); +R response = client.dropDatabase(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/listDatabases.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/listDatabases.md new file mode 100644 index 000000000..65816a77b --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Database/listDatabases.md @@ -0,0 +1,26 @@ +# listDatabases() + +The MilvusClient interface. This method lists all databases in the cluster. + +```java +R listDatabases(); +``` + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `ListDatabasesResponse` held by the R template. + +#### Example + +```java +R response = client.listDatabases() +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/createCollection.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/createCollection.md new file mode 100644 index 000000000..c778ed622 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/createCollection.md @@ -0,0 +1,119 @@ +# createCollection() + +A MilvusClient interface. This method creates a collection with simple parameters. + +```java +R createCollection(CreateSimpleCollectionParam requestParam); +``` + +#### CreateSimpleCollectionParam + +Use the `CreateSimpleCollectionParam.Builder` to construct a `CreateSimpleCollectionParam` object. + +```java +import io.milvus.param.highlevel.collection.CreateCollectionParam; +CreateSimpleCollectionParam.Builder builder = CreateSimpleCollectionParam.newBuilder(); +``` + +Methods of `CreateSimpleCollectionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to create.

withDimension(int dimension)

Sets the collection vector dimension. Dimension value must be greater than zero and less than 32768.

dimension: The number of dimensions for the vector field of the collection.

withMetricType(MetricType metricType)

Sets the metricType of vectorField. The distance metric used for the collection.

metricType: The distance metric used for the collection.

withDescription(String description)

Sets the collection description. The description can be empty. The default description is "".

description: The description of the collection to create.

withPrimaryField(String primaryField)

Sets the primaryFiled name. The primaryField cannot be empty or null. The default is "id".

primaryField: The primary field name of the collection.

withVectorField(String vectorField)

Sets the vectorField name. The vectorField cannot be empty or null. The default is "vector".

vectorField: The vector field name of the collection.

withAutoId(boolean autoId)

Sets the autoId. The default is Boolean.False.

autoId: If open autoId towards to this collection.

withSyncLoad(boolean syncLoad)

Sets the SyncLoad when loadCollection.The default is Boolean.True.

syncLoad: If syncLoad when loadCollection.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the consistency level. The default value is ConsistencyLevelEnum.BOUNDED

consistencyLevel: The consistency level of this collection.

withPrimaryFieldType(DataType primaryFieldType)

Sets the primaryFiled type. The primaryField type cannot be empty or null. The default is "DataType.Int64".

primaryFieldType: The type of the primary field of this collection.

withMaxLength(Integer maxLength)

Sets the primaryFiled maxLength.
If primaryFiled is specified as varchar, this parameter maxLength needs to be specified

maxLength: The max length of the primary field If primaryFiled is specified as varchar.

build()

Constructs a CreateSimpleCollectionParam object.

N/A

+ +The `CreateSimpleCollectionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.highlevel.collection.*; + +CreateSimpleCollectionParam param = CreateSimpleCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withDimension(VECTOR_DIM) + .withPrimaryField(ID_FIELD) + .withVectorField(VECTOR_FIELD) + .withAutoId(true) + .build(); + +R response = client.createCollection(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/delete.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/delete.md new file mode 100644 index 000000000..147a1d99c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/delete.md @@ -0,0 +1,89 @@ +# delete() + +A MilvusClient interface. This method deletes entity(s) based on the primary key ids. + +```java +R delete(DeleteIdsParam requestParam); +``` + +#### DeleteIdsParam + +Use the `DeleteIdsParam.Builder` to construct a `DeleteIdsParam` object. + +```java +import io.milvus.param.highlevel.dml.DeleteIdsParam; +DeleteIdsParam.Builder builder = DeleteIdsParam.newBuilder(); +``` + +Methods of `DeleteIdsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to insert data into.

withPartitionName(tring partitionName)

Sets the partition name (Optional).

partitionName: The target partition name.

withPrimaryIds(List<T> primaryIds)

Specifies primaryField ids. PrimaryIds cannot be empty or null.
Note only support the value of primary key.

primaryIds: A list of primary field id.

addPrimaryId(T primaryId)

Specifies primaryField id. PrimaryId cannot be empty or null.
Note only support the value of primary key.

primaryId: The id of primary field key.

build()

Constructs an DeleteIdsParam object.

N/A

+ +The `DeleteIdsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `DeleteResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.highlevel.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; + +List ids = Lists.newArrayList("441966745769900131", "441966745769900133"); +DeleteIdsParam param = DeleteIdsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPrimaryIds(ids) + .build(); + +R response = client.delete(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +for (Object deleteId : response.getData().getDeleteIds()) { + System.out.println(deleteId); +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/get.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/get.md new file mode 100644 index 000000000..36d9c6c52 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/get.md @@ -0,0 +1,96 @@ +# get() + +The MilvusClient interface. This method gets entity(s) based on the primary field ids. Note that the order of the returned entities can not be guaranteed. + +```java +R get(GetIdsParam requestParam); +``` + +#### GetIdsParam + +Use the `GetIdsParam.Builder` to construct a `GetIdsParam` object. + +```java +import io.milvus.param.highlevel.dml.GetIdsParam; +GetIdsParam.Builder builder = GetIdsParam.newBuilder(); +``` + +Methods of `GetIdsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to insert data into.

withPrimaryIds(List<T> primaryIds)

Specifies id fields. ID cannot be empty or null.
Note only support the value of primary key.

primaryIds: a list of primary field key objects.

addPrimaryId(T primaryId)

Specifies primaryField id. PrimaryId cannot be empty or null.
Note only support the value of primary key.

primaryId: The id of primary field key.

withOutputFields(List<String> outputFields)

Specifies output fields (Optional).

outputFields: A list of output field you need.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Consistency level used in the get. If no level is specified, will use default consistency. Please refer to ConsistencyLevelEnum in Misc.

consistencyLevel: The consistency level used in the get.

build()

Constructs an GetIdsParam object.

N/A

+ +The `GetIdsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `GetResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.QueryResultsWrapper; +import io.milvus.response.FieldDataWrapper; +import io.milvus.grpc.QueryResults; + +List ids = Lists.newArrayList("441966745769900131", "441966745769900133"); +GetIdsParam getParam = GetIdsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withId(ids) + .withOutputFields(Lists.newArrayList("*")) + .build(); + +R response = client.get(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +for (QueryResultsWrapper.RowRecord rowRecord : response.getData().getRowRecords()) { + System.out.println(rowRecord); +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/insert.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/insert.md new file mode 100644 index 000000000..86080581c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/insert.md @@ -0,0 +1,115 @@ +# insert() + +A MilvusClient interface. This method inserts entities into a specified collection. + +```java +R insert(InsertRowsParam requestParam); +``` + +#### InsertRowsParam + +Use the `InsertRowsParam.Builder` to construct an InsertRowsParam object. + +```java +import io.milvus.param.highlevel.dml.InsertRowsParam; +InsertRowsParam.Builder builder = InsertRowsParam.newBuilder(); +``` + +Methods of `InsertRowsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the target collection name. Collection name cannot be empty or null.

collectionName: The name of the collection to insert data into.

withRows(List<gson.JsonObject> rows)

Sets the row data to insert. The rows list cannot be empty.
Note that no input is required for the primary key field if auto-ID is enabled.

rows: A list of gson.JsonObject objects, each representing a row data.
For each field:
- If dataType is Bool/Int8/Int16/Int32/Int64/Float/Double/Varchar, use JsonObject.addProperty(key, value) to input;
- If dataType is FloatVector, use JsonObject.add(key, gson.toJsonTree(List[Float]) to input;
- If dataType is BinaryVector/Float16Vector/BFloat16Vector, use JsonObject.add(key, gson.toJsonTree(byte[])) to input;
- If dataType is SparseFloatVector, use JsonObject.add(key, gson.toJsonTree(SortedMap[Long, Float])) to input;
- If dataType is Array, use JsonObject.add(key, gson.toJsonTree(List of Boolean/Integer/Short/Long/Float/Double/String)) to input;
- If dataType is JSON, use JsonObject.add(key, JsonElement) to input;
Note:
1. For scalar numeric values, value will be cut according to the type of the field.
For example:
An Int8 field named "XX", you set the value to be 128 by JsonObject.addProperty("XX", 128), the value 128 is cut to -128.
An Int64 field named "XX", you set the value to be 3.9 by JsonObject.addProperty("XX", 3.9), the value 3.9 is cut to 3.
2. String value can be parsed to numeric/boolean type if the value is valid.
For example:
A Bool field named "XX", you set the value to be "TRUE" by JsonObject.addProperty("XX", "TRUE"), the string "TRUE" is parsed as true.
A Float field named "XX", you set the value to be "3.5" by JsonObject.addProperty("XX", "3.5", the string "3.5" is parsed as 3.5.

build()

Constructs an InsertRowsParam object.

N/A

+ +
+ +

notes

+ +

In Java SDK versions v2.4.1 or earlier versions, the input is a fastjson.JSONObject. But fastjson is not recommended to use now because of its unsafe deserialization vulnerability. Therefore, replace fastjson with gson if you use the Java SDK of v2.4.2 or later releases.

+ +
+ +The `InsertRowsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `InsertResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.MutationResultWrapper; +import io.milvus.grpc.MutationResult; +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +List rows = new ArrayList<>(); +Random ran = new Random(); +for (long i = 0L; i < rowCount; ++i) { + JsonObject row = new JsonObject(); + row.addProperty(AGE_FIELD, ran.nextInt(99)); + List vector = generateFloatVector(); + row.add(VECTOR_FIELD, gson.toJsonTree(vector)); + + // $meta if collection EnableDynamicField, you can input this field not exist in schema, else deny + row.addProperty(INT32_FIELD_NAME, ran.nextInt()); + row.addProperty(INT64_FIELD_NAME, ran.nextLong()); + row.addProperty(VARCHAR_FIELD_NAME, "varchar"); + row.addProperty(FLOAT_FIELD_NAME, ran.nextFloat()); + row.addProperty(DOUBLE_FIELD_NAME, ran.nextDouble()); + row.addProperty(BOOL_FIELD_NAME, ran.nextBoolean()); + + // $json + JsonObject jsonObject = new JsonObject(); + jsonObject.addProperty(INT32_FIELD_NAME, ran.nextInt()); + jsonObject.addProperty(INT64_FIELD_NAME, ran.nextLong()); + jsonObject.addProperty(VARCHAR_FIELD_NAME, "varchar"); + jsonObject.addProperty(FLOAT_FIELD_NAME, ran.nextFloat()); + jsonObject.addProperty(DOUBLE_FIELD_NAME, ran.nextDouble()); + jsonObject.addProperty(BOOL_FIELD_NAME, ran.nextBoolean()); + row.add(USER_JSON_FIELD, jsonObject); + + rows.add(row); +} + +InsertRowsParam param = InsertRowsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withRows(rows) + .build(); +R response = client.insert(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println("insertCount: " + response.getData().getInsertCount()); +System.out.println("insertIds: " + response.getData().getInsertIds()); +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/listCollections.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/listCollections.md new file mode 100644 index 000000000..0e9d3e698 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/listCollections.md @@ -0,0 +1,63 @@ +# listCollections() + +A MilvusClient interface. This method lists all the collections*.* + +```java +R listCollections(ListCollectionsParam requestParam); +``` + +#### ListCollectionsParam + +Use the `ListCollectionsParam.Builder` to construct a `ListCollectionsParam` object. + +```java +import io.milvus.param.highlevel.collection.ListCollectionsParam; +ListCollectionsParam.Builder builder = ListCollectionsParam.newBuilder(); +``` + +Methods of `ListCollectionsParam.Builder`: + + + + + + + + + + + + +

Method

Description

Parameters

build()

Constructs a ListCollectionsParam object

N/A

+ +The `ListCollectionsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `ListCollectionsResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.highlevel.collection.*; + +ListCollectionsParam param = ListCollectionsParam.newBuilder() + .build(); + +R response = client.listCollections(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +for (String collectionName : response.getData().collectionNames) { + System.out.println(collectionName); +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/query.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/query.md new file mode 100644 index 000000000..fd5644884 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/query.md @@ -0,0 +1,101 @@ +# query() + +The MilvusClient interface. This method queries entity(s) based on scalar field(s) filtered by boolean expression. Note that the order of the returned entities can not be guaranteed. + +```java +R query(QuerySimpleParam requestParam); +``` + +#### QuerySimpleParam + +Use the `QuerySimpleParam.Builder` to construct a `QuerySimpleParam` object. + +```java +import io.milvus.param.highlevel.dml.QuerySimpleParam; +QuerySimpleParam.Builder builder = QuerySimpleParam.newBuilder(); +``` + +Methods of `QuerySimpleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withOutputFields(List<String> outputFields)

Specifies output scalar fields (Optional).
If output fields are specified, the QueryResults returned by query() will contains the values of these fields.


outputFields: The name list of fields to be outputed.

withFilter(String filter)

Set the expression to query entities. For more information please refer to this doc.

filter: The expression to query.

withOffset(Long offset)

Specify a position, the returned entities before this position will be ignored. Only take effect when the 'limit' value is specified.Default value is 0, start from begin.

offset: A value to define the position.

withLimit(Long limit)

Specify a value to control the returned number of entities. Must be a positive value.Default value is 0, will return without limit.

limit: A value to define the limit of returned entities.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Consistency level used in the query. If no level is specified, will use default consistency. Please refer to ConsistencyLevelEnum in Misc.

consistencyLevel: The consistency level used in the query.

build()

Construct a QuerySimpleParam object.

N/A

+ +The `QuerySimpleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns valid `QueryResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.QueryResultsWrapper; +import io.milvus.response.FieldDataWrapper; +import io.milvus.grpc.QueryResults; + +QuerySimpleParam querySimpleParam = QuerySimpleParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withOutFields(Lists.newArrayList("*")) + .withFilter(filter) + .withLimit(100L) + .withOffset(0L) + .build(); +R response = client.query(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +for (QueryResultsWrapper.RowRecord rowRecord : response.getData().getRowRecords()) { + System.out.println(rowRecord); +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/search.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/search.md new file mode 100644 index 000000000..c2f6b5bf9 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/HighlevelAPI/search.md @@ -0,0 +1,105 @@ +# search() + +The MilvusClient interface. This method conducts an approximate nearest neighbor (ANN) search on a vector field and pairs up with a Boolean expression to conduct filtering on scalar fields before searching. + +```java +R search(SearchSimpleParam requestParam); +``` + +#### SearchSimpleParam + +Use the `SearchSimpleParam.Builder` to construct a `SearchSimpleParam` object. + +```java +import io.milvus.param.highlevel.dml.SearchSimpleParam; +SearchSimpleParam.Builder builder = SearchSimpleParam.newBuilder(); +``` + +Methods of `SearchSimpleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: target collection name

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).


outFields: The name list of fields to be outputed

withFilter(String filter)

Set the expression to filter scalar fields before searching(Optional).For more information please refer to this doc.

filter: The expression to filter scalar fields

withVectors(List<?> vectors)

Set the target vector. Up to 16384 vectors allowed.

vectors:
- If target field type is float vector, List< List<Float>gt; is required;
- If target field type is binary vector, List<ByteBuffer> is required;

withOffset(Long offset)

Specify a position, the returned entities before this position will be ignored. Only take effect when the 'limit' value is specified.Default value is 0, start from begin.

offset: A value to define the position

withLimit(Long limit)

Specify a value to control the returned number of entities. Must be a positive value.Default value is 10, will return without limit.

limit: A value to define the limit of returned entities

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Consistency level used in the search. If no level is specified, will use default consistency. Please refer to ConsistencyLevelEnum in Misc.

consistencyLevel: The consistency level used in the search

build()

Construct a SearchSimpleParam object.

N/A

+ +The `SearchSimpleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns a valid `SearchResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.SearchResultsWrapper; +import io.milvus.grpc.SearchResults; + +SearchSimpleParam param = SearchSimpleParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withVectors(generateFloatVector()) + .withOutputFields(Lists.newArrayList("*")) + .withFilter(filter) + .withLimit(100L) + .withOffset(0L) + .build(); +R response = client.search(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +for (QueryResultsWrapper.RowRecord rowRecord : response.getData().getRowRecords()) { + System.out.println(rowRecord); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/alterIndex.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/alterIndex.md new file mode 100644 index 000000000..b8c75de22 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/alterIndex.md @@ -0,0 +1,76 @@ +# alterIndex() + +MilvusClient interface. This method alters an index with key-value properties. + +```java +R alterIndex(AlterIndexParam requestParam); +``` + +#### AlterIndexParam + +Use the `AlterIndexParam.Builder` to construct an `AlterIndexParam` object. + +```java +import io.milvus.param.AlterIndexParam; +AlterIndexParam.Builder builder = AlterIndexParam.newBuilder(); +``` + +Methods of `AlterIndexParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

Set the target index name. If no index name is specified,the default index name is empty string which means let the server determine it.

indexName: The name of the index.

build()

Construct a AlterIndexParam object.

N/A

+ +The `AlterIndexParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +AlterIndexParam param = AlterIndexParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withIndexName("index1") + .withMMapEnabled(true) + .build(); +R response = client.alterIndex(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/createIndex.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/createIndex.md new file mode 100644 index 000000000..a46be353c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/createIndex.md @@ -0,0 +1,113 @@ +# createIndex() + +The MilvusClient interface. This method creates an index on a field in the specified collection. + +```java +R createIndex(CreateIndexParam requestParam); +``` + +#### CreateIndexParam + +Use the `CreateIndexParam.Builder` to construct a `CreateIndexParam` object. + +```java +import io.milvus.param.CreateIndexParam; +CreateIndexParam.Builder builder = CreateIndexParam.newBuilder() +``` + +Methods of `CreateIndexParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(
String collectionName)

Set the target collection name. Collection name cannot be empty or null.

collectionName: The name of the target collection to create an index for.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withFieldName(String fieldName)

Set the target field name. Field name cannot be empty or null.

fieldName: The target field name

withIndexType(IndexType indexType)

Set the index type. Please refer to IndexType in Misc.

indexType: The index type

withIndexName(String indexName)

Set the name of index which will be created. Then you can use the index name to check the state of index. If no index name is specified, the default index name is empty string which means let the server determine it. The max length of index name is 255 characters.

indexName: The name of the index

withMetricType(MetricType metricType)

Sets the metric type. Please refer to MetricType in Misc.

metricType: The metric type


withExtraParam(String extraParam)


Sets the specific index parameters according to index type. For example, IVF index, the extra parameters can be "\{\"nlist\":1024}".

extraParam:
Extra parameters in JSON format

withSyncMode(Boolean syncMode)

Enable sync mode. For sync mode, the client keeps waiting until all segments of the collection are successfully indexed. If sync mode is disabled, the createIndex() returns instantly. By default sync mode is enabled.

syncMode: true is sync mode

withSyncWaitingInterval(Long milliseconds)

Set the waiting interval in sync mode. With sync mode enabled, the client constantly checks index state by interval. Interval value must be greater than zero, and cannot be greater than Constant.MAXWAITINGINDEX_INTERVAL. By default, interval value is 500 milliseconds.


milliseconds: Sync mode interval value(unit: millisecond)


withSyncWaitingTimeout( Long seconds)

Set the timeout value for sync mode. Timeout value must be greater than zero and no upper limit. Default value is 600 seconds.

seconds: Sync mode timeout value(unit: second)

build()

Construct a CreateAliasParam object.

N/A

+ +The `CreateIndexParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +CreateIndexParam param = CreateIndexParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withFieldName("field1") + .withIndexType(IndexType.IVF_FLAT) + .withMetricType(MetricType.L2) + .withExtraParam("{\"nlist\":64}") + .build(); +R response = client.createIndex(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/describeIndex.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/describeIndex.md new file mode 100644 index 000000000..cfdc32184 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/describeIndex.md @@ -0,0 +1,148 @@ +# describeIndex() + +MilvusClient interface. This method shows the information of the specified index. + +```java +R describeIndex(DescribeIndexParam requestParam); +``` + +#### DescribeIndexParam + +Use the `DescribeIndexParam.Builder` to construct a `DescribeIndexParam` object. + +```java +import io.milvus.param.DescribeIndexParam; +DescribeIndexParam.Builder builder = DescribeIndexParam.newBuilder(); +``` + +Methods of `DescribeIndexParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

Set the target index name. If no index name is specified, the default index name is empty string which means let the server determine it.

indexName: The name of the index.

withFieldName(String fieldName)

Sets the target field name. Field name can be empty or null.
If no field name is specified, then return all this collection indexes.

fieldName: The field name.

build()

Construct a DescribeIndexParam object.

N/A

+ +The `DropIndexParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `DescribeIndexResponse` held by the `R` template. You can use `DescIndexResponseWrapper` to get index descriptions easily. + +#### DescIndexResponseWrapper + +A tool class to encapsulate the `DescribeIndexResponse`. + +```java +import io.milvus.response.DescIndexResponseWrapper; +DescIndexResponseWrapper wrapper = new DescIndexResponseWrapper(descIndexResponse); +``` + +Methods of `DescIndexResponseWrapper`: + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getIndexDescriptions()

Get a list of all index descriptions. (Currently only return one index information)

N/A

List<IndexDesc>

getIndexDescByFieldName(String fieldName)

Get index description by field name. Return null if the field doesn't exist.

fieldName: A field name

IndexDesc

+ +#### IndexDesc + +A tool class to describe an index. + +Methods of `DescIndexResponseWrapper.IndexDesc` + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

getIndexType()

Get index type.

IndexType

getMetricType()

Get metric type.

MetricType

getExtraParam()

Get index parameters in JSON format.

String

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.response.DescIndexResponseWrapper; +import io.milvus.grpc.DescribeIndexResponse; + +DescribeIndexParam param = DescribeIndexParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withIndexName("index1") + .build(); +R response = client.describeIndex(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +DescIndexResponseWrapper wrapper = new DescIndexResponseWrapper(response.getData()); +for (DescIndexResponseWrapper.IndexDesc desc : wrapper.getIndexDescriptions()) { + System.out.println(desc.toString()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/dropIndex.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/dropIndex.md new file mode 100644 index 000000000..313ade94c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/dropIndex.md @@ -0,0 +1,75 @@ +# dropIndex() + +MilvusClient interface. This method drops an index of a field for the specified collection. + +```java +R dropIndex(DropIndexParam requestParam); +``` + +#### DropIndexParam + +Use the `DropIndexParam.Builder` to construct a `DropIndexParam` object. + +```java +import io.milvus.param.DropIndexParam; +DropIndexParam.Builder builder = DropIndexParam.newBuilder(); +``` + +Methods of `DropIndexParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

The name of index which will be dropped. If no index name is specified, the default index name is empty string which means let the server determine it.

indexName: The name of the index.

build()

Construct a CreateAliasParam object.

N/A

+ +The `DropIndexParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +DropIndexParam param = DropIndexParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withIndexName("index1") + .build(); +R response = client.dropIndex(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexBuildingProgress.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexBuildingProgress.md new file mode 100644 index 000000000..735c8f98c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexBuildingProgress.md @@ -0,0 +1,80 @@ +# getIndexBuildProgress() + +MilvusClient interface. This method shows the index-building progress, such as how many rows are indexed. + +```java +R getIndexBuildProgress(GetIndexBuildProgressParam requestParam); +``` + +#### GetIndexBuildProgressParam + +Use the `GetIndexBuildProgressParam.Builder` to construct a `GetIndexBuildProgressParam` object. + +```java +import io.milvus.param.GetIndexBuildProgressParam; +GetIndexBuildProgressParam.Builder builder = GetIndexBuildProgressParam.newBuilder(); +``` + +Methods of `GetIndexBuildProgressParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

Set the target index name. If no index name is specified,the default index name is empty string which means let the server determine it.

indexName: The name of the index.

build()

Construct a GetIndexBuildProgressParam object.

N/A

+ +The `GetIndexBuildProgressParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetIndexBuildProgressResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetIndexBuildProgressResponse; + +GetIndexBuildProgressParam param = GetIndexBuildProgressParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withIndexName("index1") + .build(); +R response = client.getIndexBuildProgress(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +long indexedRows = response.getData().getIndexedRows(); +long totalRows = response.getData().getTotalRows(); +System.out.println("indexed rows: " + indexedRows + ", total rows: " + totalRows); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexState.md new file mode 100644 index 000000000..7c1358d9c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Index/getIndexState.md @@ -0,0 +1,80 @@ +# getIndexState() + +MilvusClient interface. This method shows the index building state, and the reason for failure (if any). + +```java +R getIndexState(GetIndexStateParam requestParam); +``` + +#### GetIndexStateParam + +Use the `GetIndexStateParam.Builder` to construct a `GetIndexStateParam` object. + +```java +import io.milvus.param.GetIndexStateParam; +GetIndexStateParam.Builder builder = GetIndexStateParam.newBuilder(); +``` + +Methods of `GetIndexStateParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withIndexName(String indexName)

Set the target index name. If no index name is specified, the default index name is empty string which means let the server determine it.

indexName: The name of the index.

build()

Construct a GetIndexStateParam object.

N/A

+ +The `GetIndexStateParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetIndexStateResponse` held by the R template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetIndexStateResponse; + +GetIndexStateParam param = GetIndexStateParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withIndexName("index1") + .build(); +R response = client.getIndexState(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +if (response.getData().getState() == IndexState.Failed) { + System.out.println(response.getData().getFailReason()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionState.md new file mode 100644 index 000000000..889b20ce3 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionState.md @@ -0,0 +1,99 @@ +# getCompactionState() + +MilvusClient interface. This method returns the state of a compaction operation, to know whether this operation has been finished. + +```java +R getCompactionState(GetCompactionStateParam requestParam); +``` + +#### GetCompactionStateParam + +Use the `GetCompactionStateParam.Builder` to construct a `GetCompactionStateParam` object. + +```java +import io.milvus.param.GetCompactionStateParam; +GetCompactionStateParam.Builder builder = GetCompactionStateParam.newBuilder(); +``` + +Methods of `GetCompactionStateParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCompactionID(Long compactionID)

Set the compaction action id to get state.

compactionID: The compaction operation ID.

build()

Construct a GetCompactionStateParam object.

N/A

+ +The `GetCompactionStateParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetCompactionStateResponse` held by the `R` template. + +#### CompactionState + +Use the `getState()` of `GetCompactionStateResponse` to get the compaction state: + +```java +package io.milvus.grpc; +public enum CompactionState +``` + + + + + + + + + + + + + + + + + + + + + + +

Type

Code

Description

UndefiedState

0

For internal usage.

Executing

1

Compaction is in executing

Completed

2

Compaction is completed

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetCompactionStateResponse; + +GetCompactionStateParam param = GetCompactionStateParam.newBuilder() + .withCompactionID(compactionID) + .build(); +R response = client.getCompactionState(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println("Compaction state: " + response.getData().getState()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionStateWithPlans.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionStateWithPlans.md new file mode 100644 index 000000000..fc931a1fe --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getCompactionStateWithPlans.md @@ -0,0 +1,74 @@ +# getCompactionStateWithPlans() + +MilvusClient interface. This method returns detailed information of a compaction operation, including the state(completed or not) and its sub-tasks (we call "plan"). + +```java +R getCompactionStateWithPlans(GetCompactionPlansParam requestParam) +``` + +#### GetCompactionPlansParam + +Use the `GetCompactionPlansParam.Builder` to construct a `GetCompactionPlansParam` object. + +```java +import io.milvus.param.GetCompactionPlansParam; +GetCompactionPlansParam.Builder builder = GetCompactionPlansParam.newBuilder(); +``` + +Methods of `GetCompactionPlansParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCompactionID(Long compactionID)

Set the compaction action id to get details.

compactionID: The compaction operation ID.

build()

Construct a GetCompactionPlansParam object.

N/A

+ +The `GetCompactionPlansParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetCompactionPlansResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetCompactionPlansResponse; +import io.milvus.grpc.CompactionMergeInfo; + +GetCompactionPlansParam param = GetCompactionPlansParam.newBuilder() + .withCompactionID(compactionID) + .build(); +R response = client.getCompactionStateWithPlans(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetCompactionPlansResponse compactionPlans = response.getData(); +System.out.println("Compaction state: " + compactionPlans.getState()); + +for (int i = 0; i < compactionPlans.getMergeInfosCount(); i++) { + CompactionMergeInfo info = compactionPlans.getMergeInfos(i); + System.out.println("Merge segments " + info.getSourcesList().toString() + " into new segment " + info.getTarget()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushAllState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushAllState.md new file mode 100644 index 000000000..5ad85c4b9 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushAllState.md @@ -0,0 +1,60 @@ +# getFlushAllState() + +MilvusClient interface. This method tests whether specified segments are flushed. + +```java +R getFlushAllState(GetFlushAllStateParam requestParam); +``` + +#### GetFlushAllStateParam + +Use the `GetFlushAllStateParam.Builder` to construct a `GetFlushAllStateParam` object. + +```java +import io.milvus.param.GetFlushAllStateParam; +GetFlushAllStateParam.Builder builder = GetFlushAllStateParam.newBuilder(); +``` + +Methods of `GetFlushAllStateParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Construct a GetFlushAllStateParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetFlushAllStateResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetFlushAllStateResponse; + +GetFlushAllStateParam param = GetFlushAllStateParam.newBuilder() + .build(); +R response = client.getFlushAllState(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushState.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushState.md new file mode 100644 index 000000000..2b49e20a8 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getFlushState.md @@ -0,0 +1,87 @@ +# getFlushState() + +MilvusClient interface. This method tests whether specified segments are flushed. + +```java +R getFlushState(GetFlushStateParam requestParam); +``` + +#### GetFlushStateParam + +Use the `GetFlushStateParam.Builder` to construct a `GetFlushStateParam` object. + +```java +import io.milvus.param.GetFlushStateParam; +GetFlushStateParam.Builder builder = GetFlushStateParam.newBuilder(); +``` + +Methods of `GetFlushStateParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withSegmentIDs(List<Long> segmentIDs)

Set an ID list of segments to be tested. Typically the ID is returned by flush() method.

segmentIDs: An ID list of segments.

addSegmentID(Long segmentID)

Add a segment ID to be tested. Typically the ID is returned by flush() method.

segmentID: A segment ID.

withFlushTs(Long flushTs)

Input a time stamp of a flush action, get its flush state(optional).

flushTs: A time stamp returned by the flush() response.

build()

Construct a GetFlushStateParam object.

N/A

+ +The `GetFlushStateParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetFlushStateResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetFlushStateResponse; + +GetFlushStateParam param = GetFlushStateParam.newBuilder() + .addSegmentID(COLLECTION_NAME) + .build(); +R response = client.getFlushState(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println("Flushed: " + response.getData().getFlushed()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getMetrics.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getMetrics.md new file mode 100644 index 000000000..20ec644f9 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/getMetrics.md @@ -0,0 +1,67 @@ +# getMetrics() + +MilvusClient interface. This method returns the runtime metrics information of Milvus in JSON format. + +```java +R getMetrics(GetMetricsParam requestParam); +``` + +#### GetMetricsParam + +Use the `GetMetricsParam.Builder` to construct a `GetMetricsParam` object. + +```java +import io.milvus.param.GetMetricsParam; +GetMetricsParam.Builder builder = GetMetricsParam.newBuilder(); +``` + +Methods of `GetMetricsParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters


withRequest(String request)

Set request in JSON format to retrieve metric information from server.

request: Request string in JSON format

build()

Construct a GetMetricsParam object.

N/A

+ +The `GetMetricsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetMetricsResponse` held by the `R` template. + +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetMetricsResponse; + +GetMetricsParam param = GetMetricsParam.newBuilder() + .withRequest("{\"metric_type\":\"system_info\"}") + .build(); +R response = client.getMetrics(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println(response.getData().getResponse()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/loadBalance.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/loadBalance.md new file mode 100644 index 000000000..00637c43d --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/loadBalance.md @@ -0,0 +1,99 @@ +# loadBalance() + +MilvusClient interface. This method moves segments from one query node to another to keep the load balanced. + +
+ +

notes

+ +

Milvus server has its internal machinery to keep the load balanced, sometimes the segments might be moved back.

+ +
+ +```java +R loadBalance(LoadBalanceParam requestParam); +``` + +#### LoadBalanceParam + +Use the `LoadBalanceParam.Builder` to construct a `LoadBalanceParam` object. + +```java +import io.milvus.param.LoadBalanceParam; +LoadBalanceParam.Builder builder = LoadBalanceParam.newBuilder(); +``` + +Methods of `LoadBalanceParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withSourceNodeID(Long srcNodeID)

Set the ID of source query node in which the sealed segments were loaded.

srcNodeID: The source query node ID.

addDestinationNodeID(Long destNodeID)

Add the ID of destination query node to which the sealed segments will be balanced.

destNodeID: The destination query node ID.

withDestinationNodeID(List<Long> destNodeIDs)

Set an ID array of the destination query nodes to which the sealed segments will be balance.

destNodeIDs: The destination query node ID array.

addSegmentID(Long segmentID)

Add a sealed segment ID which to be balanced.

segmentID: A sealed segment ID.

withSegmentIDs(List<Long> segmentIDs)

Set an ID array of sealed segments which to be balanced.

segmentIDs: The sealed segments ID array.

build()

Construct a LoadBalanceParam object.

N/A

+ +The `LoadBalanceParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +LoadBalanceParam param = LoadBalanceParam.newBuilder() + .withSegmentIDs(segmentIDs) + .withDestinationNodeID(destNodeID) + .withSourceNodeID(srcNodeID) + .build(); +R response = client.loadBalance(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/manualCompact.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/manualCompact.md new file mode 100644 index 000000000..2aa52e4a2 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Management/manualCompact.md @@ -0,0 +1,76 @@ +# manualCompact() + +MilvusClient interface. This method triggers a compaction operation on the server side. + +
+ +

notes

+ +

Milvus server can automatically trigger compaction operation in certain conditions.

+ +
+ +```java +R manualCompact(ManualCompactParam requestParam); +``` + +#### ManualCompactParam + +Use the `ManualCompactParam.Builder` to construct a `ManualCompactParam` object. + +```java +import io.milvus.param.ManualCompactParam; +ManualCompactParam.Builder builder = ManualCompactParam.newBuilder(); +``` + +Methods of `ManualCompactParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

build()

Construct a ManualCompactParam object.

N/A

+ +The `ManualCompactParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `ManualCompactionResponse` held by the `R` template. The `ManualCompactionResponse` contains an ID of this compaction operation, which you can check the state by `getCompactionState()` or `getCompactionStateWithPlans()` method. + +#### Example + +```java +import io.milvus.param.*; + +ManualCompactParam param = ManualCompactParam.newBuilder() + .withSegmentIDs(segmentIDs) + .withDestinationNodeID(destNodeID) + .withSourceNodeID(srcNodeID) + .build(); +R response = client.manualCompact(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println("Compaction ID: " + response.getData().getCompactionID()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/ConsistencyLevelEnum.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/ConsistencyLevelEnum.md new file mode 100644 index 000000000..b756afb7e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/ConsistencyLevelEnum.md @@ -0,0 +1,31 @@ +# ConsistencyLevelEnum + +The enumeration for consistency level during a search/query. + +```java +package io.milvus.common.clientenum; +public enum ConsistencyLevelEnum +``` + + + + + + + + + + + + + + + + + + + + + + +

Type

Code

Description

STRONG

0

Waits until all operations are completed before a search/query.

BOUNDED

2

Waits until operations in a time span are completed before a search/query.

EVENTUALLY

3

Executes a search/query immediately.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/Constant.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/Constant.md new file mode 100644 index 000000000..cd9755844 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/Constant.md @@ -0,0 +1,48 @@ +# Constant + +Predefined constant values for quick input for interfaces. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Name

Value

Type

Description

TTL_SECONDS

collection.ttl.seconds

String

Property key for alterCollection() and createCollection() to set the ttl value.

MMAP_ENABLED

mmap.enabled

String

Property key for alterCollection() and alterIndex() to enable mmap.

DATABASEREPLICANUMBER

database.replica.number

String

Property key for createDatabase() and alterDatabase() to set default replica number.

DATABASERESOURCEGROUPS

database.resource_groups

String

Property key for createDatabase() and alterDatabase() to set default resource groups.

COLLECTIONREPLICANUMBER

collection.replica.number

String

Property key for createCollection() and alterCollection() to set default replica number.

COLLECTIONRESOURCEGROUPS

collection.resource_groups

String

Property key for createCollection() and alterCollection() to set default resource groups.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/DataType.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/DataType.md new file mode 100644 index 000000000..c392de309 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/DataType.md @@ -0,0 +1,101 @@ +# DataType + +The enum for available data types, defined by RPC proto. + +```java +package io.milvus.grpc; +public enum DataType +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Type

Code

Description

None

0

For internal usage.

Bool

1

Int8

2

Int16

3

Int32

4

Int64

5

Float

10

Double

11

String

20

Reserved. Do not use this.

VarChar

21

Variable-length string with a limit on the maximum length.

Array

22

Array data type. The element type can be one of the data types: Int8, Int16, Int32, Int64, Varchar, Bool, Float, or Double.

JSON

23

BinaryVector

100

Binary vector. Each dimension is represented by 1 bit.

FloatVector

101

Float vector. Each dimension is represented by 1 float(4 bits) value.

Float16Vector

102

Float16 vector. Each dimension is a 16-bit half-precision floating-point number.

BFloat16Vector

103

BFloat16 vector. Each dimension is a 16-bit floating-point number with reduced precision but the same exponent range as Float32.

SparseFloatVector

104

Sparse vectors represent words or phrases using vector embeddings where most elements are zeros. A sparse vector is a list of key-value pairs, the key type is an unsigned integer and the value type is Float32.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/IndexType.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/IndexType.md new file mode 100644 index 000000000..e1f693cfc --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/IndexType.md @@ -0,0 +1,116 @@ +# IndexType + +The enumeration for available index types. + +```java +package io.milvus.param; +public enum IndexType +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Type

Code

Description

None

0

For internal usage.

FLAT

1

Works for FloatVector/Float16Vector/BFloat16Vector type field.

IVF_FLAT

2

Works for FloatVector/Float16Vector/BFloat16Vector type field.

IVF_SQ8

3

Works for FloatVector/Float16Vector/BFloat16Vector type field.

IVF_PQ

4

Works for FloatVector/Float16Vector/BFloat16Vector type field.

HNSW

5

Works for FloatVector/Float16Vector/BFloat16Vector type field.

DISKANN

10

Works for FloatVector/Float16Vector/BFloat16Vector type field.

AUTOINDEX

11

Works for FloatVector/Float16Vector/BFloat16Vector type field. The auto index parameters are defined in the milvus.yaml.

SCANN

12

Works for FloatVector/Float16Vector/BFloat16Vector type field.

GPUIVFFLAT

50

Only for FloatVector type field. Only works when the server is GPU mode.

GPUIVFPQ

51

Only for FloatVector type field. Only works when the server is GPU mode.

GPUBRUTEFORCE

52

Only for FloatVector type field. Only works when the server is GPU mode.

GPU_CAGRA

53

Only for FloatVector type field. Only works when the server is GPU mode.

BIN_FLAT

80

Only for BinaryVector type field.

BINIVFFLAT

81

Only for BinaryVector type field.

TRIE

100

Only for VarChar type field.

STL_SORT

200

Only for numeric type field.

INVERTED

201

Works for all scalar fields except JSON type field.

SPARSEINVERTEDINDEX

300

Only for SparseFloatVector type field.

SPARSE_WAND

301

Only for SparseFloatVector type field.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/LogLevel.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/LogLevel.md new file mode 100644 index 000000000..c1fa399d1 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/LogLevel.md @@ -0,0 +1,31 @@ +# LogLevel + +The enumeration for setting log level in runtime. + +```java +package io.milvus.param; +public enum LogLevel +``` + + + + + + + + + + + + + + + + + + + + + + +

Type

Description

Debug

Debug level, All the logs are visible.

Info

Debug level, information, warning, error logs are visible.

Warning

Debug level, warning and error logs are visible.

Error

Error level, only error logs are visible.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/MetricType.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/MetricType.md new file mode 100644 index 000000000..e22c64afd --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/MetricType.md @@ -0,0 +1,39 @@ +# MetricType + +The enumeration for available metric types. + +```java +package io.milvus.param; +public enum MetricType +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Type

Description

NONE

For internal usage.

L2

Euclidean distance. Only for float vectors.

IP

Inner product. Only for normalized float vectors.

COSINE

Cosine similarity. Only for float vectors

HAMMING

Only for binary vectors.

JACCARD

Only for binary vectors.

diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/RT.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/RT.md new file mode 100644 index 000000000..62de6fd4b --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Misc/RT.md @@ -0,0 +1,220 @@ +# R<T> + +A template class to hold the status code, error message, and the response returned by each client interface. + +```java +package io.milvus.param; +public class R +``` + +#### R.Status + +R.Status is an enumeration of the status codes. Each R<T> object holds an integer value that can be mapped to the R.Status. + +Note: Not all status codes are used, some of them are reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Status

Code

Description

IllegalResponse

-6

The response returned by the server is incorrect. Parsing the response on the client side fails.

ParamError

-5

The parameter is illegal on the client side.

VersionMismatch

-4

*This error is reserved and not used for now.

Unknown

-3

General error for an unknown reason.

ClientNotConnected

-2

The connection is not ready.

RpcError

-1

*This error is reserved and not used for now.

Success

0

Operation succeeded.

UnexpectedError

1

Error caused by unexpected reason.

ConnectFailed

2

*This error is reserved and not used for now.

PermissionDenied

3

*This error is reserved and not used for now.

CollectionNotExists

4

*This error is reserved and not used for now.

IllegalArgument

5

The parameter is illegal on the server side.

IllegalDimension

7

*This error is reserved and not used for now.

IllegalIndexType

8

*This error is reserved and not used for now.

IllegalCollectionName

9

*This error is reserved and not used for now.

IllegalTOPK

10

*This error is reserved and not used for now.

IllegalRowRecord

11

*This error is reserved and not used for now.

IllegalVectorID

12

*This error is reserved and not used for now.

IllegalSearchResult

13

*This error is reserved and not used for now.

FileNotFound

14

*This error is reserved and not used for now.

MetaFailed

15

Getting metadata fails on the server side.

CacheFailed

16

*This error is reserved and not used for now.

CannotCreateFolder

17

*This error is reserved and not used for now.

CannotCreateFile

18

*This error is reserved and not used for now.

CannotDeleteFolder

19

*This error is reserved and not used for now.

CannotDeleteFile

20

*This error is reserved and not used for now.

BuildIndexError

21

*This error is reserved and not used for now.

IllegalNLIST

22

*This error is reserved and not used for now.

IllegalMetricType

23

*This error is reserved and not used for now.

OutOfMemory

24

*This error is reserved and not used for now.

IndexNotExist

25

*This error is reserved and not used for now.

EmptyCollection

26

*This error is reserved and not used for now.

+ +#### Methods + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Return

getMessage()

Gets the error message.

String

getStatus()

Gets the status code.

Integer

getData()

Gets the response object returned by the server.

RPC response class

+ +#### Example + +```java +import io.milvus.param.*; + +R response = client.dropCollection(DropCollectionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/createPartition.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/createPartition.md new file mode 100644 index 000000000..95b9fba6e --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/createPartition.md @@ -0,0 +1,75 @@ +# createPartition() + +MilvusClient interface. This method creates a partition in the specified collection. + +```java +R createPartition(CreatePartitionParam requestParam); +``` + +#### CreatePartitionParam + +Use the `CreatePartitionParam.Builder` to construct a `CreatePartitionParam` object. + +```java +import io.milvus.param.CreatePartitionParam; +CreatePartitionParam.Builder builder = CreatePartitionParam.newBuilder(); +``` + +Methods of `CreatePartitionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Set the partition name. Partition name cannot be empty or null.

partitionName: The partition name.

build()

Construct a CreatePartitionParam object.

N/A

+ +The `CreatePartitionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +CreatePartitionParam param = CreatePartitionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPartitionName(PARTITION_NAME) + .build(); +R response = client.createPartition(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/dropPartition.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/dropPartition.md new file mode 100644 index 000000000..79dea61ae --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/dropPartition.md @@ -0,0 +1,75 @@ +# dropPartition() + +MilvusClient interface. This method drops a partition. Note that this method drops all data in this partition and the default partition cannot be dropped. + +```java +R dropPartition(DropPartitionParam requestParam); +``` + +#### DropPartitionParam + +Use the `DropPartitionParam.Builder` to construct a `DropPartitionParam` object. + +```java +import io.milvus.param.DropPartitionParam; +DropPartitionParam.Builder builder = DropPartitionParam.newBuilder(); +``` + +Methods of `DropPartitionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Set the partition name. Partition name cannot be empty or null.

partitionName: The target partition name.

build()

Construct a DropPartitionParam object.

N/A

+ +The `DropPartitionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +DropPartitionParam param = DropPartitionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPartitionName(PARTITION_NAME) + .build(); +R response = client.dropPartition(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/getPartitionStatistics.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/getPartitionStatistics.md new file mode 100644 index 000000000..29f3a2a22 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/getPartitionStatistics.md @@ -0,0 +1,109 @@ +# getPartitionStatistics() + +MilvusClient interface. This method shows the statistical information of a partition. + +```java +R getPartitionStatistics(GetPartitionStatisticsParam requestParam); +``` + +#### GetPartitionStatisticsParam + +Use the `GetPartitionStatisticsParam.Builder` to construct a `GetPartitionStatisticsParam` object. + +```java +import io.milvus.param.GetPartitionStatisticsParam; +GetPartitionStatisticsParam.Builder builder = GetPartitionStatisticsParam.newBuilder(); +``` + +Methods of `GetPartitionStatisticsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Sets the partition name. Partition name cannot be empty or null.

partitionName: The target partition name.

withFlush(Boolean flush)

Requires a flush action before retrieving partition statistics. Default value is True.

flush: Set to True to ask a flush action.

build()

Construct a GetPartitionStatisticsParam object.

N/A

+ +The `GetPartitionStatisticsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetPartitionStatisticsResponse` held by the `R` template. You can use `GetPartStatResponseWrapper` to get statistics easily. + +#### GetPartStatResponseWrapper + +A tool class to encapsulate the `GetPartitionStatisticsResponse`. + +```java +import io.milvus.response.GetPartStatResponseWrapper; +GetPartStatResponseWrapper wrapper = new GetPartStatResponseWrapper(partStatResponse); +``` + +Methods of `GetPartStatResponseWrapper`: + + + + + + + + + + + + +

Method

Description

Returns

getRowCount()

Get the row count of a partition.Throw NumberFormatException if the row count string is illegal.

long

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.GetPartitionStatisticsResponse; +import io.milvus.response.GetPartStatResponseWrapper; + +GetPartitionStatisticsParam param = GetPartitionStatisticsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPartitionName(PARTITION_NAME) + .build(); +R response = client.getPartitionStatistics(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +GetPartStatResponseWrapper wrapper = new GetPartStatResponseWrapper(response.getData()); +System.out.println("Partition row count: " + wrapper.getRowCount()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/hasPartition.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/hasPartition.md new file mode 100644 index 000000000..389045ab9 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/hasPartition.md @@ -0,0 +1,77 @@ +# hasPartition() + +MilvusClient interface. This method checks if a partition exists in the specified collection. + +```java +R hasPartition(HasPartitionParam requestParam); +``` + +#### HasPartitionParam + +Use the `HasPartitionParam.Builder` to construct a `HasPartitionParam` object. + +```java +import io.milvus.param.HasPartitionParam; +HasPartitionParam.Builder builder = HasPartitionParam.newBuilder(); +``` + +Methods of `HasPartitionParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionName(String partitionName)

Set the partition name. Partition name cannot be empty or null.

partitionName: The target partition name.

build()

Construct a HasPartitionParam object.

N/A

+ +The `HasPartitionParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +HasPartitionParam param = HasPartitionParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withPartitionName(PARTITION_NAME) + .build(); +R response = client.hasPartition(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +System.out.println("Partition existence: " + response.getData()); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/loadPartitions.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/loadPartitions.md new file mode 100644 index 000000000..895692177 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/loadPartitions.md @@ -0,0 +1,105 @@ +# loadPartitions() + +MilvusClient interface. This method loads partitions' data into query nodes' memory before the search or query. + +```java +R loadPartitions(LoadPartitionsParam requestParam); +``` + +#### LoadPartitionsParam + +Use the `LoadPartitionsParam.Builder` to construct a `LoadPartitionsParam` object. + +```java +import io.milvus.param.LoadPartitionsParam; +LoadPartitionsParam.Builder builder = LoadPartitionsParam.newBuilder(); +``` + +Methods of `LoadPartitionsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionNames(List<String> partitionNames)

Set the partition names list. Partition names list cannot be null or empty.

partitionNames:
The name list of partitions to be loaded.

addPartitionName(String partitionName)

Add a partition by name. Partition name cannot be empty or null.

partitionName: A target partition name.

withSyncLoad(Boolean syncLoad)

Enable sync mode for load action. With sync mode enabled, the client keeps waiting until all segments of the partition are successfully loaded.If sync mode is disabled, client returns instantly after the loadPartitions() is called.
By default sync mode is enabled.

syncLoad: set to True is sync mode

withSyncLoadWaitingInterval(Long milliseconds)

Set the waiting interval for sync mode. In sync mode, the client constantly checks partition load state by interval.
Interval must be greater than zero, and cannot be greater than Constant.MAX_WAITING_LOADING_INTERVAL.
Default value is 500 milliseconds

milliseconds: interval value(units: millisecond)

withSyncLoadWaitingTimeout(Long seconds)

Set the timeout value for sync mode.
Timeout value must be greater than zero, and cannot be greater than Constant.MAX_WAITING_LOADING_TIMEOUT.
Default value is 60 seconds.

seconds: timeout value(units: second)

withReplicaNumber(Integer replicaNumber)

Specify replica number to load.
Default value is 1.

replicaNumber: replica number

withRefresh(Boolean refresh)

Whether to renew the segment list of this partition before loading. This flag must be set to FALSE when first time call the loadPartitions(). After loading a partition, call loadPartitions() again with refresh=TRUE, the server will look for new segments that are not loaded yet and tries to load them up.
This method is mainly for bulkinsert() interface.

refresh: The flag whether to renew segment list.

build()

Construct a LoadPartitionsParam object.

N/A

+ +The `LoadPartitionsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +LoadPartitionsParam param = LoadPartitionsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .addPartitionName(PARTITION_NAME) + .build(); +R response = client.loadPartitions(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/releasePartitions.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/releasePartitions.md new file mode 100644 index 000000000..db45b2779 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/releasePartitions.md @@ -0,0 +1,80 @@ +# releasePartitions() + +MilvusClient interface. This method releases partitions' data from memory. + +```java +R releasePartitions(ReleasePartitionsParam requestParam); +``` + +#### ReleasePartitionsParam + +Use the `ReleasePartitionsParam.Builder` to construct a `ReleasePartitionsParam` object. + +```java +import io.milvus.param.ReleasePartitionsParam; +ReleasePartitionsParam.Builder builder = ReleasePartitionsParam.newBuilder(); +``` + +Methods of `ReleasePartitionsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionNames(List<String> partitionNames)

Set the partition names list. Partition names list cannot be null or empty.

partitionNames: The name list of partitions to be released.

addPartitionName(String partitionName)

Add a partition by name. Partition name cannot be empty or null.

partitionName: A target partition name.

build()

Construct a ReleasePartitionsParam object.

N/A

+ +The `ReleasePartitionsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.*; + +ReleasePartitionsParam param = ReleasePartitionsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .addPartitionName(PARTITION_NAME) + .build(); +R response = client.releasePartitions(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/showPartitions.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/showPartitions.md new file mode 100644 index 000000000..37875d92f --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/Partition/showPartitions.md @@ -0,0 +1,147 @@ +# showPartitions() + +MilvusClient interface. This method shows all partitions in the specified collection. + +```java +R showPartitions(ShowPartitionsParam requestParam); +``` + +#### ShowPartitionsParam + +Use the `ShowPartitionsParam.Builder` to construct a `ShowPartitionsParam` object. + +```java +import io.milvus.param.ShowPartitionsParam; +ShowPartitionsParam.Builder builder = ShowPartitionsParam.newBuilder(); +``` + +Methods of `ShowPartitionsParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(String collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withPartitionNames(List<String> partitionNames)

Set the partition names list. Partition names list cannot be null or empty.

partitionNames: The name list of partitions to show.

addPartitionName(String partitionName)

Add a partition by name. Partition name cannot be empty or null.

partitionName: A target partition name.

build()

Construct a ShowPartitionsParam object.

N/A

+ +The `ShowPartitionsParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `ShowPartitionsResponse` held by the `R` template. You can use ShowPartResponseWrapper to get information easily. + +#### ShowPartResponseWrapper + +A tool class to encapsulate the `ShowPartitionsResponse`. + +```java +import io.milvus.response.ShowPartResponseWrapper; +ShowPartResponseWrapper wrapper = new ShowPartResponseWrapper(showPartitionsResponse); +``` + +Methods of `ShowPartitionsResponse`: + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getPartitionsInfo()

Return a list of PartitionInfo.

N/A

List<PartitionInfo>

getPartitionInfoByName(String partitionName)

Return a PartitionInfo object by a partition name.

partitionName: The target partition name.

PartitionInfo

+ +#### PartitionInfo + +A tool class to hold information of a partition. + +Methods of `ShowPartitionsResponse.PartitionInfo` + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

getIndexType()

Get index type.

IndexType

getMetricType()

Get metric type.

MetricType

getExtraParam()

Get index parameters in JSON format.

String

+ +#### Example + +```java +import io.milvus.param.*; +import io.milvus.grpc.ShowPartitionsResponse; +import io.milvus.response.ShowPartResponseWrapper; + +ShowPartitionsParam param = ShowPartitionsParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .addPartitionName(PARTITION_NAME) + .build(); +R response = client.showPartitions(param); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +ShowPartResponseWrapper wrapper = new ShowPartResponseWrapper(response.getData()); +ShowPartResponseWrapper.PartitionInfo info = wrapper.getPartitionInfoByName("_default"); +System.out.println("Partition name: " + info.getName() + ", ID: " + info.getId() + ", in-memory: " + info.getInMemoryPercentage() + "%"); +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/hybridSearch.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/hybridSearch.md new file mode 100644 index 000000000..aac5bf4b1 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/hybridSearch.md @@ -0,0 +1,278 @@ +# hybridSearch() + +The MilvusClient interface. This method conducts an approximate nearest neighbor (ANN) search on multiple vector fields and returns search results after reranking. + +```java +R hybridSearch(HybridSearchParam requestParam); +``` + +#### HybridSearchParam + +Use the `HybridSearchParam.Builder` to construct a `HybridSearchParam` object. + +```java +import io.milvus.param.dml.HybridSearchParam; +HybridSearchParam.Builder builder = HybridSearchParam.newBuilder(); +``` + +Methods of `HybridSearchParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the search consistency level(Optional).
If the level is not set, will use the default consistency level of the collection.

consistencyLevel: The consistency level used in the search.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify search scope (Optional).

partitionNames: The name list of partitions to be searched.

addPartitionName(String partitionName)

Adds a partition to specify search scope (Optional).

partitionName: A partition name to be searched.

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).


outFields: The name list of fields to be outputed.

addOutField(String fieldName)

Specifies an output scalar field (Optional).

fieldName: An output field name.

withTopK(Integer topK)

Set topK value of ANN search.
Avaiable range: [1, 16384]

topK: The topk value.

withRoundDecimal(Integer decimal)

Specifies the decimal place for returned distance.
Avaiable range: [-1, 6]
Default value is -1, return all digits.

decimal: How many digits reserved after the decimal point.

addSearchRequest(AnnSearchParam searchParam)

Adds a vector search request for a vector field. You can add

searchParam: An AnnSearchParam object.

withRanker(BaseRanker ranker)

Set a ranker for rearranging number of limit results.
Avaiable:
- RRFRanker
- WeightedRanker

ranker: The concrete ranker object.

build()

Construct a SearchParam object.

N/A

+ +The `HybridSearchParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### AnnSearchParam + +The sub-request of `hybridSearch()`. + +Use the `AnnSearchParam.Builder` to construct an `AnnSearchParam` object. + +```java +import io.milvus.param.dml.AnnSearchParam; +AnnSearchParam.Builder builder = AnnSearchParam.newBuilder(); +``` + +Methods of `AnnSearchParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withExpr(String expr)

Set the expression to filter scalar fields before searching(Optional).For more information please refer to this doc.

expr: The expression to filter scalar fields.

withMetricType(MetricType metricType)

Set metric type of ANN search.
Default value is MetricType.None, which means let the server determine the defaul metric type. Please refer to MetricType in Misc.

metricType: The metric type to search.

withVectorFieldName(String vectorFieldName)

Set target vector field by name. Field name cannot be empty or null.

vectorFieldName: The target vector field name to do ANN search.

withTopK(Integer topK)

Set topK value of ANN search.
Avaiable range: [1, 16384]

topK: The topk value.

withParams(String params)

Specifies the parameters of search in JSON format. The followings are valid keys of param:
1. special parameters for index, such as "nprobe", "ef", "searchk"
2. metric type with key "metric
type" and a string value such as "L2", "IP".
3. offset for pagination with key "offset" and an integer value

params: A JSON format string for extra parameters.

withFloatVectors(List<List<Float>gt; vectors)

Set the target vectors to search FloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBinaryVectors(List<ByteBuffer> vectors)

Set the target vectors to search BinaryVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withFloat16Vectors(List<ByteBuffer> vectors)

Set the target vectors to search Float16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBFloat16Vectors(List<List<Float>gt; vectors)

Set the target vectors to search BFloat16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withSparseFloatVectors(List<SortedMap<Long, Float>gt; vectors)

Set the target vectors to search SparseFloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

build()

Construct a SearchParam object.

N/A

+ +#### RRFRanker + +The RRF reranking strategy, which merges results from multiple searches, favoring items that consistently appear. + +Use the `RRFRanker.Builder` to construct an `RRFRanker` object. + +```java +import io.milvus.param.dml.ranker.RRFRanker; +RRFRanker.Builder builder = RRFRanker.newBuilder(); +``` + +Methods of `RRFRanker.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withK(Integer k)

Sets k factor for RRF. Value cannot be negative. Default value is 60.
score = 1 / (k + float32(ranki+1))
rank
i is the rank in each field

k: The k factor value.

build()

Construct a RRFRanker object.

N/A

+ +#### WeightedRanker + +The average weighted scoring reranking strategy, which prioritizes vectors based on relevance, averaging their significance. + +Use the `WeightedRankerWeightedRanker.Builder` to construct a `WeightedRanker` object. + +```java +import io.milvus.param.dml.ranker.WeightedRanker; +WeightedRanker.Builder builder = WeightedRanker.newBuilder(); +``` + +Methods of `WeightedRanker.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withWeights(List<Float> weights)

Assign weights for each AnnSearchParam. The length of weights must be equal to number of AnnSearchParam.
You can assign any float value for weight, the sum of weight values can exceed 1.
The distance/similarity values of each field will be mapped into a range of [0,1],
and score = sum(weights[i] * distanceiin_[0,1]).

weights: The weight values.

build()

Construct a WeightedRanker object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns valid `SearchResults` held by the `R` template. You can use `SearchResultsWrapper` to get the results. + +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.param.dml.ranker.*; +import io.milvus.grpc.SearchResults; + +AnnSearchParam req1 = AnnSearchParam.newBuilder() + .withVectorFieldName(FLOAT_VECTOR_FIELD) + .withFloatVectors(floatVectors) + .withMetricType(MetricType.IP) + .withParams("{\"nprobe\": 32}") + .withTopK(10) + .build(); + +AnnSearchParam req2 = AnnSearchParam.newBuilder() + .withVectorFieldName(BINARY_VECTOR_FIELD) + .withBinaryVectors(binaryVectors) + .withMetricType(MetricType.HAMMING) + .withTopK(15) + .build(); + +HybridSearchParam searchParam = HybridSearchParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .addOutField(FLOAT_VECTOR_FIELD) + .addSearchRequest(req1) + .addSearchRequest(req2) + .withTopK(5) + .withConsistencyLevel(ConsistencyLevelEnum.STRONG) + .withRanker(RRFRanker.newBuilder() + .withK(2) + .build()) + .build(); + +R response = milvusClient.hybridSearch(searchParam); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/query.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/query.md new file mode 100644 index 000000000..fc3cf2362 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/query.md @@ -0,0 +1,232 @@ +# query() + +The MilvusClient interface. This method queries entity(s) based on scalar field(s) filtered by boolean expression. Note that the order of the returned entities cannot be guaranteed. + +```java +R query(QueryParam requestParam); +``` + +#### QueryParam + +Use the `QueryParam.Builder` to construct a `QueryParam` object. + +```java +import io.milvus.param.dml.QueryParam; +QueryParam.Builder builder = QueryParam.newBuilder(); +``` + +Methods of `QueryParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the search consistency level(Optional).
If the level is not set, will use the default consistency level of the collection.

consistencyLevel: The consistency level used in the query.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify query scope (Optional).

partitionNames: The name list of partitions to be queried.

addPartitionName(String partitionName)

Adds a partition to specify query scope (Optional).

partitionName: A partition name to be queried.

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).
If output fields are specified, the QueryResults returned by query() will contains the values of these fields.


outFields: The name list of fields to be outputed.

addOutField(String fieldName)

Specifies an output scalar field (Optional).

fieldName: An output field name.

withExpr(String expr)

Set the expression to query entities. For more information please refer to this doc.

expr: The expression to query

withOffset(Long offset)

Specify a position, the returned entities before this position will be ignored. Only take effect when the 'limit' value is specified. Default value is 0, start from begin.

offset: A value to define the position.

withLimit(Long limit)

Specify a value to control the returned number of entities. Must be a positive value. Default value is -1, will return without limit.

limit: A value to define the limit of returned entities.

withIgnoreGrowing(Boolean ignoreGrowing)

Ignore the growing segments to get best query performance. For the user case that don't require data visibility. Default value is False.

ignoreGrowing: Ignore growing segments or not.

build()

Construct a QueryParam object.

N/A

+ +The `QueryParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns valid `QueryResults` held by the `R` template. You can use `QueryResultsWrapper` to get the query results. + +#### QueryResultsWrapper + +A tool class to encapsulate the `QueryResults`. + +```java +import io.milvus.response.QueryResultsWrapper; +QueryResultsWrapper wrapper = new QueryResultsWrapper(queryResults); +``` + +Methods of `QueryResultsWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getFieldWrapper(String fieldName)

Return a FieldDataWrapper object by a field name. Throws ParamException if the field doesn't exist.

fieldName: A field name which is specified by the withOutFields() of QueryParam.

FieldDataWrapper

getRowCount()

Gets the row count of a query result.

N/A

long

getRowRecords()

Gets row records list from the query result.

N/A

List<QueryResultsWrapper.RowRecord>

+ +#### FieldDataWrapper + +A tool class to encapsulate column data returned by `query()` API. + +Methods of `FieldDataWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

isVectorField()

Tell the user if this field is a vector field or a scalar field.

boolean

isJsonField()

Tell the user if this field is a JSON field.

boolean

isDynamicField()

Tell the user if this field is a the dynamic field.

boolean

getDim()

Gets the dimension value if the field is a vector field. Throw IllegalResponseException if the field is not a vector field.

int

getRowCount()

Gets the row count of a field. Throws IllegalResponseException if the field data is illegal.

long

getFieldData()

Returns the field data according to field type.

  • Return List<List<Float>gt; for FloatVector field.

  • Return List<ByteBuffer> for BinaryVector/Float16Vector/BFloatVector field.

  • Return List<SortedMap<Long, Float>gt; for SparseFloatVector field.

  • Return List<Long> for Int64 field.

  • Return List<Integer> for Int32/Int16/Int8 field.

  • Return List<Boolean> for Bool field.

  • Return List<Float> for Float field.

  • Return List<Double> for Double field.

  • Return List<String> for Varchar field.

  • Return List<ByteString> for JSON field.

+ +#### QueryResultsWrapper.RowRecord + +A tool class to hold the data of a single row in key-value format. + +Methods of `RowRecord`: + + + + + + + + + + + + + + + + + +

Method

Description

Returns

put(String keyName, Object obj)

For internal use. Set a key-value pair for the row.

boolean

get(String keyName)

Get a value by a key name. If the key name is a field name, return the value of this field.If the key name is in the dynamic field, return the value from the dynamic field.Throws ParamException if the key name doesn't exist.

Object

+ +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.response.QueryResultsWrapper; +import io.milvus.response.FieldDataWrapper; +import io.milvus.grpc.QueryResults; + +QueryParam param = QueryParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withExpr("id in [100, 101]") + .addOutFields("field1") + .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY) + .build(); +R response = client.query(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +QueryResultsWrapper wrapper = new QueryResultsWrapper(response.getData()); +List records = wrapper.getRowRecords(); +for (QueryResultsWrapper.RowRecord record:records) { + System.out.println(record); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryAsync.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryAsync.md new file mode 100644 index 000000000..3cde73a44 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryAsync.md @@ -0,0 +1,29 @@ +# queryAsync() + +The MilvusClient interface. This method queries entity(s) asynchronously based on scalar field(s) filtered by boolean expression. Note that the order of the returned entities cannot be guaranteed. + +```java +ListenableFuture> queryAsync(QueryParam requestParam); +``` + +This method uses the same parameter as `query()`, it invokes RPC interface and returns a ListenableFuture object immediately. + +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.grpc.QueryResults; +import com.google.common.util.concurrent.ListenableFuture; + +QueryParam param = QueryParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withExpr("id in [100, 101]") + .addOutFields("field1") + .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY) + .build(); +ListenableFuture> futureResults = client.queryAsync(param); +R response = futureResults.get(); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryIterator.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryIterator.md new file mode 100644 index 000000000..240ea622b --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/queryIterator.md @@ -0,0 +1,160 @@ +# queryIterator() + +MilvusClient interface. This method returns an iterator for you to iterate over the query results. It is useful especially when the query result contains a large volume of data. + +```java +R queryIterator(QueryIteratorParam requestParam); +``` + +#### QueryIteratorParam + +Use the `QueryIteratorParam.Builder` to construct a `QueryIteratorParam` object. + +```java +import io.milvus.param.dml.QueryIteratorParam; +QueryIteratorParam.Builder builder = QueryIteratorParam.newBuilder(); +``` + +Methods of `QueryIteratorParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the search consistency level(Optional).
If the level is not set, will use the default consistency level of the collection.

consistencyLevel: The consistency level used in the query.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify query scope (Optional).

partitionNames: The name list of partitions to be queried.

addPartitionName(String partitionName)

Adds a partition to specify query scope (Optional).

partitionName: A partition name to be queried.

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).
If output fields are specified, the QueryResults returned by query() will contains the values of these fields.


outFields: The name list of fields to be outputed.

addOutField(String fieldName)

Specifies an output scalar field (Optional).

fieldName: An output field name.

withExpr(String expr)

Set the expression to query entities. For more information please refer to this doc.

expr: The expression to query

withOffset(Long offset)

Specify a position, the returned entities before this position will be ignored. Only take effect when the 'limit' value is specified. Default value is 0, start from begin.

offset: A value to define the position.

withLimit(Long limit)

Specify a value to control the returned number of entities. Must be a positive value. Default value is -1, will return without limit.

limit: A value to define the limit of returned entities.

withIgnoreGrowing(Boolean ignoreGrowing)

Ignore the growing segments to get best query performance. For the user case that don't require data visibility. Default value is False.

ignoreGrowing: Ignore growing segments or not.

withBatchSize(Long batchSize)

Specify a value to control the number of entities returned per batch. Must be a positive value.
Default value is 1000, will return without batchSize.

batchSize: A value to define the number of entities returned per batch

build()

Construct a QueryIteratorParam object.

N/A

+ +The `QueryIteratorParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `QueryIterator` held by the `R` template. + +#### QueryIterator + +Methods of `QueryIterator`: + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

next()

Return a batch of results.

N/A

List<QueryResultsWrapper.RowRecord>

close()

Release the cache results.

N/A

N/A

+ +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.orm.iterator.*; +import io.milvus.response.QueryResultsWrapper; + +R response = milvusClient.queryIterator(QueryIteratorParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withExpr(expr) + .withBatchSize(100L) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +QueryIterator queryIterator = response.getData(); +while (true) { + List batchResults = queryIterator.next(); + if (res.isEmpty()) { + System.out.println("query iteration finished, close"); + queryIterator.close(); + break; + } + for (QueryResultsWrapper.RowRecord res : batchResults) { + System.out.println(res); + } +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/search.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/search.md new file mode 100644 index 000000000..5805f14b7 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/search.md @@ -0,0 +1,254 @@ +# search() + +The MilvusClient interface. This method conducts an approximate nearest neighbor (ANN) search on a vector field and pairs up with a Boolean expression to conduct filtering on scalar fields before searching. + +```java +R search(SearchParam requestParam); +``` + +#### SearchParam + +Use the `SearchParam.Builder` to construct a `SearchParam` object. + +```java +import io.milvus.param.dml.SearchParam; +SearchParam.Builder builder = SearchParam.newBuilder(); +``` + +Methods of `SearchParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Consistency level used in the search. If the level is not set, will use the default consistency level of the collection.

consistencyLevel: The consistency level used in the search.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify search scope (Optional).

partitionNames: The name list of partitions to be searched.

addPartitionName(String partitionName)

Adds a partition to specify search scope (Optional).

partitionName: A partition name to be searched.

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).


outFields: The name list of fields to be outputed.

addOutField(String fieldName)

Specifies an output scalar field (Optional).

fieldName: An output field name.

withExpr(String expr)

Set the expression to filter scalar fields before searching(Optional).For more information please refer to this doc.

expr: The expression to filter scalar fields.

withMetricType(MetricType metricType)

Set metric type of ANN search.
Default value is MetricType.None, which means let the server determine the defaul metric type. Please refer to MetricType in Misc.

metricType: The metric type to search.

withVectorFieldName(String vectorFieldName)

Set target vector field by name. Field name cannot be empty or null.

vectorFieldName: The target vector field name to do ANN search.

withTopK(Integer topK)

Set topK value of ANN search.
Avaiable range: [1, 16384]

topK: The topk value.

withVectors(List<?> vectors)

Set the target vectors. Up to 16384 vectors allowed.
Note: this method works for FloatVector/BinaryVector/SparseFloatVector, but it doesn't work for Float16Vector/BFloat16Vector.
It is recommended to use withFloatVectors/withBinaryVectors/withFloat16Vectors/withBFloat16Vectors/withSparseFloatVectors to input vectors expilicitly.

vectors:
- If target field type is FloatVector, List< List<Float>gt; is required.
- If target field type is BinaryVector, List<ByteBuffer> is required.
- If target field type is SparseFloatVector, List<SortedMap[Long, Float]> is required.

withFloatVectors(List<List<Float>gt; vectors)

Set the target vectors to search FloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBinaryVectors(List<ByteBuffer> vectors)

Set the target vectors to search BinaryVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withFloat16Vectors(List<ByteBuffer> vectors)

Set the target vectors to search Float16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBFloat16Vectors(List<List<Float>gt; vectors)

Set the target vectors to search BFloat16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withSparseFloatVectors(List<SortedMap<Long, Float>gt; vectors)

Set the target vectors to search SparseFloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withRoundDecimal(Integer decimal)

Specifies the decimal place for returned distance.
Avaiable range: [-1, 6]
Default value is -1, return all digits.

decimal: How many digits reserved after the decimal point.

withParams(String params)

Specifies the parameters of search in JSON format. The followings are valid keys of param:
1. special parameters for index, such as "nprobe", "ef", "searchk"
2. metric type with key "metric
type" and a string value such as "L2", "IP".
3. offset for pagination with key "offset" and an integer value

params: A JSON format string for extra parameters.

withIgnoreGrowing(Boolean ignoreGrowing)

Ignore the growing segments to get best search performance. For the user case that don't require data visibility.
Default is False.

ignoreGrowing: Ignore growing segments or not.

withGroupByFieldName(String groupByFieldName)

Sets field name to do grouping.

groupByFieldName: The name of a field to do grouping.

build()

Construct a SearchParam object.

N/A

+ +The `SearchParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and the error message of the exception. + +- If the API succeeds, it returns valid `SearchResults` held by the `R` template. You can use `SearchResultsWrapper` to get the results. + +#### SearchResultsWrapper + +A tool class to encapsulate the `SearchResults`. + +```java +import io.milvus.response.SearchResultsWrapper; +SearchResultsWrapper wrapper = new SearchResultsWrapper(searchResults); +``` + +Methods of `SearchResultsWrapper`: + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

getFieldData(String fieldName, int indexOfTarget)

Gets data for an output field which is specified by SearchParam.

Throws ParamException if the field doesn't exist or indexOfTarget is illegal.

fieldName: A field name which is specified by the withOutFields() of SearchParam.

indexOfTarget: The order number of a target vector.

  • Return List<List<Float>gt; for FloatVector field.

  • Return List<ByteBuffer> for BinaryVector/Float16Vector/BFloat16Vector field.

  • Return List<SortedMap[Long, Float]> for SparseFloatVector field.

  • Return List<Long> for Int64 field.

  • Return List<Integer> for Int32/Int16/Int8 field.

  • Return List<Boolean> for Bool field.

  • Return List<Float> for Float field.

  • Return List<Double> for Double field.

  • Return List<String> for Varchar field.

getIDScore(int indexOfTarget)

Gets ID-score pairs returned by search().

Throws ParamException if the indexOfTarget is illegal.Throws IllegalResponseException if the returned results are illegal.

indexOfTarget: The order number of a target vector.

List<IDScore>

getRowRecords(int indexOfTarget)

Gets row records from the search result.

The ID is put into a QueryResultsWrapper.RowRecord with key "id".

The distance is put into a QueryResultsWrapper.RowRecord with key "distance".

indexOfTarget: The order number of a target vector.

List<QueryResultsWrapper.RowRecord>

+ +#### IDScore + +A tool class to hold a pair of ID and distance, along with values of the output fields. + +Methods of `SearchResultsWrapper.IDScore`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Returns

getLongID()

Get integer ID if the primary key type is Int64.

long

getStrID()

Get string ID if the primary key type is VarChar.

String

getScore()

Get distance value.

float

get(String keyName)

Get a value by a key name. If the key name is a field name, return the value of this field.If the key name is in the dynamic field, return the value from the dynamic field.Throws ParamException if the key name doesn't exist.

Object

+ +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.response.SearchResultsWrapper; +import io.milvus.grpc.SearchResults; + +SearchParam param = SearchParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withMetricType(MetricType.IP) + .withTopK(10) + .withFloatVectors(targetVectors) + .withVectorFieldName("field1") + .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY) + .withParams("{\"nprobe\":10,\"offset\":2, \"limit\":3}") + .build(); +R response = client.search(param) +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +SearchResultsWrapper wrapper = new SearchResultsWrapper(response.getData().getResults()); +System.out.println("Search results:"); +for (int i = 0; i < targetVectors.size(); ++i) { + List scores = results.getIDScore(i); + for (SearchResultsWrapper.IDScore score:scores) { + System.out.println(score); + } +} +``` + diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchAsync.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchAsync.md new file mode 100644 index 000000000..a22a17aed --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchAsync.md @@ -0,0 +1,31 @@ +# searchAsync() + +The MilvusClient interface. This method conducts an approximate nearest neighbor (ANN) search asynchronously. + +```java +ListenableFuture> searchAsync(SearchParam requestParam); +``` + +This method uses the same parameter as `search()`, it invokes RPC interface and returns a ListenableFuture object immediately. + +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.grpc.SearchResults; +import com.google.common.util.concurrent.ListenableFuture; + +SearchParam param = SearchParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withMetricType(MetricType.HAMMING) + .withTopK(10) + .withBinaryVectors(targetVectors) + .withVectorFieldName("field1") + .withConsistencyLevel(ConsistencyLevelEnum.EVENTUALLY) + .build(); +ListenableFuture> futureResults = client.searchAsync(param); +R response = futureResults.get(); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchIterator.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchIterator.md new file mode 100644 index 000000000..a66648978 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/QuerySearch/searchIterator.md @@ -0,0 +1,208 @@ +# searchIterator() + +MilvusClient interface. This method returns a Python iterator for you to iterate over the search results. It is useful especially when the search result contains a large volume of data. + +```java +R searchIterator(SearchIteratorParam requestParam); +``` + +#### SearchIteratorParam + +Use the `SearchIteratorParam.Builder` to construct a `SearchIteratorParam` object. + +```java +import io.milvus.param.dml.SearchIteratorParam; +SearchIteratorParam.Builder builder = SearchIteratorParam.newBuilder(); +``` + +Methods of `SearchIteratorParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Methods

Description

Parameters

withCollectionName(collectionName)

Set the collection name. Collection name cannot be empty or null.

collectionName: The target collection name.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

withConsistencyLevel(ConsistencyLevelEnum consistencyLevel)

Sets the search consistency level(Optional).
If the level is not set, will use the default consistency level of the collection.

consistencyLevel: The consistency level used in the search.

withPartitionNames(List<String> partitionNames)

Sets partition names list to specify search scope (Optional).

partitionNames: The name list of partitions to be searched.

addPartitionName(String partitionName)

Adds a partition to specify search scope (Optional).

partitionName: A partition name to be searched.

withOutFields(List<String> outFields)

Specifies output scalar fields (Optional).


outFields: The name list of fields to be outputed.

addOutField(String fieldName)

Specifies an output scalar field (Optional).

fieldName: An output field name.

withExpr(String expr)

Set the expression to filter scalar fields before searching(Optional).For more information please refer to this doc.

expr: The expression to filter scalar fields.

withMetricType(MetricType metricType)

Set metric type of ANN search.
Default value is MetricType.None, which means let the server determine the defaul metric type. Please refer to MetricType in Misc.

metricType: The metric type to search.

withVectorFieldName(String vectorFieldName)

Set target vector field by name. Field name cannot be empty or null.

vectorFieldName: The target vector field name to do ANN search.

withTopK(Integer topK)

Set topK value of ANN search.
Avaiable range: [1, 16384]

topK: The topk value.

withVectors(List<?> vectors)

Set the target vectors. Up to 16384 vectors allowed.
Note: this method works for FloatVector/BinaryVector/SparseFloatVector, but it doesn't work for Float16Vector/BFloat16Vector.
It is recommended to use withFloatVectors/withBinaryVectors/withFloat16Vectors/withBFloat16Vectors/withSparseFloatVectors to input vectors expilicitly.

vectors:
- If target field type is FloatVector, List< List<Float>gt; is required.
- If target field type is BinaryVector, List<ByteBuffer> is required.
- If target field type is SparseFloatVector, List<SortedMap[Long, Float]> is required.

withFloatVectors(List<List<Float>gt; vectors)

Set the target vectors to search FloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBinaryVectors(List<ByteBuffer> vectors)

Set the target vectors to search BinaryVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withFloat16Vectors(List<ByteBuffer> vectors)

Set the target vectors to search Float16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withBFloat16Vectors(List<List<Float>gt; vectors)

Set the target vectors to search BFloat16Vector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withSparseFloatVectors(List<SortedMap<Long, Float>gt; vectors)

Set the target vectors to search SparseFloatVector field. Up to 16384 vectors allowed.
Note: this method will reset the target vectors of SearchParam. To input vectors, call it only once.

vectors: The target vectors

withRoundDecimal(Integer decimal)

Specifies the decimal place for returned distance.
Avaiable range: [-1, 6]
Default value is -1, return all digits.

decimal: How many digits are reserved after the decimal point.

withParams(String params)

Specifies the parameters of search in JSON format. The followings are valid keys of param:
1. special parameters for index, such as "nprobe", "ef", "searchk"
2. metric type with key "metric
type" and a string value such as "L2", "IP".
3. offset for pagination with key "offset" and an integer value

params: A JSON format string for extra parameters.

withIgnoreGrowing(Boolean ignoreGrowing)

Ignore the growing segments to get best search performance. For the user case that don't require data visibility.
Default is False.

ignoreGrowing: Ignore growing segments or not.

withGroupByFieldName(String groupByFieldName)

Sets field name to do grouping.

groupByFieldName: The name of a field to do grouping.

build()

Construct a SearchIteratorParam object.

N/A

+ +The `SearchIteratorParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `SearchIterator` held by the `R` template. + +#### SearchIterator + +Methods of `SearchIterator`: + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

Returns

next()

Return a batch of results.

N/A

List<QueryResultsWrapper.RowRecord>

close()

Release the cache results.

N/A

N/A

+ +#### Example + +```java +import io.milvus.param.dml.*; +import io.milvus.orm.iterator.*; +import io.milvus.response.QueryResultsWrapper; + +R response = milvusClient.searchIterator(SearchIteratorParam.newBuilder() + .withCollectionName(COLLECTION_NAME) + .withBatchSize(50L) + .withVectorFieldName(VECTOR_FIELD) + .withFloatVectors(vectors) + .withParams(params) + .withMetricType(MetricType.L2) + .build()); +if (response.getStatus() != R.Status.Success.getCode()) { + System.out.println(response.getMessage()); +} + +SearchIterator searchIterator = response.getData(); +while (true) { + List batchResults = searchIterator.next(); + if (res.isEmpty()) { + System.out.println("search iteration finished, close"); + queryIterator.close(); + break; + } + for (QueryResultsWrapper.RowRecord res : batchResults) { + System.out.println(res); + } +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/addUserToRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/addUserToRole.md new file mode 100644 index 000000000..cde381416 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/addUserToRole.md @@ -0,0 +1,70 @@ +# addUserToRole() + +MilvusClient interface. This method adds a user to a role. The user will get permissions that the role is allowed to perform operations. + +```java +R addUserToRole(AddUserToRoleParam requestParam); +``` + +#### AddUserToRoleParam + +Use the `AddUserToRoleParam.Builder` to construct an `AddUserToRoleParam` object. + +```java +import io.milvus.param.AddUserToRoleParam; +AddUserToRoleParam.Builder builder = AddUserToRoleParam.newBuilder(); +``` + +Methods of `AddUserToRoleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name.

build()

Construct a AddUserToRoleParam object.

N/A

+ +The `AddUserToRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.AddUserToRoleParam; + +R response = client.addUserToRole(AddUserToRoleParam.newBuilder() + .withRoleName(roleName) + .withUserName(userName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/createRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/createRole.md new file mode 100644 index 000000000..f6bc9d924 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/createRole.md @@ -0,0 +1,64 @@ +# createRole() + +MilvusClient interface. This method creates an object that some privileges can bind to. + +```java +R createRole(CreateRoleParam requestParam); +``` + +#### CreateRoleParam + +Use the `CreateRoleParam.Builder` to construct a `CreateRoleParam` object. + +```java +import io.milvus.param.CreateRoleParam; +CreateRoleParam.Builder builder = CreateRoleParam.newBuilder(); +``` + +Methods of `CreateRoleParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

build()

Construct a CreateRoleParam object.

N/A

+ +The `CreateRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.CreateRoleParam; + +R response = client.createRole(CreateRoleParam.newBuilder() + .withRoleName(roleName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/dropRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/dropRole.md new file mode 100644 index 000000000..215396839 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/dropRole.md @@ -0,0 +1,64 @@ +# dropRole() + +MilvusClient interface. This method drops a role. It will succeed if the role exists, otherwise fail. + +```java +R dropRole(DropRoleParam requestParam); +``` + +#### DropRoleParam + +Use the `DropRoleParam.Builder` to construct a `DropRoleParam` object. + +```java +import io.milvus.param.DropRoleParam; +DropRoleParam.Builder builder = DropRoleParam.newBuilder(); +``` + +Methods of `DropRoleParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

build()

Construct a DropRoleParam object.

N/A

+ +The `CreateRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.DropRoleParam; + +R response = client.dropRole(DropRoleParam.newBuilder() + .withRoleName(roleName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/grantRolePrivilege.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/grantRolePrivilege.md new file mode 100644 index 000000000..94a6d1c68 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/grantRolePrivilege.md @@ -0,0 +1,92 @@ +# grantRolePrivilege() + +MilvusClient interface. This method grants the role privilege*.* + +```java +R grantRolePrivilege(GrantRolePrivilegeParam requestParam); +``` + +#### GrantRolePrivilegeParam + +Use the `GrantRolePrivilegeParam.Builder` to construct a `GrantRolePrivilegeParam` object. + +```java +import io.milvus.param.GrantRolePrivilegeParam; +GrantRolePrivilegeParam.Builder builder = GrantRolePrivilegeParam.newBuilder(); +``` + +Methods of `GrantRolePrivilegeParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withDatabaseName(String databaseName)

Set the database name.

databaseName: The database name.

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name.

withObject(String object)

Sets the object. object cannot be empty or null.

object: A granted object in Milvus, such as collection, partition, and database.

withObjectName(String objectName)

Sets the objectName. objectName cannot be empty or null.

objectName: The object name.

withPrivilege(String privilege)

Sets the privilege. privilege cannot be empty or null.

privilege: A concrete permission for accessing some object.

withDatabaseName(String databaseName)

Sets the name of the target database.

databaseName: Name of an existing database.

build()

Construct a GrantRolePrivilegeParam object.

N/A

+ +The `GrantRolePrivilegeParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.GrantRolePrivilegeParam; + +R response = client.grantRolePrivilege(GrantRolePrivilegeParam.newBuilder() + .withRoleName(roleName) + .withObject(objectType) + .withObjectName(objectName) + .withPrivilege(privilege) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/removeUserFromRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/removeUserFromRole.md new file mode 100644 index 000000000..dc83f4f79 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/removeUserFromRole.md @@ -0,0 +1,70 @@ +# removeUserFromRole() + +MilvusClient interface. This method removes a user from a role. The user will remove permissions that the role is allowed to perform operations. + +```java +R removeUserFromRole(RemoveUserFromRoleParam requestParam); +``` + +#### RemoveUserFromRoleParam + +Use the `RemoveUserFromRoleParam.Builder` to construct a `RemoveUserFromRoleParam` object. + +```java +import io.milvus.param.RemoveUserFromRoleParam; +RemoveUserFromRoleParam.Builder builder = RemoveUserFromRoleParam.newBuilder(); +``` + +Methods of `AddUserToRoleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name.

build()

Construct a RemoveUserFromRoleParam object.

N/A

+ +The `RemoveUserFromRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.AddUserToRoleParam; + +R response = client.removeUserFromRole(AddUserToRoleParam.newBuilder() + .withRoleName(roleName) + .withUserName(userName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/revokeRolePrivilege.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/revokeRolePrivilege.md new file mode 100644 index 000000000..f367da7be --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/revokeRolePrivilege.md @@ -0,0 +1,82 @@ +# revokeRolePrivilege() + +MilvusClient interface. This method revokes the role privilege. + +```java +R revokeRolePrivilege(RevokeRolePrivilegeParam requestParam); +``` + +#### RevokeRolePrivilegeParam + +Use the `RevokeRolePrivilegeParam.Builder` to construct a `RevokeRolePrivilegeParam` object. + +```java +import io.milvus.param.RevokeRolePrivilegeParam; +RevokeRolePrivilegeParam.Builder builder = RevokeRolePrivilegeParam.newBuilder(); +``` + +Methods of `RevokeRolePrivilegeParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name.

withObject(String object)

Sets the object. object cannot be empty or null.

object: A granted object in Milvus, such as collection, partition, and database.

withObjectName(String objectName)

Sets the objectName. objectName cannot be empty or null.

objectName: The object name.

withPrivilege(String privilege)

Sets the privilege. privilege cannot be empty or null.

privilege: A concrete permission for accessing some object.

build()

Construct a RevokeRolePrivilegeParam object.

N/A

+ +The `RevokeRolePrivilegeParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.RevokeRolePrivilegeParam; + +R response = client.revokeRolePrivilege(RevokeRolePrivilegeParam.newBuilder() + .withRoleName(roleName) + .withObject(objectType) + .withObjectName(objectName) + .withPrivilege(privilege) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRole.md new file mode 100644 index 000000000..5c2011927 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRole.md @@ -0,0 +1,69 @@ +# selectGrantForRole() + +MilvusClient interface. This method lists grant info for the role and the specific object. + +```java +R selectGrantForRole(SelectGrantForRoleParam requestParam); +``` + +#### SelectGrantForRoleParam + +Use the `SelectGrantForRoleParam.Builder` to construct a `SelectGrantForRoleParam` object. + +```java +import io.milvus.param.SelectGrantForRoleParam; +SelectGrantForRoleParam.Builder builder = SelectGrantForRoleParam.newBuilder(); +``` + +Methods of `SelectGrantForRoleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

withDatabaseName(String databaseName)

Sets the database name. database name can be null for default database.

databaseName: The database name.

build()

Construct a SelectGrantForRoleParam object.

N/A

+ +The `SelectGrantForRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `SelectGrantResponse` held by the `R` template. You can use `SelectGrantResponse` to get the grant information. + +#### Example + +```java +import io.milvus.param.SelectGrantForRoleParam; + +R response = client.selectGrantForRole(SelectGrantForRoleParam.newBuilder() + .withRoleName(roleName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRoleAndObject.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRoleAndObject.md new file mode 100644 index 000000000..6f9c56b34 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectGrantForRoleAndObject.md @@ -0,0 +1,76 @@ +# selectGrantForRoleAndObject() + +MilvusClient interface. This method lists grant info for a role. + +```java +R selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam requestParam); +``` + +#### SelectGrantForRoleAndObjectParam + +Use the `SelectGrantForRoleAndObjectParam.Builder` to construct a `SelectGrantForRoleAndObjectParam` object. + +```java +import io.milvus.param.SelectGrantForRoleAndObjectParam; +SelectGrantForRoleAndObjectParam.Builder builder = SelectGrantForRoleAndObjectParam.newBuilder(); +``` + +Methods of `SelectGrantForRoleAndObjectParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name.

withObject(String object)

Sets the object. object cannot be empty or null.

object: A granted object in Milvus, such as collection, partition, and database.

withObjectName(String objectName)

Sets the objectName. objectName cannot be empty or null.

objectName: The object name.

build()

Construct a SelectGrantForRoleAndObjectParam object.

N/A

+ +The `SelectGrantForRoleAndObjectParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `SelectGrantResponse` held by the `R` template. You can use `SelectGrantResponse` to get the grant information. + +#### Example + +```java +import io.milvus.param.SelectGrantForRoleParam; + +R response = client.selectGrantForRoleAndObject(SelectGrantForRoleAndObjectParam.newBuilder() + .withRoleName(roleName) + .withObject(objectType) + .withObjectName(objectName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectRole.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectRole.md new file mode 100644 index 000000000..01835e637 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectRole.md @@ -0,0 +1,69 @@ +# selectRole() + +MilvusClient interface. This method gets all users' information about a role. + +```java +R selectRole(SelectRoleParam requestParam); +``` + +#### SelectRoleParam + +Use the `SelectRoleParam.Builder` to construct a `SelectRoleParam` object. + +```java +import io.milvus.param.SelectRoleParam; +SelectRoleParam.Builder builder = SelectRoleParam.newBuilder(); +``` + +Methods of `SelectRoleParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withRoleName(String roleName)

Sets the roleName. RoleName cannot be empty or null.

roleName: The role name used to create the privilege.

withIncludeUserInfo(boolean includeUserInfo)

Sets the includeUserInfo. includeUserInfo default false.

includeUserInfo: The include user info or not.

build()

Construct a SelectRoleParam object.

N/A

+ +The `SelectRoleParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `SelectRoleResponse` held by the `R` template. You can use `SelectRoleResponse` to get the role information. + +#### Example + +```java +import io.milvus.param.SelectRoleParam; + +R response = client.selectRole(SelectRoleParam.newBuilder() + .withRoleName(roleName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectUser.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectUser.md new file mode 100644 index 000000000..4073e739b --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/RBAC/selectUser.md @@ -0,0 +1,69 @@ +# selectUser() + +MilvusClient interface. This method gets all roles the user has. + +```java +R selectUser(SelectUserParam requestParam); +``` + +#### SelectUserParam + +Use the `SelectUserParam.Builder` to construct a `SelectUserParam` object. + +```java +import io.milvus.param.SelectUserParam; +SelectUserParam.Builder builder = SelectUserParam.newBuilder(); +``` + +Methods of `SelectUserParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withUsername(String username)

Sets the username. Username cannot be empty or null.

username: The user name.

withIncludeRoleInfo(boolean includeRoleInfo)

Sets the includeRoleInfo. Default value is false.

includeRoleInfo: The include role info or not.

build()

Construct a SelectUserParam object.

N/A

+ +The `SelectUserParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `SelectUserResponse` held by the `R` template. You can use `SelectUserResponse` to get the user information. + +#### Example + +```java +import io.milvus.param.SelectUserParam; + +R response = client.selectUser(SelectUserParam.newBuilder() + .withUsername(userName) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/createResourceGroup.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/createResourceGroup.md new file mode 100644 index 000000000..3ec0f2102 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/createResourceGroup.md @@ -0,0 +1,64 @@ +# createResourceGroup() + +MilvusClient interface. This method creates an empty resource group with a name. + +```java +R createResourceGroup(CreateResourceGroupParam requestParam); +``` + +#### CreateResourceGroupParam + +Use the `CreateResourceGroupParam.Builder` to construct a `CreateResourceGroupParam` object. + +```java +import io.milvus.param.CreateResourceGroupParam; +CreateResourceGroupParam.Builder builder = CreateResourceGroupParam.newBuilder(); +``` + +Methods of `CreateResourceGroupParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withGroupName(String groupName)

Sets the group name. groupName cannot be empty or null.

groupName: The name of the group to be created.

build()

Construct a CreateResourceGroupParam object.

N/A

+ +The `CreateResourceGroupParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.CreateResourceGroupParam; + +R response = client.createResourceGroup(CreateResourceGroupParam.newBuilder() + .withGroupName(name) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/describeResourceGroup.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/describeResourceGroup.md new file mode 100644 index 000000000..53b1518e3 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/describeResourceGroup.md @@ -0,0 +1,64 @@ +# describeResourceGroup() + +MilvusClient interface. This method drops a resource group by name. + +```java +R describeResourceGroup(DescribeResourceGroupParam requestParam); +``` + +#### DescribeResourceGroupParam + +Use the `DescribeResourceGroupParam.Builder` to construct a `DescribeResourceGroupParam` object. + +```java +import io.milvus.param.DescribeResourceGroupParam; +DescribeResourceGroupParam.Builder builder = DescribeResourceGroupParam.newBuilder(); +``` + +Methods of `DescribeResourceGroupParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withGroupName(String groupName)

Sets the group name. groupName cannot be empty or null.

groupName: The name of the group to describe.

build()

Construct a DescribeResourceGroupParam object.

N/A

+ +The `DescribeResourceGroupParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `DescribeResourceGroupResponse` held by the `R` template. You can use `DescribeResourceGroupResponse` to get resource group information. + +#### Example + +```java +import io.milvus.param.DescribeResourceGroupParam; + +R response = client.describeResourceGroup(DescribeResourceGroupParam.newBuilder() + .withGroupName(name) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/dropResourceGroup.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/dropResourceGroup.md new file mode 100644 index 000000000..41df3545f --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/dropResourceGroup.md @@ -0,0 +1,64 @@ +# dropResourceGroup() + +MilvusClient interface. This method drops a resource group by name. + +```java +R dropResourceGroup(DropResourceGroupParam requestParam); +``` + +#### DropResourceGroupParam + +Use the `DropResourceGroupParam.Builder` to construct a `DropResourceGroupParam` object. + +```java +import io.milvus.param.DropResourceGroupParam; +DropResourceGroupParam.Builder builder = DropResourceGroupParam.newBuilder(); +``` + +Methods of `DropResourceGroupParam.Builder`: + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withGroupName(String groupName)

Sets the group name. groupName cannot be empty or null.

groupName: The name of the group to be dropped.

build()

Construct a DropResourceGroupParam object.

N/A

+ +The `DropResourceGroupParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.DropResourceGroupParam; + +R response = client.dropResourceGroup(DropResourceGroupParam.newBuilder() + .withGroupName(name) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/listResourceGroups.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/listResourceGroups.md new file mode 100644 index 000000000..165cddbc3 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/listResourceGroups.md @@ -0,0 +1,54 @@ +# listResourceGroups() + +MilvusClient interface. This method lists all the resource groups. + +```java +R listResourceGroups(ListResourceGroupsParam requestParam); +``` + +#### ListResourceGroupsParam + +Use the `ListResourceGroupsParam.Builder` to construct a `ListResourceGroupsParam` object. + +```java +import io.milvus.param.ListResourceGroupsParam; +ListResourceGroupsParam.Builder builder = ListResourceGroupsParam.newBuilder(); +``` + +Methods of `ListResourceGroupsParam.Builder`: + + + + + + + + + + + + +

Method

Description

Parameters

build()

Construct a DescribeResourceGroupParam object.

N/A

+ +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `ListResourceGroupsResponse` held by the `R` template. You can use `ListResourceGroupsResponse` to get resource group information. + +#### Example + +```java +import io.milvus.param.ListResourceGroupsParam; + +R response = client.listResourceGroups(ListResourceGroupsParam.newBuilder() + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferNode.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferNode.md new file mode 100644 index 000000000..af4160c83 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferNode.md @@ -0,0 +1,76 @@ +# transferNode() + +MilvusClient interface. This method transfers a query node from the source resource group to another resource group. + +```java +R transferNode(TransferNodeParam requestParam); +``` + +#### TransferNodeParam + +Use the `TransferNodeParam.Builder` to construct a `TransferNodeParam` object. + +```java +import io.milvus.param. TransferNodeParam; +TransferNodeParam.Builder builder = TransferNodeParam.newBuilder(); +``` + +Methods of `TransferNodeParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withSourceGroupName(String groupName)

Sets the source group name. groupName cannot be empty or null.

groupName: The name of the source group.

withTargetGroupName(String groupName)

Sets the target group name. groupName cannot be empty or null.

groupName: The name of the target group.

withNodeNumber(Integer nodeNumber)

Specify how many query nodes to transfer to another resource group.

nodeNumber: The number of nodes to transfer.

build()

Construct a TransferNodeParam object.

N/A

+ +The `TransferNodeParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.TransferNodeParam; + +R response = client.transferNode(TransferNodeParam.newBuilder() + .withSourceGroupName(sourceName) + .withTargetGroupName(targetName) + .withNodeNumber(1) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferReplica.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferReplica.md new file mode 100644 index 000000000..25e016926 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/ResourceGroup/transferReplica.md @@ -0,0 +1,82 @@ +# transferReplica() + +MilvusClient interface. This method transfers a query node from the source resource group to another resource group. + +```java +R transferReplica(TransferReplicaParam requestParam); +``` + +#### TransferReplicaParam + +Use the `TransferReplicaParam.Builder` to construct a `TransferReplicaParam` object. + +```java +import io.milvus.param. TransferReplicaParam; +TransferReplicaParam.Builder builder = TransferReplicaParam.newBuilder(); +``` + +Methods of `TransferReplicaParam.Builder`: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Method

Description

Parameters

withSourceGroupName(String groupName)

Sets the source group name. groupName cannot be empty or null.

groupName: The name of the source group.

withTargetGroupName(String groupName)

Sets the target group name. groupName cannot be empty or null.

groupName: The name of the target group.

withCollectionName(String collectionName)

Sets the collection name. Collection name cannot be empty or null.

collectionName: The name of a collection.

withReplicaNumber(Long replicaNumber)

Specify number of replicas to transfer.

replicaNumber: The number of replicas to transfer.

build()

Construct a TransferReplicaParam object.

N/A

+ +The `TransferReplicaParam.Builder.build()` can throw the following exceptions: + +- ParamException: error if the parameter is invalid. + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns `R.Status.Success`. + +#### Example + +```java +import io.milvus.param.TransferReplicaParam; + +R response = client.transferReplica(TransferReplicaParam.newBuilder() + .withSourceGroupName(sourceName) + .withTargetGroupName(targetName) + .withCollectionName(COLLECTION_NAME) + .withNodeNumber(1) + .build()); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/System/checkHealth.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/System/checkHealth.md new file mode 100644 index 000000000..579fd008c --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/System/checkHealth.md @@ -0,0 +1,28 @@ +# checkHealth() + +MilvusClient interface. This method checks milvus server health. + +```java +R checkHealth(); +``` + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `CheckHealthResponse` held by the `R` template. You can use `CheckHealthResponse` to get resource group information. + +#### Example + +```java + +R response = client.checkHealth(); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` diff --git a/API_Reference/milvus-sdk-java/v2.4.x/v1/System/getVersion.md b/API_Reference/milvus-sdk-java/v2.4.x/v1/System/getVersion.md new file mode 100644 index 000000000..0d6ce4ea8 --- /dev/null +++ b/API_Reference/milvus-sdk-java/v2.4.x/v1/System/getVersion.md @@ -0,0 +1,37 @@ +# getVersion() + +MilvusClient interface. This method gets the milvus kernel version. + +
+ +

notes

+ +

This method works for open-source Milvus, but might not work for Zilliz Cloud.

+ +
+ +```java +R getVersion(); +``` + +#### Returns + +This method catches all the exceptions and returns an `R` object. + +- If the API fails on the server side, it returns the error code and message from the server. + +- If the API fails by RPC exception, it returns `R.Status.Unknown` and error message of the exception. + +- If the API succeeds, it returns a valid `GetVersionResponse` held by the `R` template. You can use `GetVersionResponse` to get resource group information. + +#### Example + +```java + +R response = client.getVersion(); + +if (response.getStatus() != R.Status.Success.getCode()) { + throw new RuntimeException(response.getMessage()); +} +``` +