浏览代码

Support dropIndexProperties/dropDatabaseProperties/dropCollectionProperties (#1242)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 4 月之前
父节点
当前提交
e3f91eb730

+ 68 - 14
src/main/java/io/milvus/v2/client/MilvusClientV2.java

@@ -290,7 +290,6 @@ public class MilvusClientV2 {
     public void createDatabase(CreateDatabaseReq request) {
     public void createDatabase(CreateDatabaseReq request) {
         retry(()-> databaseService.createDatabase(this.getRpcStub(), request));
         retry(()-> databaseService.createDatabase(this.getRpcStub(), request));
     }
     }
-
     /**
     /**
      * Drops a database. Note that this method drops all data in the database.
      * Drops a database. Note that this method drops all data in the database.
      * @param request drop database request
      * @param request drop database request
@@ -298,7 +297,6 @@ public class MilvusClientV2 {
     public void dropDatabase(DropDatabaseReq request) {
     public void dropDatabase(DropDatabaseReq request) {
         retry(()-> databaseService.dropDatabase(this.getRpcStub(), request));
         retry(()-> databaseService.dropDatabase(this.getRpcStub(), request));
     }
     }
-
     /**
     /**
      * List all databases.
      * List all databases.
      * @return List of String database names
      * @return List of String database names
@@ -306,15 +304,32 @@ public class MilvusClientV2 {
     public ListDatabasesResp listDatabases() {
     public ListDatabasesResp listDatabases() {
         return retry(()-> databaseService.listDatabases(this.getRpcStub()));
         return retry(()-> databaseService.listDatabases(this.getRpcStub()));
     }
     }
-
     /**
     /**
      * Alter database with key value pair. (Available from Milvus v2.4.4)
      * Alter database with key value pair. (Available from Milvus v2.4.4)
+     * Deprecated, replaced by alterDatabaseProperties, to keep consistence with other SDKs
      * @param request alter database request
      * @param request alter database request
      */
      */
+    @Deprecated
     public void alterDatabase(AlterDatabaseReq request) {
     public void alterDatabase(AlterDatabaseReq request) {
-        retry(()-> databaseService.alterDatabase(this.getRpcStub(), request));
+        alterDatabaseProperties(AlterDatabasePropertiesReq.builder()
+                .databaseName(request.getDatabaseName())
+                .properties(request.getProperties())
+                .build());
+    }
+    /**
+     * Alter a database's properties.
+     * @param request alter database properties request
+     */
+    public void alterDatabaseProperties(AlterDatabasePropertiesReq request) {
+        retry(()-> databaseService.alterDatabaseProperties(this.getRpcStub(), request));
+    }
+    /**
+     * drop a database's properties (Available from Milvus v2.5.2)
+     * @param request alter database properties request
+     */
+    public void dropDatabaseProperties(DropDatabasePropertiesReq request) {
+        retry(()-> databaseService.dropDatabaseProperties(this.getRpcStub(), request));
     }
     }
-
     /**
     /**
      * Show detail of database base, such as replica number and resource groups. (Available from Milvus v2.4.4)
      * Show detail of database base, such as replica number and resource groups. (Available from Milvus v2.4.4)
      * @param request describe database request
      * @param request describe database request
@@ -333,7 +348,6 @@ public class MilvusClientV2 {
     public void createCollection(CreateCollectionReq request) {
     public void createCollection(CreateCollectionReq request) {
         retry(()-> collectionService.createCollection(this.getRpcStub(), request));
         retry(()-> collectionService.createCollection(this.getRpcStub(), request));
     }
     }
-
     /**
     /**
      * Creates a collection schema.
      * Creates a collection schema.
      * @return CreateCollectionReq.CollectionSchema
      * @return CreateCollectionReq.CollectionSchema
@@ -341,7 +355,6 @@ public class MilvusClientV2 {
     public CreateCollectionReq.CollectionSchema createSchema() {
     public CreateCollectionReq.CollectionSchema createSchema() {
         return collectionService.createSchema();
         return collectionService.createSchema();
     }
     }
-
     /**
     /**
      * list milvus collections
      * list milvus collections
      *
      *
@@ -350,7 +363,6 @@ public class MilvusClientV2 {
     public ListCollectionsResp listCollections() {
     public ListCollectionsResp listCollections() {
         return retry(()-> collectionService.listCollections(this.getRpcStub()));
         return retry(()-> collectionService.listCollections(this.getRpcStub()));
     }
     }
-
     /**
     /**
      * Drops a collection in Milvus.
      * Drops a collection in Milvus.
      *
      *
@@ -361,11 +373,32 @@ public class MilvusClientV2 {
     }
     }
     /**
     /**
      * Alter a collection in Milvus.
      * Alter a collection in Milvus.
+     * Deprecated, replaced by alterCollectionProperties, to keep consistence with other SDKs
      *
      *
      * @param request alter collection request
      * @param request alter collection request
      */
      */
+    @Deprecated
     public void alterCollection(AlterCollectionReq request) {
     public void alterCollection(AlterCollectionReq request) {
-        retry(()-> collectionService.alterCollection(this.getRpcStub(), request));
+        alterCollectionProperties(AlterCollectionPropertiesReq.builder()
+                .collectionName(request.getCollectionName())
+                .databaseName(request.getDatabaseName())
+                .properties(request.getProperties())
+                .build());
+    }
+    /**
+     * Alter a collection's properties.
+     *
+     * @param request alter collection properties request
+     */
+    public void alterCollectionProperties(AlterCollectionPropertiesReq request) {
+        retry(()-> collectionService.alterCollectionProperties(this.getRpcStub(), request));
+    }
+    /**
+     * drop a collection's properties.
+     * @param request drop collection properties request
+     */
+    public void dropCollectionProperties(DropCollectionPropertiesReq request) {
+        retry(()-> collectionService.dropCollectionProperties(this.getRpcStub(), request));
     }
     }
     /**
     /**
      * Checks whether a collection exists in Milvus.
      * Checks whether a collection exists in Milvus.
@@ -447,11 +480,33 @@ public class MilvusClientV2 {
     }
     }
     /**
     /**
      * Alter an index in Milvus.
      * Alter an index in Milvus.
+     * Deprecated, replaced by alterIndexProperties, to keep consistence with other SDKs
      *
      *
      * @param request alter index request
      * @param request alter index request
      */
      */
+    @Deprecated
     public void alterIndex(AlterIndexReq request) {
     public void alterIndex(AlterIndexReq request) {
-        retry(()->indexService.alterIndex(this.getRpcStub(), request));
+        alterIndexProperties(AlterIndexPropertiesReq.builder()
+                .collectionName(request.getCollectionName())
+                .databaseName(request.getDatabaseName())
+                .indexName(request.getIndexName())
+                .properties(request.getProperties())
+                .build());
+    }
+    /**
+     * Alter an index's properties.
+     *
+     * @param request alter index request
+     */
+    public void alterIndexProperties(AlterIndexPropertiesReq request) {
+        retry(()->indexService.alterIndexProperties(this.getRpcStub(), request));
+    }
+    /**
+     * drop an index's properties.
+     * @param request drop index properties request
+     */
+    public void dropIndexProperties(DropIndexPropertiesReq request) {
+        retry(()-> indexService.dropIndexProperties(this.getRpcStub(), request));
     }
     }
     /**
     /**
      * Checks whether an index exists for a specified field in a collection in Milvus.
      * Checks whether an index exists for a specified field in a collection in Milvus.
@@ -462,7 +517,6 @@ public class MilvusClientV2 {
     public DescribeIndexResp describeIndex(DescribeIndexReq request) {
     public DescribeIndexResp describeIndex(DescribeIndexReq request) {
         return retry(()->indexService.describeIndex(this.getRpcStub(), request));
         return retry(()->indexService.describeIndex(this.getRpcStub(), request));
     }
     }
-
     /**
     /**
      * Lists all indexes in a collection in Milvus.
      * Lists all indexes in a collection in Milvus.
      *
      *
@@ -472,8 +526,8 @@ public class MilvusClientV2 {
     public List<String> listIndexes(ListIndexesReq request) {
     public List<String> listIndexes(ListIndexesReq request) {
         return retry(()->indexService.listIndexes(this.getRpcStub(), request));
         return retry(()->indexService.listIndexes(this.getRpcStub(), request));
     }
     }
-    // Vector Operations
 
 
+    // Vector Operations
     /**
     /**
      * Inserts vectors into a collection in Milvus.
      * Inserts vectors into a collection in Milvus.
      *
      *
@@ -615,8 +669,8 @@ public class MilvusClientV2 {
     public void releasePartitions(ReleasePartitionsReq request) {
     public void releasePartitions(ReleasePartitionsReq request) {
         retry(()->partitionService.releasePartitions(this.getRpcStub(), request));
         retry(()->partitionService.releasePartitions(this.getRpcStub(), request));
     }
     }
-    // rbac operations
-    // user operations
+
+    // RBAC operations
     /**
     /**
      * list users
      * list users
      *
      *

+ 18 - 6
src/main/java/io/milvus/v2/service/collection/CollectionService.java

@@ -177,9 +177,10 @@ public class CollectionService extends BaseService {
         return null;
         return null;
     }
     }
 
 
-    public Void alterCollection(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterCollectionReq request) {
-        String title = String.format("AlterCollectionRequest collectionName:%s", request.getCollectionName());
-        AlterCollectionRequest.Builder builder = AlterCollectionRequest.newBuilder();
+    public Void alterCollectionProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterCollectionPropertiesReq request) {
+        String title = String.format("AlterCollectionPropertiesReq collectionName:%s", request.getCollectionName());
+        AlterCollectionRequest.Builder builder = AlterCollectionRequest.newBuilder()
+                .setCollectionName(request.getCollectionName());
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
         if (CollectionUtils.isNotEmpty(propertiesList)) {
         if (CollectionUtils.isNotEmpty(propertiesList)) {
             propertiesList.forEach(builder::addProperties);
             propertiesList.forEach(builder::addProperties);
@@ -188,11 +189,22 @@ public class CollectionService extends BaseService {
             builder.setDbName(request.getDatabaseName());
             builder.setDbName(request.getDatabaseName());
         }
         }
 
 
-        AlterCollectionRequest alterCollectionRequest = builder
+        Status response = blockingStub.alterCollection(builder.build());
+        rpcUtils.handleResponse(title, response);
+
+        return null;
+    }
+
+    public Void dropCollectionProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DropCollectionPropertiesReq request) {
+        String title = String.format("DropCollectionPropertiesReq collectionName:%s", request.getCollectionName());
+        AlterCollectionRequest.Builder builder = AlterCollectionRequest.newBuilder()
                 .setCollectionName(request.getCollectionName())
                 .setCollectionName(request.getCollectionName())
-                .build();
+                .addAllDeleteKeys(request.getPropertyKeys());
+        if (StringUtils.isNotEmpty(request.getDatabaseName())) {
+            builder.setDbName(request.getDatabaseName());
+        }
 
 
-        Status response = blockingStub.alterCollection(alterCollectionRequest);
+        Status response = blockingStub.alterCollection(builder.build());
         rpcUtils.handleResponse(title, response);
         rpcUtils.handleResponse(title, response);
 
 
         return null;
         return null;

+ 48 - 0
src/main/java/io/milvus/v2/service/collection/request/AlterCollectionPropertiesReq.java

@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.collection.request;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Data
+@SuperBuilder
+public class AlterCollectionPropertiesReq {
+    private String collectionName;
+    private String databaseName;
+    @Builder.Default
+    private final Map<String, String> properties = new HashMap<>();
+
+
+    public static abstract class AlterCollectionPropertiesReqBuilder<C extends AlterCollectionPropertiesReq, B extends AlterCollectionPropertiesReq.AlterCollectionPropertiesReqBuilder<C, B>> {
+        public B property(String key, String value) {
+            if(null == this.properties$value ){
+                this.properties$value = new HashMap<>();
+            }
+            this.properties$value.put(key, value);
+            this.properties$set = true;
+            return self();
+        }
+    }
+}

+ 1 - 0
src/main/java/io/milvus/v2/service/collection/request/AlterCollectionReq.java

@@ -9,6 +9,7 @@ import java.util.Map;
 
 
 @Data
 @Data
 @SuperBuilder
 @SuperBuilder
+@Deprecated
 public class AlterCollectionReq {
 public class AlterCollectionReq {
     private String collectionName;
     private String collectionName;
     private String databaseName;
     private String databaseName;

+ 37 - 0
src/main/java/io/milvus/v2/service/collection/request/DropCollectionPropertiesReq.java

@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.collection.request;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@SuperBuilder
+public class DropCollectionPropertiesReq {
+    private String collectionName;
+    private String databaseName;
+
+    @Builder.Default
+    private List<String> propertyKeys = new ArrayList<>();
+}

+ 13 - 3
src/main/java/io/milvus/v2/service/database/DatabaseService.java

@@ -22,7 +22,6 @@ package io.milvus.v2.service.database;
 import io.milvus.grpc.*;
 import io.milvus.grpc.*;
 import io.milvus.param.ParamUtils;
 import io.milvus.param.ParamUtils;
 import io.milvus.v2.service.BaseService;
 import io.milvus.v2.service.BaseService;
-import io.milvus.v2.service.collection.response.ListCollectionsResp;
 import io.milvus.v2.service.database.request.*;
 import io.milvus.v2.service.database.request.*;
 import io.milvus.v2.service.database.response.*;
 import io.milvus.v2.service.database.response.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.collections4.CollectionUtils;
@@ -66,8 +65,8 @@ public class DatabaseService extends BaseService {
         return listDatabasesResp;
         return listDatabasesResp;
     }
     }
 
 
-    public Void alterDatabase(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterDatabaseReq request) {
-        String title = String.format("AlterDatabaseRequest databaseName:%s", request.getDatabaseName());
+    public Void alterDatabaseProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterDatabasePropertiesReq request) {
+        String title = String.format("AlterDatabasePropertiesReq databaseName:%s", request.getDatabaseName());
         AlterDatabaseRequest.Builder builder = AlterDatabaseRequest.newBuilder()
         AlterDatabaseRequest.Builder builder = AlterDatabaseRequest.newBuilder()
                 .setDbName(request.getDatabaseName());
                 .setDbName(request.getDatabaseName());
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
@@ -80,6 +79,17 @@ public class DatabaseService extends BaseService {
         return null;
         return null;
     }
     }
 
 
+    public Void dropDatabaseProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DropDatabasePropertiesReq request) {
+        String title = String.format("DropDatabasePropertiesReq databaseName:%s", request.getDatabaseName());
+        AlterDatabaseRequest.Builder builder = AlterDatabaseRequest.newBuilder()
+                .setDbName(request.getDatabaseName())
+                .addAllDeleteKeys(request.getPropertyKeys());
+
+        Status response = blockingStub.alterDatabase(builder.build());
+        rpcUtils.handleResponse(title, response);
+        return null;
+    }
+
     public DescribeDatabaseResp describeDatabase(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DescribeDatabaseReq request) {
     public DescribeDatabaseResp describeDatabase(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DescribeDatabaseReq request) {
         String title = String.format("DescribeDatabaseRequest databaseName:%s", request.getDatabaseName());
         String title = String.format("DescribeDatabaseRequest databaseName:%s", request.getDatabaseName());
         DescribeDatabaseRequest rpcRequest = DescribeDatabaseRequest.newBuilder()
         DescribeDatabaseRequest rpcRequest = DescribeDatabaseRequest.newBuilder()

+ 46 - 0
src/main/java/io/milvus/v2/service/database/request/AlterDatabasePropertiesReq.java

@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.database.request;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Data
+@SuperBuilder
+public class AlterDatabasePropertiesReq {
+    private String databaseName;
+    @Builder.Default
+    private Map<String, String> properties = new HashMap<>();
+
+    public static abstract class AlterDatabasePropertiesReqBuilder<C extends AlterDatabasePropertiesReq, B extends AlterDatabasePropertiesReq.AlterDatabasePropertiesReqBuilder<C, B>> {
+        public B property(String key, String value) {
+            if(null == this.properties$value ){
+                this.properties$value = new HashMap<>();
+            }
+            this.properties$value.put(key, value);
+            this.properties$set = true;
+            return self();
+        }
+    }
+}

+ 1 - 0
src/main/java/io/milvus/v2/service/database/request/AlterDatabaseReq.java

@@ -28,6 +28,7 @@ import java.util.Map;
 
 
 @Data
 @Data
 @SuperBuilder
 @SuperBuilder
+@Deprecated
 public class AlterDatabaseReq {
 public class AlterDatabaseReq {
     private String databaseName;
     private String databaseName;
     @Builder.Default
     @Builder.Default

+ 36 - 0
src/main/java/io/milvus/v2/service/database/request/DropDatabasePropertiesReq.java

@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.database.request;
+
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@SuperBuilder
+public class DropDatabasePropertiesReq {
+    private String databaseName;
+    @Builder.Default
+    private List<String> propertyKeys = new ArrayList<>();
+}

+ 23 - 7
src/main/java/io/milvus/v2/service/index/IndexService.java

@@ -92,11 +92,14 @@ public class IndexService extends BaseService {
 
 
         return null;
         return null;
     }
     }
-    
-    public Void alterIndex(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterIndexReq request) {
-        String title = String.format("AlterIndexRequest collectionName:%s, indexName:%s",
+
+    public Void alterIndexProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, AlterIndexPropertiesReq request) {
+        String title = String.format("AlterIndexPropertiesReq collectionName:%s, indexName:%s",
                 request.getCollectionName(), request.getIndexName());
                 request.getCollectionName(), request.getIndexName());
-        AlterIndexRequest.Builder builder = AlterIndexRequest.newBuilder();
+        AlterIndexRequest.Builder builder = AlterIndexRequest.newBuilder()
+                .setCollectionName(request.getCollectionName())
+                .setIndexName(request.getIndexName());
+
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
         List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(request.getProperties());
         if (CollectionUtils.isNotEmpty(propertiesList)) {
         if (CollectionUtils.isNotEmpty(propertiesList)) {
             propertiesList.forEach(builder::addExtraParams);
             propertiesList.forEach(builder::addExtraParams);
@@ -105,12 +108,25 @@ public class IndexService extends BaseService {
             builder.setDbName(request.getDatabaseName());
             builder.setDbName(request.getDatabaseName());
         }
         }
 
 
-        AlterIndexRequest alterIndexRequest = builder
+        Status response = blockingStub.alterIndex(builder.build());
+        rpcUtils.handleResponse(title, response);
+
+        return null;
+    }
+
+    public Void dropIndexProperties(MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub, DropIndexPropertiesReq request) {
+        String title = String.format("DropIndexPropertiesReq collectionName:%s, indexName:%s",
+                request.getCollectionName(), request.getIndexName());
+        AlterIndexRequest.Builder builder = AlterIndexRequest.newBuilder()
                 .setCollectionName(request.getCollectionName())
                 .setCollectionName(request.getCollectionName())
                 .setIndexName(request.getIndexName())
                 .setIndexName(request.getIndexName())
-                .build();
+                .addAllDeleteKeys(request.getPropertyKeys());
+
+        if (StringUtils.isNotEmpty(request.getDatabaseName())) {
+            builder.setDbName(request.getDatabaseName());
+        }
 
 
-        Status response = blockingStub.alterIndex(alterIndexRequest);
+        Status response = blockingStub.alterIndex(builder.build());
         rpcUtils.handleResponse(title, response);
         rpcUtils.handleResponse(title, response);
 
 
         return null;
         return null;

+ 49 - 0
src/main/java/io/milvus/v2/service/index/request/AlterIndexPropertiesReq.java

@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.index.request;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+@Data
+@SuperBuilder
+public class AlterIndexPropertiesReq {
+    private String collectionName;
+    private String databaseName;
+    private String indexName;
+    @Builder.Default
+    private Map<String, String> properties = new HashMap<>();
+
+
+    public static abstract class AlterIndexPropertiesReqBuilder<C extends AlterIndexPropertiesReq, B extends AlterIndexPropertiesReq.AlterIndexPropertiesReqBuilder<C, B>> {
+        public B property(String key, String value) {
+            if(null == this.properties$value ){
+                this.properties$value = new HashMap<>();
+            }
+            this.properties$value.put(key, value);
+            this.properties$set = true;
+            return self();
+        }
+    }
+}

+ 1 - 0
src/main/java/io/milvus/v2/service/index/request/AlterIndexReq.java

@@ -10,6 +10,7 @@ import java.util.Map;
 
 
 @Data
 @Data
 @SuperBuilder
 @SuperBuilder
+@Deprecated
 public class AlterIndexReq {
 public class AlterIndexReq {
     private String collectionName;
     private String collectionName;
     private String databaseName;
     private String databaseName;

+ 38 - 0
src/main/java/io/milvus/v2/service/index/request/DropIndexPropertiesReq.java

@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package io.milvus.v2.service.index.request;
+
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Data
+@SuperBuilder
+public class DropIndexPropertiesReq {
+    private String collectionName;
+    private String databaseName;
+    private String indexName;
+
+    @Builder.Default
+    private List<String> propertyKeys = new ArrayList<>();
+}

+ 42 - 5
src/test/java/io/milvus/v2/client/MilvusClientV2DockerTest.java

@@ -74,7 +74,7 @@ class MilvusClientV2DockerTest {
     private static final TestUtils utils = new TestUtils(DIMENSION);
     private static final TestUtils utils = new TestUtils(DIMENSION);
 
 
     @Container
     @Container
-    private static final MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.4.16");
+    private static final MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:2.4-20241218-306f200a-amd64");
 
 
     @BeforeAll
     @BeforeAll
     public static void setUp() {
     public static void setUp() {
@@ -1124,10 +1124,11 @@ class MilvusClientV2DockerTest {
                 .collectionName(randomCollectionName)
                 .collectionName(randomCollectionName)
                 .build());
                 .build());
 
 
+        // collection alter properties
         Map<String, String> properties = new HashMap<>();
         Map<String, String> properties = new HashMap<>();
         properties.put(Constant.TTL_SECONDS, "10");
         properties.put(Constant.TTL_SECONDS, "10");
         properties.put(Constant.MMAP_ENABLED, "true");
         properties.put(Constant.MMAP_ENABLED, "true");
-        client.alterCollection(AlterCollectionReq.builder()
+        client.alterCollectionProperties(AlterCollectionPropertiesReq.builder()
                 .collectionName(randomCollectionName)
                 .collectionName(randomCollectionName)
                 .properties(properties)
                 .properties(properties)
                 .property("prop", "val")
                 .property("prop", "val")
@@ -1143,6 +1144,17 @@ class MilvusClientV2DockerTest {
         Assertions.assertEquals("true", collProps.get(Constant.MMAP_ENABLED));
         Assertions.assertEquals("true", collProps.get(Constant.MMAP_ENABLED));
         Assertions.assertEquals("val", collProps.get("prop"));
         Assertions.assertEquals("val", collProps.get("prop"));
 
 
+        client.dropCollectionProperties(DropCollectionPropertiesReq.builder()
+                .collectionName(randomCollectionName)
+                .propertyKeys(Collections.singletonList("prop"))
+                .build());
+        descCollResp = client.describeCollection(DescribeCollectionReq.builder()
+                .collectionName(randomCollectionName)
+                .build());
+        collProps = descCollResp.getProperties();
+        Assertions.assertFalse(collProps.containsKey("prop"));
+
+        // index alter properties
         DescribeIndexResp descResp = client.describeIndex(DescribeIndexReq.builder()
         DescribeIndexResp descResp = client.describeIndex(DescribeIndexReq.builder()
                 .collectionName(randomCollectionName)
                 .collectionName(randomCollectionName)
                 .fieldName("vector")
                 .fieldName("vector")
@@ -1159,7 +1171,7 @@ class MilvusClientV2DockerTest {
 
 
         properties.clear();
         properties.clear();
         properties.put(Constant.MMAP_ENABLED, "false");
         properties.put(Constant.MMAP_ENABLED, "false");
-        client.alterIndex(AlterIndexReq.builder()
+        client.alterIndexProperties(AlterIndexPropertiesReq.builder()
                 .collectionName(randomCollectionName)
                 .collectionName(randomCollectionName)
                 .indexName(desc.getIndexName())
                 .indexName(desc.getIndexName())
                 .properties(properties)
                 .properties(properties)
@@ -1174,6 +1186,20 @@ class MilvusClientV2DockerTest {
         Assertions.assertTrue(indexProps.containsKey(Constant.MMAP_ENABLED));
         Assertions.assertTrue(indexProps.containsKey(Constant.MMAP_ENABLED));
         Assertions.assertEquals("false", indexProps.get(Constant.MMAP_ENABLED));
         Assertions.assertEquals("false", indexProps.get(Constant.MMAP_ENABLED));
 
 
+        client.dropIndexProperties(DropIndexPropertiesReq.builder()
+                .collectionName(randomCollectionName)
+                .indexName(desc.getIndexName())
+                .propertyKeys(Collections.singletonList(Constant.MMAP_ENABLED))
+                .build());
+        descResp = client.describeIndex(DescribeIndexReq.builder()
+                .collectionName(randomCollectionName)
+                .fieldName("vector")
+                .build());
+        desc = descResp.getIndexDescByFieldName("vector");
+        indexProps = desc.getProperties();
+        Assertions.assertFalse(indexProps.containsKey(Constant.MMAP_ENABLED));
+
+        // drop index
         client.dropIndex(DropIndexReq.builder()
         client.dropIndex(DropIndexReq.builder()
                 .collectionName(randomCollectionName)
                 .collectionName(randomCollectionName)
                 .fieldName("vector")
                 .fieldName("vector")
@@ -1498,10 +1524,10 @@ class MilvusClientV2DockerTest {
 
 
         // alter the database
         // alter the database
         properties.put(Constant.DATABASE_REPLICA_NUMBER, "10");
         properties.put(Constant.DATABASE_REPLICA_NUMBER, "10");
-        properties.put("prop", "val");
-        client.alterDatabase(AlterDatabaseReq.builder()
+        client.alterDatabaseProperties(AlterDatabasePropertiesReq.builder()
                 .databaseName(tempDatabaseName)
                 .databaseName(tempDatabaseName)
                 .properties(properties)
                 .properties(properties)
+                .property("prop", "val")
                 .build());
                 .build());
         descDBResp = client.describeDatabase(DescribeDatabaseReq.builder()
         descDBResp = client.describeDatabase(DescribeDatabaseReq.builder()
                 .databaseName(tempDatabaseName)
                 .databaseName(tempDatabaseName)
@@ -1512,6 +1538,17 @@ class MilvusClientV2DockerTest {
         Assertions.assertTrue(propertiesResp.containsKey("prop"));
         Assertions.assertTrue(propertiesResp.containsKey("prop"));
         Assertions.assertEquals("val", propertiesResp.get("prop"));
         Assertions.assertEquals("val", propertiesResp.get("prop"));
 
 
+        // drop property
+        client.dropDatabaseProperties(DropDatabasePropertiesReq.builder()
+                .databaseName(tempDatabaseName)
+                .propertyKeys(Collections.singletonList("prop"))
+                .build());
+        descDBResp = client.describeDatabase(DescribeDatabaseReq.builder()
+                .databaseName(tempDatabaseName)
+                .build());
+        propertiesResp = descDBResp.getProperties();
+        Assertions.assertFalse(propertiesResp.containsKey("prop"));
+
         // switch to the new database
         // switch to the new database
         Assertions.assertDoesNotThrow(()->client.useDatabase(tempDatabaseName));
         Assertions.assertDoesNotThrow(()->client.useDatabase(tempDatabaseName));