Browse Source

Support SparseVector/Float16Vector for V2 (#910)

Signed-off-by: yhmo <yihua.mo@zilliz.com>
groot 1 year ago
parent
commit
31912bc73b
100 changed files with 3059 additions and 59 deletions
  1. 0 2
      examples/main/java/io/milvus/Float16VectorExample.java
  2. 8 6
      src/main/java/io/milvus/param/ParamUtils.java
  3. 20 0
      src/main/java/io/milvus/param/dml/UpsertParam.java
  4. 19 0
      src/main/java/io/milvus/v2/client/ConnectConfig.java
  5. 28 0
      src/main/java/io/milvus/v2/client/MilvusClientV2.java
  6. 19 0
      src/main/java/io/milvus/v2/common/ConsistencyLevel.java
  7. 21 1
      src/main/java/io/milvus/v2/common/DataType.java
  8. 19 0
      src/main/java/io/milvus/v2/common/IndexParam.java
  9. 23 1
      src/main/java/io/milvus/v2/examples/Simple.java
  10. 23 1
      src/main/java/io/milvus/v2/examples/Simple_Schema.java
  11. 19 0
      src/main/java/io/milvus/v2/exception/ErrorCode.java
  12. 19 0
      src/main/java/io/milvus/v2/exception/MilvusClientException.java
  13. 19 0
      src/main/java/io/milvus/v2/service/BaseService.java
  14. 19 0
      src/main/java/io/milvus/v2/service/collection/CollectionService.java
  15. 19 0
      src/main/java/io/milvus/v2/service/collection/request/AddFieldReq.java
  16. 19 0
      src/main/java/io/milvus/v2/service/collection/request/CreateCollectionReq.java
  17. 19 0
      src/main/java/io/milvus/v2/service/collection/request/DescribeCollectionReq.java
  18. 19 0
      src/main/java/io/milvus/v2/service/collection/request/DropCollectionReq.java
  19. 19 0
      src/main/java/io/milvus/v2/service/collection/request/GetCollectionStatsReq.java
  20. 19 0
      src/main/java/io/milvus/v2/service/collection/request/GetLoadStateReq.java
  21. 19 0
      src/main/java/io/milvus/v2/service/collection/request/HasCollectionReq.java
  22. 19 0
      src/main/java/io/milvus/v2/service/collection/request/LoadCollectionReq.java
  23. 19 0
      src/main/java/io/milvus/v2/service/collection/request/ReleaseCollectionReq.java
  24. 19 0
      src/main/java/io/milvus/v2/service/collection/request/RenameCollectionReq.java
  25. 19 0
      src/main/java/io/milvus/v2/service/collection/response/DescribeCollectionResp.java
  26. 19 0
      src/main/java/io/milvus/v2/service/collection/response/GetCollectionStatsResp.java
  27. 19 0
      src/main/java/io/milvus/v2/service/collection/response/ListCollectionsResp.java
  28. 19 0
      src/main/java/io/milvus/v2/service/index/IndexService.java
  29. 19 0
      src/main/java/io/milvus/v2/service/index/request/CreateIndexReq.java
  30. 19 0
      src/main/java/io/milvus/v2/service/index/request/DescribeIndexReq.java
  31. 19 0
      src/main/java/io/milvus/v2/service/index/request/DropIndexReq.java
  32. 19 0
      src/main/java/io/milvus/v2/service/index/request/ListIndexesReq.java
  33. 19 0
      src/main/java/io/milvus/v2/service/index/response/DescribeIndexResp.java
  34. 19 0
      src/main/java/io/milvus/v2/service/partition/PartitionService.java
  35. 19 0
      src/main/java/io/milvus/v2/service/partition/request/CreatePartitionReq.java
  36. 19 0
      src/main/java/io/milvus/v2/service/partition/request/DropPartitionReq.java
  37. 19 0
      src/main/java/io/milvus/v2/service/partition/request/HasPartitionReq.java
  38. 19 0
      src/main/java/io/milvus/v2/service/partition/request/ListPartitionsReq.java
  39. 19 0
      src/main/java/io/milvus/v2/service/partition/request/LoadPartitionsReq.java
  40. 19 0
      src/main/java/io/milvus/v2/service/partition/request/ReleasePartitionsReq.java
  41. 19 0
      src/main/java/io/milvus/v2/service/rbac/RoleService.java
  42. 19 0
      src/main/java/io/milvus/v2/service/rbac/UserService.java
  43. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/CreateRoleReq.java
  44. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/CreateUserReq.java
  45. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/DescribeRoleReq.java
  46. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/DescribeUserReq.java
  47. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/DropRoleReq.java
  48. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/DropUserReq.java
  49. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/GrantPrivilegeReq.java
  50. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/GrantRoleReq.java
  51. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/RevokePrivilegeReq.java
  52. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/RevokeRoleReq.java
  53. 19 0
      src/main/java/io/milvus/v2/service/rbac/request/UpdatePasswordReq.java
  54. 19 0
      src/main/java/io/milvus/v2/service/rbac/response/DescribeRoleResp.java
  55. 19 0
      src/main/java/io/milvus/v2/service/rbac/response/DescribeUserResp.java
  56. 19 0
      src/main/java/io/milvus/v2/service/utility/UtilityService.java
  57. 19 0
      src/main/java/io/milvus/v2/service/utility/request/AlterAliasReq.java
  58. 19 0
      src/main/java/io/milvus/v2/service/utility/request/CreateAliasReq.java
  59. 19 0
      src/main/java/io/milvus/v2/service/utility/request/DescribeAliasReq.java
  60. 19 0
      src/main/java/io/milvus/v2/service/utility/request/DropAliasReq.java
  61. 19 0
      src/main/java/io/milvus/v2/service/utility/request/FlushReq.java
  62. 19 0
      src/main/java/io/milvus/v2/service/utility/request/ListAliasesReq.java
  63. 19 0
      src/main/java/io/milvus/v2/service/utility/response/DescribeAliasResp.java
  64. 19 0
      src/main/java/io/milvus/v2/service/utility/response/ListAliasResp.java
  65. 35 0
      src/main/java/io/milvus/v2/service/vector/VectorService.java
  66. 38 0
      src/main/java/io/milvus/v2/service/vector/request/AnnSearchReq.java
  67. 19 0
      src/main/java/io/milvus/v2/service/vector/request/DeleteReq.java
  68. 19 0
      src/main/java/io/milvus/v2/service/vector/request/GetReq.java
  69. 44 0
      src/main/java/io/milvus/v2/service/vector/request/HybridSearchReq.java
  70. 43 0
      src/main/java/io/milvus/v2/service/vector/request/InsertReq.java
  71. 19 0
      src/main/java/io/milvus/v2/service/vector/request/QueryReq.java
  72. 21 1
      src/main/java/io/milvus/v2/service/vector/request/SearchReq.java
  73. 42 0
      src/main/java/io/milvus/v2/service/vector/request/UpsertReq.java
  74. 42 0
      src/main/java/io/milvus/v2/service/vector/request/data/BFloat16Vec.java
  75. 27 0
      src/main/java/io/milvus/v2/service/vector/request/data/BaseVector.java
  76. 42 0
      src/main/java/io/milvus/v2/service/vector/request/data/BinaryVec.java
  77. 42 0
      src/main/java/io/milvus/v2/service/vector/request/data/Float16Vec.java
  78. 42 0
      src/main/java/io/milvus/v2/service/vector/request/data/FloatVec.java
  79. 42 0
      src/main/java/io/milvus/v2/service/vector/request/data/SparseFloatVec.java
  80. 26 0
      src/main/java/io/milvus/v2/service/vector/request/ranker/BaseRanker.java
  81. 47 0
      src/main/java/io/milvus/v2/service/vector/request/ranker/RRFRanker.java
  82. 50 0
      src/main/java/io/milvus/v2/service/vector/request/ranker/WeightedRanker.java
  83. 19 0
      src/main/java/io/milvus/v2/service/vector/response/DeleteResp.java
  84. 19 0
      src/main/java/io/milvus/v2/service/vector/response/GetResp.java
  85. 19 0
      src/main/java/io/milvus/v2/service/vector/response/InsertResp.java
  86. 19 0
      src/main/java/io/milvus/v2/service/vector/response/QueryResp.java
  87. 19 0
      src/main/java/io/milvus/v2/service/vector/response/SearchResp.java
  88. 19 0
      src/main/java/io/milvus/v2/service/vector/response/UpsertResp.java
  89. 19 0
      src/main/java/io/milvus/v2/utils/ClientUtils.java
  90. 19 0
      src/main/java/io/milvus/v2/utils/ConvertUtils.java
  91. 19 0
      src/main/java/io/milvus/v2/utils/DataUtils.java
  92. 19 0
      src/main/java/io/milvus/v2/utils/RpcUtils.java
  93. 19 0
      src/main/java/io/milvus/v2/utils/SchemaUtils.java
  94. 147 47
      src/main/java/io/milvus/v2/utils/VectorUtils.java
  95. 19 0
      src/test/java/io/milvus/v2/BaseTest.java
  96. 762 0
      src/test/java/io/milvus/v2/client/MilvusClientV2DockerTest.java
  97. 19 0
      src/test/java/io/milvus/v2/client/MilvusClientV2Test.java
  98. 19 0
      src/test/java/io/milvus/v2/service/collection/CollectionTest.java
  99. 19 0
      src/test/java/io/milvus/v2/service/index/IndexTest.java
  100. 19 0
      src/test/java/io/milvus/v2/service/partition/PartitionTest.java

+ 0 - 2
examples/main/java/io/milvus/Float16VectorExample.java

@@ -32,8 +32,6 @@ import io.milvus.response.*;
 import java.nio.ByteBuffer;
 import java.util.*;
 
-import org.tensorflow.ndarray.buffer.ByteDataBuffer;
-import org.tensorflow.types.*;
 
 public class Float16VectorExample {
     private static final String COLLECTION_NAME = "java_sdk_example_float16";

+ 8 - 6
src/main/java/io/milvus/param/ParamUtils.java

@@ -623,7 +623,7 @@ public class ParamUtils {
     }
 
     @SuppressWarnings("unchecked")
-    private static ByteString convertPlaceholder(List<?> vectors, PlaceholderType placeType) throws ParamException {
+    public static ByteString convertPlaceholder(List<?> vectors, PlaceholderType placeType) throws ParamException {
         PlaceholderType plType = PlaceholderType.None;
         List<ByteString> byteStrings = new ArrayList<>();
         for (Object vector : vectors) {
@@ -800,13 +800,15 @@ public class ParamUtils {
                             .build());
         }
 
+        // params
+        String params = "{}";
         if (null != annSearchParam.getParams() && !annSearchParam.getParams().isEmpty()) {
-            builder.addSearchParams(
-                    KeyValuePair.newBuilder()
-                            .setKey(Constant.PARAMS)
-                            .setValue(annSearchParam.getParams())
-                            .build());
+            params = annSearchParam.getParams();
         }
+        builder.addSearchParams(KeyValuePair.newBuilder()
+                .setKey(Constant.PARAMS)
+                .setValue(params)
+                .build());
 
         // always use expression since dsl is discarded
         builder.setDslType(DslType.BoolExprV1);

+ 20 - 0
src/main/java/io/milvus/param/dml/UpsertParam.java

@@ -97,6 +97,26 @@ public class UpsertParam extends InsertParam {
         /**
          * Sets the row data to insert. The rows list cannot be empty.
          *
+         * Internal class for insert data.
+         * 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.add("XX", 128), the value 128 is cut to -128.
+         *   An Int64 field named "XX", you set the value to be 3.9 by JsonObject.add("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.add("XX", "TRUE"), the string "TRUE" is parsed as true.
+         *   A Float field named "XX", you set the value to be "3.5" by JsonObject.add("XX", "3.5", the string "3.5" is parsed as 3.5.
+         *
+         *
          * @param rows insert row data
          * @return <code>Builder</code>
          * @see JsonObject

+ 19 - 0
src/main/java/io/milvus/v2/client/ConnectConfig.java

@@ -1,3 +1,22 @@
+/*
+ * 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.client;
 
 import lombok.Builder;

+ 28 - 0
src/main/java/io/milvus/v2/client/MilvusClientV2.java

@@ -1,3 +1,22 @@
+/*
+ * 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.client;
 
 import io.grpc.ManagedChannel;
@@ -291,6 +310,15 @@ public class MilvusClientV2 {
     public SearchResp search(SearchReq request) {
         return vectorService.search(this.blockingStub, request);
     }
+    /**
+     * Conducts multi vector similarity search with a ranker for rearrangement.
+     *
+     * @param request search request
+     * @return SearchResp
+     */
+    public SearchResp hybridSearch(HybridSearchReq request) {
+        return vectorService.hybridSearch(this.blockingStub, request);
+    }
 
     // Partition Operations
     /**

+ 19 - 0
src/main/java/io/milvus/v2/common/ConsistencyLevel.java

@@ -1,3 +1,22 @@
+/*
+ * 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.common;
 
 import lombok.Getter;

+ 21 - 1
src/main/java/io/milvus/v2/common/DataType.java

@@ -1,3 +1,22 @@
+/*
+ * 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.common;
 
 import lombok.Getter;
@@ -22,7 +41,8 @@ public enum DataType {
     BinaryVector(100),
     FloatVector(101),
     Float16Vector(102),
-    BFloat16Vector(103);
+    BFloat16Vector(103),
+    SparseFloatVector(104);
 
     private final int code;
     DataType(int code) {

+ 19 - 0
src/main/java/io/milvus/v2/common/IndexParam.java

@@ -1,3 +1,22 @@
+/*
+ * 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.common;
 
 import lombok.Builder;

+ 23 - 1
src/main/java/io/milvus/v2/examples/Simple.java

@@ -1,6 +1,26 @@
+/*
+ * 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.examples;
 
 import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
 import io.milvus.v2.client.ConnectConfig;
 import io.milvus.v2.client.MilvusClientV2;
 import io.milvus.v2.exception.MilvusClientException;
@@ -11,6 +31,7 @@ import io.milvus.v2.service.collection.request.HasCollectionReq;
 import io.milvus.v2.service.vector.request.InsertReq;
 import io.milvus.v2.service.vector.request.QueryReq;
 import io.milvus.v2.service.vector.request.SearchReq;
+import io.milvus.v2.service.vector.request.data.FloatVec;
 import io.milvus.v2.service.vector.response.QueryResp;
 import io.milvus.v2.service.vector.response.SearchResp;
 import org.slf4j.Logger;
@@ -82,9 +103,10 @@ public class Simple {
         QueryResp queryResp = client.query(queryReq);
         System.out.println(queryResp);
         //search data
+        List<Float> vector = new Gson().fromJson(insertData.get(0).get("vector"), new TypeToken<List<Float>>() {}.getType());
         SearchReq searchReq = SearchReq.builder()
                 .collectionName(collectionName)
-                .data(Collections.singletonList(insertData.get(0).get("vector")))
+                .data(Collections.singletonList(new FloatVec(vector)))
                 .topK(10)
                 .build();
         SearchResp searchResp = client.search(searchReq);

+ 23 - 1
src/main/java/io/milvus/v2/examples/Simple_Schema.java

@@ -1,6 +1,26 @@
+/*
+ * 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.examples;
 
 import com.google.gson.*;
+import com.google.gson.reflect.TypeToken;
 import io.milvus.v2.client.ConnectConfig;
 import io.milvus.v2.client.MilvusClientV2;
 import io.milvus.v2.common.DataType;
@@ -10,6 +30,7 @@ import io.milvus.v2.service.index.request.CreateIndexReq;
 import io.milvus.v2.service.vector.request.InsertReq;
 import io.milvus.v2.service.vector.request.QueryReq;
 import io.milvus.v2.service.vector.request.SearchReq;
+import io.milvus.v2.service.vector.request.data.FloatVec;
 import io.milvus.v2.service.vector.response.QueryResp;
 import io.milvus.v2.service.vector.response.SearchResp;
 import org.slf4j.Logger;
@@ -95,9 +116,10 @@ public class Simple_Schema {
         queryResp.getQueryResults().get(0).getEntity().get("vector");
         System.out.println(queryResp);
         //search data
+        List<Float> vector = new Gson().fromJson(insertData.get(0).get("vector"), new TypeToken<List<Float>>() {}.getType());
         SearchReq searchReq = SearchReq.builder()
                 .collectionName(collectionName)
-                .data(Collections.singletonList(insertData.get(0).get("vector")))
+                .data(Collections.singletonList(new FloatVec(vector)))
                 .outputFields(Collections.singletonList("vector"))
                 .topK(10)
                 .build();

+ 19 - 0
src/main/java/io/milvus/v2/exception/ErrorCode.java

@@ -1,3 +1,22 @@
+/*
+ * 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.exception;
 
 import lombok.Getter;

+ 19 - 0
src/main/java/io/milvus/v2/exception/MilvusClientException.java

@@ -1,3 +1,22 @@
+/*
+ * 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.exception;
 
 import lombok.Getter;

+ 19 - 0
src/main/java/io/milvus/v2/service/BaseService.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.grpc.BoolResponse;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/CollectionService.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.grpc.*;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/AddFieldReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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 io.milvus.v2.common.DataType;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/CreateCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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 io.milvus.v2.common.DataType;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/DescribeCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/DropCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/GetCollectionStatsReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/GetLoadStateReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/HasCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/LoadCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/ReleaseCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/request/RenameCollectionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/response/DescribeCollectionResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.response;
 
 import io.milvus.v2.service.collection.request.CreateCollectionReq;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/response/GetCollectionStatsResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/collection/response/ListCollectionsResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/IndexService.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.grpc.*;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/request/CreateIndexReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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 io.milvus.v2.common.IndexParam;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/request/DescribeIndexReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/request/DropIndexReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/request/ListIndexesReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/index/response/DescribeIndexResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/PartitionService.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition;
 
 import io.milvus.grpc.CreatePartitionRequest;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/CreatePartitionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/DropPartitionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/HasPartitionReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/ListPartitionsReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/LoadPartitionsReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/partition/request/ReleasePartitionsReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/RoleService.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac;
 
 import io.milvus.grpc.*;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/UserService.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac;
 
 import io.milvus.grpc.*;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/CreateRoleReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/CreateUserReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/DescribeRoleReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/DescribeUserReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/DropRoleReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/DropUserReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/GrantPrivilegeReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/GrantRoleReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/RevokePrivilegeReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/RevokeRoleReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/request/UpdatePasswordReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/response/DescribeRoleResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.response;
 
 import io.milvus.grpc.GrantEntity;

+ 19 - 0
src/main/java/io/milvus/v2/service/rbac/response/DescribeUserResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.rbac.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/UtilityService.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility;
 
 import io.milvus.grpc.FlushResponse;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/AlterAliasReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/CreateAliasReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/DescribeAliasReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/DropAliasReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/FlushReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/request/ListAliasesReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.request;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/response/DescribeAliasResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/utility/response/ListAliasResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utility.response;
 
 import lombok.Data;

+ 35 - 0
src/main/java/io/milvus/v2/service/vector/VectorService.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector;
 
 import io.milvus.grpc.*;
@@ -87,6 +106,22 @@ public class VectorService extends BaseService {
                 .build();
     }
 
+    public SearchResp hybridSearch(MilvusServiceGrpc.MilvusServiceBlockingStub milvusServiceBlockingStub, HybridSearchReq request) {
+        String title = String.format("HybridSearchRequest collectionName:%s", request.getCollectionName());
+
+        //checkCollectionExist(milvusServiceBlockingStub, request.getCollectionName());
+
+        HybridSearchRequest searchRequest = vectorUtils.ConvertToGrpcHybridSearchRequest(request);
+
+        SearchResults response = milvusServiceBlockingStub.hybridSearch(searchRequest);
+
+        rpcUtils.handleResponse(title, response.getStatus());
+
+        return SearchResp.builder()
+                .searchResults(convertUtils.getEntities(response))
+                .build();
+    }
+
     public DeleteResp delete(MilvusServiceGrpc.MilvusServiceBlockingStub milvusServiceBlockingStub, DeleteReq request) {
         String title = String.format("DeleteRequest collectionName:%s", request.getCollectionName());
 

+ 38 - 0
src/main/java/io/milvus/v2/service/vector/request/AnnSearchReq.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.vector.request;
+
+import io.milvus.v2.service.vector.request.data.BaseVector;
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.List;
+
+@Data
+@SuperBuilder
+public class AnnSearchReq {
+    private String vectorFieldName;
+    private int topK;
+    @Builder.Default
+    private String expr = "";
+    private List<BaseVector> vectors;
+    private String params;
+}

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/request/DeleteReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.request;
 
 import lombok.Builder;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/request/GetReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.request;
 
 import lombok.Builder;

+ 44 - 0
src/main/java/io/milvus/v2/service/vector/request/HybridSearchReq.java

@@ -0,0 +1,44 @@
+/*
+ * 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.vector.request;
+
+import io.milvus.v2.common.ConsistencyLevel;
+import io.milvus.v2.service.vector.request.ranker.BaseRanker;
+import lombok.Builder;
+import lombok.Data;
+import lombok.experimental.SuperBuilder;
+
+import java.util.List;
+
+@Data
+@SuperBuilder
+public class HybridSearchReq
+{
+    private String databaseName;
+    private String collectionName;
+    private List<String> partitionNames;
+    private List<AnnSearchReq> searchRequests;
+    private BaseRanker ranker;
+    private int topK;
+    private List<String> outFields;
+    @Builder.Default
+    private int roundDecimal = -1;
+    private ConsistencyLevel consistencyLevel;
+}

+ 43 - 0
src/main/java/io/milvus/v2/service/vector/request/InsertReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.request;
 
 import com.google.gson.JsonObject;
@@ -11,6 +30,30 @@ import java.util.List;
 @SuperBuilder
 public class InsertReq {
     //private List<> fields;
+
+    /**
+     * Sets the row data to insert. The rows list cannot be empty.
+     *
+     * Internal class for insert data.
+     * 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.add("XX", 128), the value 128 is cut to -128.
+     *   An Int64 field named "XX", you set the value to be 3.9 by JsonObject.add("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.add("XX", "TRUE"), the string "TRUE" is parsed as true.
+     *   A Float field named "XX", you set the value to be "3.5" by JsonObject.add("XX", "3.5", the string "3.5" is parsed as 3.5.
+     *
+     */
     private List<JsonObject> data;
     private String collectionName;
     @Builder.Default

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/request/QueryReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.request;
 
 import io.milvus.v2.common.ConsistencyLevel;

+ 21 - 1
src/main/java/io/milvus/v2/service/vector/request/SearchReq.java

@@ -1,6 +1,26 @@
+/*
+ * 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.vector.request;
 
 import io.milvus.v2.common.ConsistencyLevel;
+import io.milvus.v2.service.vector.request.data.BaseVector;
 import lombok.Builder;
 import lombok.Data;
 import lombok.experimental.SuperBuilder;
@@ -22,7 +42,7 @@ public class SearchReq {
     private String filter;
     @Builder.Default
     private List<String> outputFields = new ArrayList<>();
-    private List<?> data;
+    private List<BaseVector> data;
     private long offset;
     private long limit;
 

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/UpsertReq.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.request;
 
 import com.google.gson.JsonObject;
@@ -10,6 +29,29 @@ import java.util.List;
 @Data
 @SuperBuilder
 public class UpsertReq {
+    /**
+     * Sets the row data to insert. The rows list cannot be empty.
+     *
+     * Internal class for insert data.
+     * 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.add("XX", 128), the value 128 is cut to -128.
+     *   An Int64 field named "XX", you set the value to be 3.9 by JsonObject.add("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.add("XX", "TRUE"), the string "TRUE" is parsed as true.
+     *   A Float field named "XX", you set the value to be "3.5" by JsonObject.add("XX", "3.5", the string "3.5" is parsed as 3.5.
+     *
+     */
     private List<JsonObject> data;
     private String collectionName;
     @Builder.Default

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/data/BFloat16Vec.java

@@ -0,0 +1,42 @@
+/*
+ * 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.vector.request.data;
+
+import io.milvus.grpc.PlaceholderType;
+
+import java.nio.ByteBuffer;
+
+public class BFloat16Vec implements BaseVector {
+    private final ByteBuffer data;
+
+    public BFloat16Vec(ByteBuffer data) {
+        this.data = data;
+    }
+
+    @Override
+    public PlaceholderType getPlaceholderType() {
+        return PlaceholderType.BFloat16Vector;
+    }
+
+    @Override
+    public Object getData() {
+        return this.data;
+    }
+}

+ 27 - 0
src/main/java/io/milvus/v2/service/vector/request/data/BaseVector.java

@@ -0,0 +1,27 @@
+/*
+ * 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.vector.request.data;
+
+import io.milvus.grpc.PlaceholderType;
+
+public interface BaseVector {
+    PlaceholderType getPlaceholderType();
+    Object getData();
+}

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/data/BinaryVec.java

@@ -0,0 +1,42 @@
+/*
+ * 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.vector.request.data;
+
+import io.milvus.grpc.PlaceholderType;
+
+import java.nio.ByteBuffer;
+
+public class BinaryVec implements BaseVector {
+    private final ByteBuffer data;
+
+    public BinaryVec(ByteBuffer data) {
+        this.data = data;
+    }
+
+    @Override
+    public PlaceholderType getPlaceholderType() {
+        return PlaceholderType.BinaryVector;
+    }
+
+    @Override
+    public Object getData() {
+        return this.data;
+    }
+}

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/data/Float16Vec.java

@@ -0,0 +1,42 @@
+/*
+ * 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.vector.request.data;
+
+import io.milvus.grpc.PlaceholderType;
+
+import java.nio.ByteBuffer;
+
+public class Float16Vec implements BaseVector {
+    private final ByteBuffer data;
+
+    public Float16Vec(ByteBuffer data) {
+        this.data = data;
+    }
+
+    @Override
+    public PlaceholderType getPlaceholderType() {
+        return PlaceholderType.Float16Vector;
+    }
+
+    @Override
+    public Object getData() {
+        return this.data;
+    }
+}

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/data/FloatVec.java

@@ -0,0 +1,42 @@
+/*
+ * 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.vector.request.data;
+
+
+import io.milvus.grpc.PlaceholderType;
+import java.util.List;
+
+public class FloatVec implements BaseVector {
+    private final List<Float> data;
+
+    public FloatVec(List<Float> data) {
+        this.data = data;
+    }
+
+    @Override
+    public PlaceholderType getPlaceholderType() {
+        return PlaceholderType.FloatVector;
+    }
+
+    @Override
+    public Object getData() {
+        return this.data;
+    }
+}

+ 42 - 0
src/main/java/io/milvus/v2/service/vector/request/data/SparseFloatVec.java

@@ -0,0 +1,42 @@
+/*
+ * 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.vector.request.data;
+
+import io.milvus.grpc.PlaceholderType;
+
+import java.util.SortedMap;
+
+public class SparseFloatVec implements BaseVector {
+    private final SortedMap<Long, Float> data;
+
+    public SparseFloatVec(SortedMap<Long, Float> data) {
+        this.data = data;
+    }
+
+    @Override
+    public PlaceholderType getPlaceholderType() {
+        return PlaceholderType.SparseFloatVector;
+    }
+
+    @Override
+    public Object getData() {
+        return this.data;
+    }
+}

+ 26 - 0
src/main/java/io/milvus/v2/service/vector/request/ranker/BaseRanker.java

@@ -0,0 +1,26 @@
+/*
+ * 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.vector.request.ranker;
+
+import java.util.Map;
+
+public abstract class BaseRanker {
+    public abstract Map<String, String> getProperties();
+}

+ 47 - 0
src/main/java/io/milvus/v2/service/vector/request/ranker/RRFRanker.java

@@ -0,0 +1,47 @@
+/*
+ * 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.vector.request.ranker;
+
+import com.google.gson.JsonObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The RRF reranking strategy, which merges results from multiple searches, favoring items that consistently appear.
+ */
+public class RRFRanker extends BaseRanker {
+    private int k = 60;
+
+    public RRFRanker(int k) {
+        this.k = k;
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        JsonObject params = new JsonObject();
+        params.addProperty("k", this.k);
+
+        Map<String, String> props = new HashMap<>();
+        props.put("strategy", "rrf");
+        props.put("params", params.toString());
+        return props;
+    }
+}

+ 50 - 0
src/main/java/io/milvus/v2/service/vector/request/ranker/WeightedRanker.java

@@ -0,0 +1,50 @@
+/*
+ * 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.vector.request.ranker;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonObject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The Average Weighted Scoring reranking strategy, which prioritizes vectors based on relevance,
+ * averaging their significance.
+ */
+public class WeightedRanker extends BaseRanker {
+    private List<Float> weights;
+
+    public WeightedRanker(List<Float> weights) {
+        this.weights = weights;
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        JsonObject params = new JsonObject();
+        params.add("weights", new Gson().toJsonTree(this.weights).getAsJsonArray());
+
+        Map<String, String> props = new HashMap<>();
+        props.put("strategy", "weighted");
+        props.put("params", params.toString());
+        return props;
+    }
+}

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/DeleteResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/GetResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/InsertResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/QueryResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/SearchResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/service/vector/response/UpsertResp.java

@@ -1,3 +1,22 @@
+/*
+ * 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.vector.response;
 
 import lombok.Data;

+ 19 - 0
src/main/java/io/milvus/v2/utils/ClientUtils.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utils;
 
 import io.grpc.ManagedChannel;

+ 19 - 0
src/main/java/io/milvus/v2/utils/ConvertUtils.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utils;
 
 import io.milvus.grpc.*;

+ 19 - 0
src/main/java/io/milvus/v2/utils/DataUtils.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utils;
 
 import com.google.gson.JsonElement;

+ 19 - 0
src/main/java/io/milvus/v2/utils/RpcUtils.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utils;
 
 import io.milvus.grpc.Status;

+ 19 - 0
src/main/java/io/milvus/v2/utils/SchemaUtils.java

@@ -1,3 +1,22 @@
+/*
+ * 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.utils;
 
 import io.milvus.grpc.CollectionSchema;

+ 147 - 47
src/main/java/io/milvus/v2/utils/VectorUtils.java

@@ -1,26 +1,45 @@
+/*
+ * 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.utils;
 
 import com.google.gson.Gson;
 import com.google.protobuf.ByteString;
-import io.milvus.common.clientenum.ConsistencyLevelEnum;
+import io.milvus.v2.common.ConsistencyLevel;
 import io.milvus.exception.ParamException;
 import io.milvus.grpc.*;
 import io.milvus.param.Constant;
-import io.milvus.v2.service.vector.request.QueryReq;
-import io.milvus.v2.service.vector.request.SearchReq;
+import io.milvus.param.MetricType;
+import io.milvus.param.ParamUtils;
+import io.milvus.v2.service.vector.request.*;
+import io.milvus.v2.service.vector.request.ranker.BaseRanker;
+import io.milvus.v2.service.vector.request.data.*;
+import lombok.NonNull;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 public class VectorUtils {
     private static final Gson GSON_INSTANCE = new Gson();
 
     public QueryRequest ConvertToGrpcQueryRequest(QueryReq request){
-//        long guaranteeTimestamp = getGuaranteeTimestamp(ConsistencyLevelEnum.valueOf(request.getConsistencyLevel().name()),
-//                request.getGuaranteeTimestamp(), request.getGracefulTime());
         QueryRequest.Builder builder = QueryRequest.newBuilder()
                 .setCollectionName(request.getCollectionName())
                 .addAllPartitionNames(request.getPartitionNames())
@@ -62,7 +81,7 @@ public class VectorUtils {
 
     }
 
-    private static long getGuaranteeTimestamp(ConsistencyLevelEnum consistencyLevel,
+    private static long getGuaranteeTimestamp(ConsistencyLevel consistencyLevel,
                                               long guaranteeTimestamp, Long gracefulTime){
         if(consistencyLevel == null){
             return 1L;
@@ -90,44 +109,20 @@ public class VectorUtils {
 
 
         // prepare target vectors
-        // TODO: check target vector dimension(use DescribeCollection get schema to compare)
-        PlaceholderType plType = PlaceholderType.None;
-        List<?> vectors = request.getData();
-        List<ByteString> byteStrings = new ArrayList<>();
-        for (Object vector : vectors) {
-            if (vector instanceof List) {
-                plType = PlaceholderType.FloatVector;
-                List<Float> list = (List<Float>) vector;
-                ByteBuffer buf = ByteBuffer.allocate(Float.BYTES * list.size());
-                buf.order(ByteOrder.LITTLE_ENDIAN);
-                list.forEach(buf::putFloat);
-
-                byte[] array = buf.array();
-                ByteString bs = ByteString.copyFrom(array);
-                byteStrings.add(bs);
-            } else if (vector instanceof ByteBuffer) {
-                plType = PlaceholderType.BinaryVector;
-                ByteBuffer buf = (ByteBuffer) vector;
-                byte[] array = buf.array();
-                ByteString bs = ByteString.copyFrom(array);
-                byteStrings.add(bs);
-            } else {
-                String msg = "Search target vector type is illegal(Only allow List<Float> or ByteBuffer)";
-                throw new ParamException(msg);
+        List<BaseVector> vectors = request.getData();
+        if (vectors.isEmpty()) {
+            throw new ParamException("Target vectors list of search request is empty.");
+        }
+        PlaceholderType plType = vectors.get(0).getPlaceholderType();
+        List<Object> data = new ArrayList<>();
+        for (BaseVector vector : vectors) {
+            if (vector.getPlaceholderType() != plType) {
+                throw new ParamException("Different types of target vectors in a search request is not allowed.");
             }
+            data.add(vector.getData());
         }
 
-        PlaceholderValue.Builder pldBuilder = PlaceholderValue.newBuilder()
-                .setTag(Constant.VECTOR_TAG)
-                .setType(plType);
-        byteStrings.forEach(pldBuilder::addValues);
-
-        PlaceholderValue plv = pldBuilder.build();
-        PlaceholderGroup placeholderGroup = PlaceholderGroup.newBuilder()
-                .addPlaceholders(plv)
-                .build();
-
-        ByteString byteStr = placeholderGroup.toByteString();
+        ByteString byteStr = ParamUtils.convertPlaceholder(data, plType);
         builder.setPlaceholderGroup(byteStr);
 
         // search parameters
@@ -181,7 +176,7 @@ public class VectorUtils {
             builder.setDsl(request.getFilter());
         }
 
-        long guaranteeTimestamp = getGuaranteeTimestamp(ConsistencyLevelEnum.valueOf(request.getConsistencyLevel().name()),
+        long guaranteeTimestamp = getGuaranteeTimestamp(request.getConsistencyLevel(),
                 request.getGuaranteeTimestamp(), request.getGracefulTime());
         //builder.setTravelTimestamp(request.getTravelTimestamp());
         builder.setGuaranteeTimestamp(guaranteeTimestamp);
@@ -196,6 +191,111 @@ public class VectorUtils {
         return builder.build();
     }
 
+    public static SearchRequest convertAnnSearchParam(@NonNull AnnSearchReq annSearchReq,
+                                                      ConsistencyLevel consistencyLevel) {
+        SearchRequest.Builder builder = SearchRequest.newBuilder();
+        // prepare target vectors
+        List<BaseVector> vectors = annSearchReq.getVectors();
+        if (vectors.isEmpty()) {
+            throw new ParamException("Target vectors list of search request is empty.");
+        }
+        PlaceholderType plType = vectors.get(0).getPlaceholderType();
+        List<Object> data = new ArrayList<>();
+        for (BaseVector vector : vectors) {
+            if (vector.getPlaceholderType() != plType) {
+                throw new ParamException("Different types of target vectors in a search request is not allowed.");
+            }
+            data.add(vector.getData());
+        }
+
+        ByteString byteStr = ParamUtils.convertPlaceholder(data, plType);
+        builder.setPlaceholderGroup(byteStr);
+        builder.setNq(vectors.size());
+
+        builder.addSearchParams(
+                        KeyValuePair.newBuilder()
+                                .setKey(Constant.VECTOR_FIELD)
+                                .setValue(annSearchReq.getVectorFieldName())
+                                .build())
+                .addSearchParams(
+                        KeyValuePair.newBuilder()
+                                .setKey(Constant.TOP_K)
+                                .setValue(String.valueOf(annSearchReq.getTopK()))
+                                .build());
+
+        // params
+        String params = "{}";
+        if (null != annSearchReq.getParams() && !annSearchReq.getParams().isEmpty()) {
+            params = annSearchReq.getParams();
+        }
+        builder.addSearchParams(KeyValuePair.newBuilder()
+                        .setKey(Constant.PARAMS)
+                        .setValue(params)
+                        .build());
+
+        // always use expression since dsl is discarded
+        builder.setDslType(DslType.BoolExprV1);
+        if (annSearchReq.getExpr() != null && !annSearchReq.getExpr().isEmpty()) {
+            builder.setDsl(annSearchReq.getExpr());
+        }
+
+        if (consistencyLevel == null) {
+            builder.setUseDefaultConsistency(true);
+        } else {
+            builder.setConsistencyLevelValue(consistencyLevel.getCode());
+        }
+
+        return builder.build();
+    }
+
+    public HybridSearchRequest ConvertToGrpcHybridSearchRequest(HybridSearchReq request) {
+        HybridSearchRequest.Builder builder = HybridSearchRequest.newBuilder()
+                .setCollectionName(request.getCollectionName());
+
+        if (request.getPartitionNames() != null && !request.getPartitionNames().isEmpty()) {
+            request.getPartitionNames().forEach(builder::addPartitionNames);
+        }
+        if (StringUtils.isNotEmpty(request.getDatabaseName())) {
+            builder.setDbName(request.getDatabaseName());
+        }
+
+        if (request.getSearchRequests() == null || request.getSearchRequests().isEmpty()) {
+            throw new ParamException("Sub-request list is empty.");
+        }
+
+        for (AnnSearchReq req : request.getSearchRequests()) {
+            SearchRequest searchRequest = convertAnnSearchParam(req, request.getConsistencyLevel());
+            builder.addRequests(searchRequest);
+        }
+
+        // set ranker
+        BaseRanker ranker = request.getRanker();
+        if (request.getRanker() == null) {
+            throw new ParamException("Ranker is null.");
+        }
+
+        Map<String, String> props = ranker.getProperties();
+        props.put("limit", String.format("%d", request.getTopK()));
+        props.put("round_decimal", String.format("%d", request.getRoundDecimal()));
+        List<KeyValuePair> propertiesList = ParamUtils.AssembleKvPair(props);
+        if (CollectionUtils.isNotEmpty(propertiesList)) {
+            propertiesList.forEach(builder::addRankParams);
+        }
+
+        // output fields
+        if (request.getOutFields() != null && !request.getOutFields().isEmpty()) {
+            request.getOutFields().forEach(builder::addOutputFields);
+        }
+
+        if (request.getConsistencyLevel() == null) {
+            builder.setUseDefaultConsistency(true);
+        } else {
+            builder.setConsistencyLevelValue(request.getConsistencyLevel().getCode());
+        }
+
+        return builder.build();
+    }
+
     public String getExprById(String primaryFieldName, List<?> ids) {
         StringBuilder sb = new StringBuilder();
         sb.append(primaryFieldName).append(" in [");

+ 19 - 0
src/test/java/io/milvus/v2/BaseTest.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.grpc.*;

+ 762 - 0
src/test/java/io/milvus/v2/client/MilvusClientV2DockerTest.java

@@ -0,0 +1,762 @@
+/*
+ * 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.client;
+
+import com.google.gson.*;
+
+import com.google.gson.reflect.TypeToken;
+import io.milvus.v2.common.ConsistencyLevel;
+import io.milvus.v2.common.DataType;
+import io.milvus.v2.common.IndexParam;
+import io.milvus.v2.service.collection.request.AddFieldReq;
+import io.milvus.v2.service.collection.request.CreateCollectionReq;
+import io.milvus.v2.service.collection.request.DropCollectionReq;
+import io.milvus.v2.service.partition.request.CreatePartitionReq;
+import io.milvus.v2.service.vector.request.*;
+import io.milvus.v2.service.vector.request.data.*;
+import io.milvus.v2.service.vector.request.ranker.*;
+import io.milvus.v2.service.vector.response.*;
+import org.apache.commons.text.RandomStringGenerator;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Test;
+import org.testcontainers.junit.jupiter.Container;
+import org.testcontainers.junit.jupiter.Testcontainers;
+import org.testcontainers.milvus.MilvusContainer;
+
+import java.nio.ByteBuffer;
+import java.util.*;
+
+@Testcontainers(disabledWithoutDocker = true)
+class MilvusClientV2DockerTest {
+    private static MilvusClientV2 client;
+    private static RandomStringGenerator generator;
+    private static final int dimension = 256;
+
+    private static final Gson GSON_INSTANCE = new Gson();
+
+    private static final Random RANDOM = new Random();
+
+    @Container
+    private static final MilvusContainer milvus = new MilvusContainer("milvusdb/milvus:v2.4.1");
+
+    @BeforeAll
+    public static void setUp() {
+        ConnectConfig config = ConnectConfig.builder()
+                .uri(milvus.getEndpoint())
+                .build();
+        client = new MilvusClientV2(config);
+        generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
+    }
+
+    @AfterAll
+    public static void tearDown() throws InterruptedException {
+        if (client != null) {
+            client.close(5L);
+        }
+    }
+
+    private List<Float> generateFolatVector() {
+        List<Float> vector = new ArrayList<>();
+        for (int i = 0; i < dimension; ++i) {
+            vector.add(RANDOM.nextFloat());
+        }
+        return vector;
+    }
+
+    private List<List<Float>> generateFloatVectors(int count) {
+        List<List<Float>> vectors = new ArrayList<>();
+        for (int n = 0; n < count; ++n) {
+            vectors.add(generateFolatVector());
+        }
+
+        return vectors;
+    }
+
+    private ByteBuffer generateBinaryVector() {
+        int byteCount = dimension / 8;
+        ByteBuffer vector = ByteBuffer.allocate(byteCount);
+        for (int i = 0; i < byteCount; ++i) {
+            vector.put((byte) RANDOM.nextInt(Byte.MAX_VALUE));
+        }
+        return vector;
+    }
+
+    private List<ByteBuffer> generateBinaryVectors(int count) {
+        List<ByteBuffer> vectors = new ArrayList<>();
+        for (int n = 0; n < count; ++n) {
+            vectors.add(generateBinaryVector());
+        }
+        return vectors;
+
+    }
+
+    private SortedMap<Long, Float> generateSparseVector() {
+        SortedMap<Long, Float> sparse = new TreeMap<>();
+        int dim = RANDOM.nextInt(10) + 10;
+        for (int i = 0; i < dim; ++i) {
+            sparse.put((long) RANDOM.nextInt(1000000), RANDOM.nextFloat());
+        }
+        return sparse;
+    }
+
+    private List<SortedMap<Long, Float>> generateSparseVectors(int count) {
+        List<SortedMap<Long, Float>> vectors = new ArrayList<>();
+        for (int n = 0; n < count; ++n) {
+            vectors.add(generateSparseVector());
+        }
+        return vectors;
+
+    }
+
+    private CreateCollectionReq.CollectionSchema baseSchema() {
+        CreateCollectionReq.CollectionSchema collectionSchema = CreateCollectionReq.CollectionSchema.builder()
+                .build();
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("id")
+                .dataType(DataType.Int64)
+                .isPrimaryKey(Boolean.TRUE)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("bool_field")
+                .dataType(DataType.Bool)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("int8_field")
+                .dataType(DataType.Int8)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("int16_field")
+                .dataType(DataType.Int16)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("int32_field")
+                .dataType(DataType.Int32)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("int64_field")
+                .dataType(DataType.Int64)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("float_field")
+                .dataType(DataType.Float)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("double_field")
+                .dataType(DataType.Double)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("varchar_field")
+                .dataType(DataType.VarChar)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("json_field")
+                .dataType(DataType.JSON)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("arr_int_field")
+                .dataType(DataType.Array)
+                .maxCapacity(50)
+                .elementType(DataType.Int32)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("arr_float_field")
+                .dataType(DataType.Array)
+                .maxCapacity(20)
+                .elementType(DataType.Float)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("arr_varchar_field")
+                .dataType(DataType.Array)
+                .maxCapacity(10)
+                .elementType(DataType.VarChar)
+                .build());
+        return collectionSchema;
+    }
+
+    private JsonArray generateRandomArray(CreateCollectionReq.FieldSchema field) {
+        DataType dataType = field.getDataType();
+        if (dataType != DataType.Array) {
+            Assertions.fail();
+        }
+
+        DataType eleType = field.getElementType();
+        int eleCnt = RANDOM.nextInt(field.getMaxCapacity());
+        switch (eleType) {
+            case Bool: {
+                List<Boolean> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(i%10 == 0);
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case Int8: {
+                List<Integer> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(RANDOM.nextInt(256));
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case Int16:
+            case Int32: {
+                List<Integer> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(RANDOM.nextInt());
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case Int64: {
+                List<Long> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(RANDOM.nextLong());
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case Float: {
+                List<Float> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(RANDOM.nextFloat());
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case Double: {
+                List<Double> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(RANDOM.nextDouble());
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            case VarChar: {
+                List<String> values = new ArrayList<>();
+                for (int i = 0; i < eleCnt; i++) {
+                    values.add(String.format("varchar_arr_%d", i));
+                }
+                return GSON_INSTANCE.toJsonTree(values).getAsJsonArray();
+            }
+            default:
+                Assertions.fail();
+        }
+        return null;
+    }
+
+    private List<JsonObject> generateRandomData(CreateCollectionReq.CollectionSchema schema, long count) {
+        List<CreateCollectionReq.FieldSchema> fields = schema.getFieldSchemaList();
+        List<JsonObject> rows = new ArrayList<>();
+        for (long i = 0; i < count; i++) {
+            JsonObject row = new JsonObject();
+            for (CreateCollectionReq.FieldSchema field : fields) {
+                DataType dataType = field.getDataType();
+                switch (dataType) {
+                    case Bool:
+                        row.addProperty(field.getName(), i%3==0);
+                        break;
+                    case Int8:
+                        row.addProperty(field.getName(), i%128);
+                        break;
+                    case Int16:
+                        row.addProperty(field.getName(), i%32768);
+                        break;
+                    case Int32:
+                        row.addProperty(field.getName(), i%65536);
+                        break;
+                    case Int64:
+                        row.addProperty(field.getName(), i);
+                        break;
+                    case Float:
+                        row.addProperty(field.getName(), i/8);
+                        break;
+                    case Double:
+                        row.addProperty(field.getName(), i/3);
+                        break;
+                    case VarChar:
+                        row.addProperty(field.getName(), String.format("varchar_%d", i));
+                        break;
+                    case JSON: {
+                        JsonObject jsonObj = new JsonObject();
+                        jsonObj.addProperty(String.format("JSON_%d", i), i);
+                        row.add(field.getName(), jsonObj);
+                        break;
+                    }
+                    case Array: {
+                        JsonArray array = generateRandomArray(field);
+                        row.add(field.getName(), array);
+                        break;
+                    }
+                    case FloatVector: {
+                        List<Float> vector = generateFolatVector();
+                        row.add(field.getName(), GSON_INSTANCE.toJsonTree(vector));
+                        break;
+                    }
+                    case BinaryVector: {
+                        ByteBuffer vector = generateBinaryVector();
+                        row.add(field.getName(), GSON_INSTANCE.toJsonTree(vector.array()));
+                        break;
+                    }
+                    case SparseFloatVector: {
+                        SortedMap<Long, Float> vector = generateSparseVector();
+                        row.add(field.getName(), GSON_INSTANCE.toJsonTree(vector));
+                        break;
+                    }
+                    default:
+                        Assertions.fail();
+                }
+            }
+            rows.add(row);
+        }
+
+        return rows;
+    }
+
+    private void verifyOutput(JsonObject row, Map<String, Object> entity) {
+        Boolean b = (Boolean) entity.get("bool_field");
+        Assertions.assertEquals(row.get("bool_field").getAsBoolean(), b);
+        Integer i8 = (Integer) entity.get("int8_field");
+        Assertions.assertEquals(row.get("int8_field").getAsInt(), i8);
+        Integer i16 = (Integer) entity.get("int16_field");
+        Assertions.assertEquals(row.get("int16_field").getAsInt(), i16);
+        Integer i32 = (Integer) entity.get("int32_field");
+        Assertions.assertEquals(row.get("int32_field").getAsInt(), i32);
+        Long i64 = (Long) entity.get("int64_field");
+        Assertions.assertEquals(row.get("int64_field").getAsLong(), i64);
+        Float f32 = (Float) entity.get("float_field");
+        Assertions.assertEquals(row.get("float_field").getAsFloat(), f32);
+        Double f64 = (Double) entity.get("double_field");
+        Assertions.assertEquals(row.get("double_field").getAsDouble(), f64);
+        String str = (String) entity.get("varchar_field");
+        Assertions.assertEquals(row.get("varchar_field").getAsString(), str);
+        JsonObject jsn = (JsonObject) entity.get("json_field");
+        Assertions.assertEquals(row.get("json_field").toString(), jsn.toString());
+
+        List<Integer> arrInt = (List<Integer>) entity.get("arr_int_field");
+        List<Integer> arrIntOri = GSON_INSTANCE.fromJson(row.get("arr_int_field"), new TypeToken<List<Integer>>() {}.getType());
+        Assertions.assertEquals(arrIntOri, arrInt);
+        List<Float> arrFloat = (List<Float>) entity.get("arr_float_field");
+        List<Float> arrFloatOri = GSON_INSTANCE.fromJson(row.get("arr_float_field"), new TypeToken<List<Float>>() {}.getType());
+        Assertions.assertEquals(arrFloatOri, arrFloat);
+        List<String> arrStr = (List<String>) entity.get("arr_varchar_field");
+        List<String> arrStrOri = GSON_INSTANCE.fromJson(row.get("arr_varchar_field"), new TypeToken<List<String>>() {}.getType());
+        Assertions.assertEquals(arrStrOri, arrStr);
+    }
+
+
+    @Test
+    void testFloatVectors() {
+        String randomCollectionName = generator.generate(10);
+
+        String vectorFieldName = "float_vector";
+        CreateCollectionReq.CollectionSchema collectionSchema = baseSchema();
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName(vectorFieldName)
+                .dataType(DataType.FloatVector)
+                .dimension(dimension)
+                .build());
+
+        Map<String,Object> extraParams = new HashMap<>();
+        extraParams.put("M",16);
+        extraParams.put("efConstruction",64);
+        IndexParam indexParam = IndexParam.builder()
+                .fieldName(vectorFieldName)
+                .indexType(IndexParam.IndexType.HNSW)
+                .metricType(IndexParam.MetricType.COSINE)
+                .extraParams(extraParams)
+                .build();
+
+        CreateCollectionReq requestCreate = CreateCollectionReq.builder()
+                .collectionName(randomCollectionName)
+                .collectionSchema(collectionSchema)
+                .indexParams(Collections.singletonList(indexParam))
+                .build();
+        client.createCollection(requestCreate);
+
+        // insert rows
+        long count = 10000;
+        List<JsonObject> data = generateRandomData(collectionSchema, count);
+        InsertResp insertResp = client.insert(InsertReq.builder()
+                .collectionName(randomCollectionName)
+                .data(data)
+                .build());
+        Assertions.assertEquals(count, insertResp.getInsertCnt());
+
+        // create partition, upsert one row to the partition
+        String partitionName = "PPP";
+        client.createPartition(CreatePartitionReq.builder()
+                .collectionName(randomCollectionName)
+                .partitionName(partitionName)
+                .build());
+
+        List<JsonObject> upsertData = new ArrayList<>();
+        upsertData.add(data.get((int) (count - 1)));
+        UpsertResp upsertResp = client.upsert(UpsertReq.builder()
+                .collectionName(randomCollectionName)
+                .partitionName(partitionName)
+                .data(upsertData)
+                .build());
+        Assertions.assertEquals(1, upsertResp.getUpsertCnt());
+
+        // get row count
+        QueryResp queryResp = client.query(QueryReq.builder()
+                .collectionName(randomCollectionName)
+                .filter("")
+                .outputFields(Collections.singletonList("count(*)"))
+                .consistencyLevel(ConsistencyLevel.STRONG)
+                .build());
+        List<QueryResp.QueryResult> queryResults = queryResp.getQueryResults();
+        Assertions.assertEquals(1, queryResults.size());
+        Assertions.assertEquals(count + 1, queryResults.get(0).getEntity().get("count(*)"));
+
+        // search in partition
+        SearchResp searchResp = client.search(SearchReq.builder()
+                .collectionName(randomCollectionName)
+                .partitionNames(Collections.singletonList(partitionName))
+                .annsField(vectorFieldName)
+                .data(Collections.singletonList(new FloatVec(generateFolatVector())))
+                .topK(10)
+                .build());
+        List<List<SearchResp.SearchResult>> searchResults = searchResp.getSearchResults();
+        Assertions.assertEquals(1, searchResults.size());
+        Assertions.assertEquals(1, searchResults.get(0).size());
+        Assertions.assertEquals(count - 1, searchResults.get(0).get(0).getId());
+
+
+        // query entities
+        int nq = 5;
+        List<Long> targetIDs = new ArrayList<>();
+        List<BaseVector> targetVectors = new ArrayList<>();
+        for (int i = 0; i < nq; i++) {
+            JsonObject row = data.get(RANDOM.nextInt((int)count));
+            targetIDs.add(row.get("id").getAsLong());
+            List<Float> vector = GSON_INSTANCE.fromJson(row.get(vectorFieldName), new TypeToken<List<Float>>() {}.getType());
+            targetVectors.add(new FloatVec(vector));
+        }
+
+        GetResp getResp = client.get(GetReq.builder()
+                .collectionName(randomCollectionName)
+                .ids(new ArrayList<>(targetIDs))
+                .outputFields(Collections.singletonList("*"))
+                .build());
+        for (QueryResp.QueryResult result : getResp.getGetResults()) {
+            boolean found = false;
+            for (int i = 0; i < nq; i++) {
+                Map<String, Object> entity = result.getEntity();
+                if (Objects.equals(targetIDs.get(i), entity.get("id"))) {
+                    JsonObject row = data.get(targetIDs.get(i).intValue());
+                    verifyOutput(row, entity);
+                    found = true;
+                    break;
+                }
+            }
+            if (!found) {
+                Assertions.fail();
+            }
+        }
+
+        // search in collection
+        int topk = 10;
+        searchResp = client.search(SearchReq.builder()
+                .collectionName(randomCollectionName)
+                .annsField(vectorFieldName)
+                .data(targetVectors)
+                .topK(10)
+                .outputFields(Collections.singletonList("*"))
+                .build());
+        searchResults = searchResp.getSearchResults();
+        Assertions.assertEquals(nq, searchResults.size());
+        for (int i = 0; i < nq; i++) {
+            List<SearchResp.SearchResult> results = searchResults.get(i);
+            Assertions.assertEquals(topk, results.size());
+            SearchResp.SearchResult result = results.get(0);
+            Assertions.assertEquals(targetIDs.get(i), result.getId());
+
+            Map<String, Object> entity = result.getEntity();
+            JsonObject row = data.get(targetIDs.get(i).intValue());
+            verifyOutput(row, entity);
+        }
+
+        client.dropCollection(DropCollectionReq.builder().collectionName(randomCollectionName).build());
+    }
+
+    @Test
+    void testBinaryVectors() {
+        String randomCollectionName = generator.generate(10);
+
+        String vectorFieldName = "binary_vector";
+        CreateCollectionReq.CollectionSchema collectionSchema = baseSchema();
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName(vectorFieldName)
+                .dataType(DataType.BinaryVector)
+                .dimension(dimension)
+                .build());
+
+        Map<String,Object> extraParams = new HashMap<>();
+        extraParams.put("nlist",64);
+        IndexParam indexParam = IndexParam.builder()
+                .fieldName(vectorFieldName)
+                .indexType(IndexParam.IndexType.BIN_IVF_FLAT)
+                .metricType(IndexParam.MetricType.JACCARD)
+                .extraParams(extraParams)
+                .build();
+
+        CreateCollectionReq requestCreate = CreateCollectionReq.builder()
+                .collectionName(randomCollectionName)
+                .collectionSchema(collectionSchema)
+                .indexParams(Collections.singletonList(indexParam))
+                .build();
+        client.createCollection(requestCreate);
+
+        // insert rows
+        long count = 10000;
+        List<JsonObject> data = generateRandomData(collectionSchema, count);
+        InsertResp insertResp = client.insert(InsertReq.builder()
+                .collectionName(randomCollectionName)
+                .data(data)
+                .build());
+        Assertions.assertEquals(count, insertResp.getInsertCnt());
+
+        // get row count
+        QueryResp queryResp = client.query(QueryReq.builder()
+                .collectionName(randomCollectionName)
+                .filter("")
+                .outputFields(Collections.singletonList("count(*)"))
+                .consistencyLevel(ConsistencyLevel.STRONG)
+                .build());
+        List<QueryResp.QueryResult> queryResults = queryResp.getQueryResults();
+        Assertions.assertEquals(1, queryResults.size());
+        Assertions.assertEquals(count, queryResults.get(0).getEntity().get("count(*)"));
+
+        // search in collection
+        int nq = 5;
+        int topk = 10;
+        List<Long> targetIDs = new ArrayList<>();
+        List<BaseVector> targetVectors = new ArrayList<>();
+        for (int i = 0; i < nq; i++) {
+            JsonObject row = data.get(RANDOM.nextInt((int)count));
+            targetIDs.add(row.get("id").getAsLong());
+            byte[] vector = GSON_INSTANCE.fromJson(row.get(vectorFieldName), new TypeToken<byte[]>() {}.getType());
+            targetVectors.add(new BinaryVec(ByteBuffer.wrap(vector)));
+        }
+        SearchResp searchResp = client.search(SearchReq.builder()
+                .collectionName(randomCollectionName)
+                .annsField(vectorFieldName)
+                .data(targetVectors)
+                .topK(10)
+                .build());
+        List<List<SearchResp.SearchResult>> searchResults = searchResp.getSearchResults();
+        Assertions.assertEquals(nq, searchResults.size());
+        for (int i = 0; i < nq; i++) {
+            List<SearchResp.SearchResult> results = searchResults.get(i);
+            Assertions.assertEquals(topk, results.size());
+            Assertions.assertEquals(targetIDs.get(i), results.get(0).getId());
+        }
+
+        client.dropCollection(DropCollectionReq.builder().collectionName(randomCollectionName).build());
+    }
+
+    @Test
+    void testSparseVectors() {
+        String randomCollectionName = generator.generate(10);
+
+        String vectorFieldName = "binary_vector";
+        CreateCollectionReq.CollectionSchema collectionSchema = baseSchema();
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName(vectorFieldName)
+                .dataType(DataType.SparseFloatVector)
+                .dimension(dimension)
+                .build());
+
+        Map<String,Object> extraParams = new HashMap<>();
+        extraParams.put("drop_ratio_build",0.2);
+        IndexParam indexParam = IndexParam.builder()
+                .fieldName(vectorFieldName)
+                .indexType(IndexParam.IndexType.SPARSE_INVERTED_INDEX)
+                .metricType(IndexParam.MetricType.IP)
+                .extraParams(extraParams)
+                .build();
+
+        CreateCollectionReq requestCreate = CreateCollectionReq.builder()
+                .collectionName(randomCollectionName)
+                .collectionSchema(collectionSchema)
+                .indexParams(Collections.singletonList(indexParam))
+                .build();
+        client.createCollection(requestCreate);
+
+        // insert rows
+        long count = 10000;
+        List<JsonObject> data = generateRandomData(collectionSchema, count);
+        InsertResp insertResp = client.insert(InsertReq.builder()
+                .collectionName(randomCollectionName)
+                .data(data)
+                .build());
+        Assertions.assertEquals(count, insertResp.getInsertCnt());
+
+        // get row count
+        QueryResp queryResp = client.query(QueryReq.builder()
+                .collectionName(randomCollectionName)
+                .filter("")
+                .outputFields(Collections.singletonList("count(*)"))
+                .consistencyLevel(ConsistencyLevel.STRONG)
+                .build());
+        List<QueryResp.QueryResult> queryResults = queryResp.getQueryResults();
+        Assertions.assertEquals(1, queryResults.size());
+        Assertions.assertEquals(count, queryResults.get(0).getEntity().get("count(*)"));
+
+        // search in collection
+        int nq = 5;
+        int topk = 10;
+        List<Long> targetIDs = new ArrayList<>();
+        List<BaseVector> targetVectors = new ArrayList<>();
+        for (int i = 0; i < nq; i++) {
+            JsonObject row = data.get(RANDOM.nextInt((int)count));
+            targetIDs.add(row.get("id").getAsLong());
+            SortedMap<Long, Float> vector = GSON_INSTANCE.fromJson(row.get(vectorFieldName), new TypeToken<SortedMap<Long, Float>>() {}.getType());
+            targetVectors.add(new SparseFloatVec(vector));
+        }
+        SearchResp searchResp = client.search(SearchReq.builder()
+                .collectionName(randomCollectionName)
+                .annsField(vectorFieldName)
+                .data(targetVectors)
+                .topK(topk)
+                .build());
+        List<List<SearchResp.SearchResult>> searchResults = searchResp.getSearchResults();
+        Assertions.assertEquals(nq, searchResults.size());
+        for (int i = 0; i < nq; i++) {
+            List<SearchResp.SearchResult> results = searchResults.get(i);
+            Assertions.assertEquals(targetIDs.get(i), results.get(0).getId());
+        }
+
+        client.dropCollection(DropCollectionReq.builder().collectionName(randomCollectionName).build());
+    }
+
+    @Test
+    void testHybridSearch() {
+        String randomCollectionName = generator.generate(10);
+
+        CreateCollectionReq.CollectionSchema collectionSchema = baseSchema();
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("float_vector")
+                .dataType(DataType.FloatVector)
+                .dimension(dimension)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("binary_vector")
+                .dataType(DataType.BinaryVector)
+                .dimension(dimension)
+                .build());
+        collectionSchema.addField(AddFieldReq.builder()
+                .fieldName("sparse_vector")
+                .dataType(DataType.SparseFloatVector)
+                .dimension(dimension)
+                .build());
+
+        List<IndexParam> indexParams = new ArrayList<>();
+        indexParams.add(IndexParam.builder()
+                .fieldName("float_vector")
+                .indexType(IndexParam.IndexType.IVF_FLAT)
+                .metricType(IndexParam.MetricType.L2)
+                .extraParams(new HashMap<String,Object>(){{put("nlist", 64);}})
+                .build());
+        indexParams.add(IndexParam.builder()
+                .fieldName("binary_vector")
+                .indexType(IndexParam.IndexType.BIN_FLAT)
+                .metricType(IndexParam.MetricType.HAMMING)
+                .build());
+        indexParams.add(IndexParam.builder()
+                .fieldName("sparse_vector")
+                .indexType(IndexParam.IndexType.SPARSE_INVERTED_INDEX)
+                .metricType(IndexParam.MetricType.IP)
+                .extraParams(new HashMap<String,Object>(){{put("drop_ratio_build", 0.1);}})
+                .build());
+
+        CreateCollectionReq requestCreate = CreateCollectionReq.builder()
+                .collectionName(randomCollectionName)
+                .collectionSchema(collectionSchema)
+                .indexParams(indexParams)
+                .build();
+        client.createCollection(requestCreate);
+
+        // insert rows
+        long count = 10000;
+        List<JsonObject> data = generateRandomData(collectionSchema, count);
+        InsertResp insertResp = client.insert(InsertReq.builder()
+                .collectionName(randomCollectionName)
+                .data(data)
+                .build());
+        Assertions.assertEquals(count, insertResp.getInsertCnt());
+
+        // get row count
+        QueryResp queryResp = client.query(QueryReq.builder()
+                .collectionName(randomCollectionName)
+                .filter("")
+                .outputFields(Collections.singletonList("count(*)"))
+                .consistencyLevel(ConsistencyLevel.STRONG)
+                .build());
+        List<QueryResp.QueryResult> queryResults = queryResp.getQueryResults();
+        Assertions.assertEquals(1, queryResults.size());
+        Assertions.assertEquals(count, queryResults.get(0).getEntity().get("count(*)"));
+
+        // hybrid search in collection
+        int nq = 5;
+        int topk = 10;
+        List<BaseVector> floatVectors = new ArrayList<>();
+        List<BaseVector> binaryVectors = new ArrayList<>();
+        List<BaseVector> sparseVectors = new ArrayList<>();
+        for (int i = 0; i < nq; i++) {
+            floatVectors.add(new FloatVec(generateFolatVector()));
+            binaryVectors.add(new BinaryVec(generateBinaryVector()));
+            sparseVectors.add(new SparseFloatVec(generateSparseVector()));
+        }
+
+        List<AnnSearchReq> searchRequests = new ArrayList<>();
+        searchRequests.add(AnnSearchReq.builder()
+                .vectorFieldName("float_vector")
+                .vectors(floatVectors)
+                .params("{\"nprobe\": 10}")
+                .topK(10)
+                .build());
+        searchRequests.add(AnnSearchReq.builder()
+                .vectorFieldName("binary_vector")
+                .vectors(binaryVectors)
+                .topK(50)
+                .build());
+        searchRequests.add(AnnSearchReq.builder()
+                .vectorFieldName("sparse_vector")
+                .vectors(sparseVectors)
+                .topK(100)
+                .build());
+
+        HybridSearchReq hybridSearchReq = HybridSearchReq.builder()
+                .collectionName(randomCollectionName)
+                .searchRequests(searchRequests)
+                .ranker(new RRFRanker(20))
+                .topK(topk)
+                .consistencyLevel(ConsistencyLevel.BOUNDED)
+                .build();
+        SearchResp searchResp = client.hybridSearch(hybridSearchReq);
+        List<List<SearchResp.SearchResult>> searchResults = searchResp.getSearchResults();
+        Assertions.assertEquals(nq, searchResults.size());
+        for (int i = 0; i < nq; i++) {
+            List<SearchResp.SearchResult> results = searchResults.get(i);
+            Assertions.assertEquals(topk, results.size());
+        }
+
+        client.dropCollection(DropCollectionReq.builder().collectionName(randomCollectionName).build());
+    }
+}

+ 19 - 0
src/test/java/io/milvus/v2/client/MilvusClientV2Test.java

@@ -1,3 +1,22 @@
+/*
+ * 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.client;
 
 import io.milvus.v2.BaseTest;

+ 19 - 0
src/test/java/io/milvus/v2/service/collection/CollectionTest.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.v2.BaseTest;

+ 19 - 0
src/test/java/io/milvus/v2/service/index/IndexTest.java

@@ -1,3 +1,22 @@
+/*
+ * 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;
 
 import io.milvus.v2.BaseTest;

+ 19 - 0
src/test/java/io/milvus/v2/service/partition/PartitionTest.java

@@ -1,3 +1,22 @@
+/*
+ * 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.partition;
 
 import io.milvus.v2.BaseTest;

Some files were not shown because too many files changed in this diff