Przeglądaj źródła

Format with Google-java-style and add Apache 2.0 license

zhiru 5 lat temu
rodzic
commit
12fc2ead2c
28 zmienionych plików z 2675 dodań i 2213 usunięć
  1. 1 3
      .gitignore
  2. 32 9
      milvus-sdk-java.iml
  3. 50 23
      pom.xml
  4. 56 47
      src/main/java/io/milvus/client/CommandParam.java
  5. 60 48
      src/main/java/io/milvus/client/ConnectParam.java
  6. 74 60
      src/main/java/io/milvus/client/CreateIndexParam.java
  7. 47 36
      src/main/java/io/milvus/client/DateRange.java
  8. 75 57
      src/main/java/io/milvus/client/DeleteByRangeParam.java
  9. 40 21
      src/main/java/io/milvus/client/DescribeIndexResponse.java
  10. 42 22
      src/main/java/io/milvus/client/DescribeTableResponse.java
  11. 36 19
      src/main/java/io/milvus/client/GetTableRowCountResponse.java
  12. 33 18
      src/main/java/io/milvus/client/HasTableResponse.java
  13. 60 48
      src/main/java/io/milvus/client/Index.java
  14. 42 29
      src/main/java/io/milvus/client/IndexType.java
  15. 78 62
      src/main/java/io/milvus/client/InsertParam.java
  16. 34 17
      src/main/java/io/milvus/client/InsertResponse.java
  17. 33 19
      src/main/java/io/milvus/client/MetricType.java
  18. 343 300
      src/main/java/io/milvus/client/MilvusClient.java
  19. 705 665
      src/main/java/io/milvus/client/MilvusGrpcClient.java
  20. 87 76
      src/main/java/io/milvus/client/Response.java
  21. 62 48
      src/main/java/io/milvus/client/SearchInFilesParam.java
  22. 115 96
      src/main/java/io/milvus/client/SearchParam.java
  23. 85 67
      src/main/java/io/milvus/client/SearchResponse.java
  24. 36 19
      src/main/java/io/milvus/client/ShowTablesResponse.java
  25. 58 46
      src/main/java/io/milvus/client/TableParam.java
  26. 84 68
      src/main/java/io/milvus/client/TableSchema.java
  27. 59 48
      src/main/java/io/milvus/client/TableSchemaParam.java
  28. 248 242
      src/test/java/io/milvus/client/MilvusGrpcClientTest.java

+ 1 - 3
.gitignore

@@ -24,6 +24,4 @@ hs_err_pid*
 
 .idea/
 target/
-index-files/
-io/
-javadoc/
+

+ 32 - 9
milvus-sdk-java.iml

@@ -12,6 +12,34 @@
     </content>
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="library" name="Bundled Protobuf Distribution" level="application" />
+    <orderEntry type="library" name="Maven: org.apache.maven.plugins:maven-gpg-plugin:1.6" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-api:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-project:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-settings:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-profile:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-artifact-manager:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven.wagon:wagon-provider-api:1.0-beta-6" level="project" />
+    <orderEntry type="library" name="Maven: backport-util-concurrent:backport-util-concurrent:3.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-plugin-registry:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-interpolation:1.11" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1" level="project" />
+    <orderEntry type="library" name="Maven: classworlds:classworlds:1.1-alpha-2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-artifact:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-repository-metadata:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.maven:maven-model:2.2.1" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.plexus:plexus-utils:3.0.20" level="project" />
+    <orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-sec-dispatcher:1.4" level="project" />
+    <orderEntry type="library" name="Maven: org.sonatype.plexus:plexus-cipher:1.4" level="project" />
+    <orderEntry type="library" name="Maven: com.google.googlejavaformat:google-java-format:1.7" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:guava:27.0.1-jre" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:failureaccess:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
+    <orderEntry type="library" name="Maven: org.checkerframework:checker-qual:2.5.2" level="project" />
+    <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
+    <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.17" level="project" />
+    <orderEntry type="library" name="Maven: com.google.errorprone:javac-shaded:9+181-r4173-1" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: io.grpc:grpc-netty-shaded:1.24.0" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: io.grpc:grpc-core:1.24.0" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: com.google.android:annotations:4.1.1.4" level="project" />
@@ -21,22 +49,17 @@
     <orderEntry type="library" name="Maven: io.grpc:grpc-protobuf:1.24.0" level="project" />
     <orderEntry type="library" name="Maven: io.grpc:grpc-api:1.24.0" level="project" />
     <orderEntry type="library" name="Maven: io.grpc:grpc-context:1.24.0" level="project" />
-    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.2" level="project" />
-    <orderEntry type="library" name="Maven: org.codehaus.mojo:animal-sniffer-annotations:1.17" level="project" />
     <orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java:3.9.0" level="project" />
-    <orderEntry type="library" name="Maven: com.google.guava:guava:26.0-android" level="project" />
-    <orderEntry type="library" name="Maven: org.checkerframework:checker-compat-qual:2.5.2" level="project" />
-    <orderEntry type="library" name="Maven: com.google.j2objc:j2objc-annotations:1.1" level="project" />
     <orderEntry type="library" name="Maven: com.google.api.grpc:proto-google-common-protos:1.12.0" level="project" />
     <orderEntry type="library" name="Maven: io.grpc:grpc-protobuf-lite:1.24.0" level="project" />
     <orderEntry type="library" name="Maven: io.grpc:grpc-stub:1.24.0" level="project" />
     <orderEntry type="library" scope="PROVIDED" name="Maven: javax.annotation:javax.annotation-api:1.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: io.grpc:grpc-testing:1.24.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
-    <orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java-util:3.9.0" level="project" />
+    <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
+    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
+    <orderEntry type="library" name="Maven: com.google.protobuf:protobuf-java-util:3.10.0" level="project" />
     <orderEntry type="library" name="Maven: com.google.errorprone:error_prone_annotations:2.3.2" level="project" />
-    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.7" level="project" />
+    <orderEntry type="library" name="Maven: com.google.code.gson:gson:2.8.5" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter:5.5.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.5.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.0" level="project" />

+ 50 - 23
pom.xml

@@ -6,12 +6,12 @@
 
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>0.1.0-SNAPSHOT</version>
+    <version>0.1.0</version>
     <packaging>jar</packaging>
 
-    <name>milvus-sdk-java</name>
+    <name>io.milvus:milvus-sdk-java</name>
     <description>Java SDK for Milvus distributed high-performance vector search engine.</description>
-    <url>https://www.milvus.io/</url>
+    <url>https://github.com/milvus-io/milvus-sdk-java</url>
 
     <licenses>
         <license>
@@ -21,6 +21,15 @@
         </license>
     </licenses>
 
+    <developers>
+        <developer>
+            <name>Zhiru Zhu</name>
+            <email>zhiru.zhu@zilliz.com</email>
+            <organization>Milvus</organization>
+            <organizationUrl>http://www.milvus.io</organizationUrl>
+        </developer>
+    </developers>
+
     <scm>
         <connection>scm:git:https://github.com/milvus-io/milvus-sdk-java.git</connection>
         <developerConnection>scm:git:https://github.com/milvus-io/milvus-sdk-java.git</developerConnection>
@@ -37,8 +46,8 @@
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <grpc.version>1.24.0</grpc.version>
-        <protobuf.version>3.9.0</protobuf.version>
-        <protoc.version>3.9.0</protoc.version>
+        <protobuf.version>3.10.0</protobuf.version>
+        <protoc.version>3.10.0</protoc.version>
         <maven.compiler.source>1.8</maven.compiler.source>
         <maven.compiler.target>1.8</maven.compiler.target>
     </properties>
@@ -56,6 +65,16 @@
     </dependencyManagement>
 
     <dependencies>
+        <dependency>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-gpg-plugin</artifactId>
+            <version>1.6</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.googlejavaformat</groupId>
+            <artifactId>google-java-format</artifactId>
+            <version>1.7</version>
+        </dependency>
         <dependency>
             <groupId>io.grpc</groupId>
             <artifactId>grpc-netty-shaded</artifactId>
@@ -103,17 +122,6 @@
             <id>release</id>
             <build>
                 <plugins>
-                    <plugin>
-                        <groupId>org.sonatype.plugins</groupId>
-                        <artifactId>nexus-staging-maven-plugin</artifactId>
-                        <version>1.6.8</version>
-                        <extensions>true</extensions>
-                        <configuration>
-                            <serverId>ossrh</serverId>
-                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
-                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
-                        </configuration>
-                    </plugin>
                     <plugin>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-source-plugin</artifactId>
@@ -168,6 +176,17 @@
             </extension>
         </extensions>
         <plugins>
+            <plugin>
+                <groupId>org.sonatype.plugins</groupId>
+                <artifactId>nexus-staging-maven-plugin</artifactId>
+                <version>1.6.8</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <serverId>ossrh</serverId>
+                    <nexusUrl>https://oss.sonatype.org/</nexusUrl>
+                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
+                </configuration>
+            </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-release-plugin</artifactId>
@@ -184,9 +203,11 @@
                 <artifactId>protobuf-maven-plugin</artifactId>
                 <version>0.6.1</version>
                 <configuration>
-                    <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}</protocArtifact>
+                    <protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
+                    </protocArtifact>
                     <pluginId>grpc-java</pluginId>
-                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
+                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
+                    </pluginArtifact>
                 </configuration>
                 <executions>
                     <execution>
@@ -200,18 +221,24 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-enforcer-plugin</artifactId>
-                <version>1.4.1</version>
+                <version>3.0.0-M2</version>
                 <executions>
                     <execution>
                         <id>enforce</id>
-                        <goals>
-                            <goal>enforce</goal>
-                        </goals>
                         <configuration>
                             <rules>
-                                <requireUpperBoundDeps/>
+                                <requireUpperBoundDeps>
+                                    <excludes>
+                                        <exclude>com.google.guava:guava</exclude>
+                                        <exclude>com.google.errorprone:error_prone_annotations</exclude>
+                                        <exclude>com.google.protobuf:protobuf-java</exclude>
+                                    </excludes>
+                                </requireUpperBoundDeps>
                             </rules>
                         </configuration>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
                     </execution>
                 </executions>
             </plugin>

+ 56 - 47
src/main/java/io/milvus/client/CommandParam.java

@@ -1,65 +1,74 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Contains parameters for <code>command</code>
- */
+/** Contains parameters for <code>command</code> */
 class CommandParam {
-    private final String command;
-    private final long timeout;
+  private final String command;
+  private final long timeout;
 
-    /**
-     * Builder for <code>CommandParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final String command;
+  private CommandParam(@Nonnull Builder builder) {
+    this.command = builder.command;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private long timeout = 86400;
+  String getCommand() {
+    return command;
+  }
 
-        /**
-         * @param command a string command
-         */
-        public Builder(@Nonnull String command) {
-            this.command = command;
-        }
+  long getTimeout() {
+    return timeout;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  @Override
+  public String toString() {
+    return "CommandParam {" + "command='" + command + '\'' + ", timeout=" + timeout + '}';
+  }
 
-        public CommandParam build() {
-            return new CommandParam(this);
-        }
-    }
+  /** Builder for <code>CommandParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final String command;
 
-    private CommandParam(@Nonnull Builder builder) {
-        this.command = builder.command;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private long timeout = 86400;
 
-    String getCommand() {
-        return command;
+    /** @param command a string command */
+    public Builder(@Nonnull String command) {
+      this.command = command;
     }
 
-    long getTimeout() {
-        return timeout;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "CommandParam {" +
-                "command='" + command + '\'' +
-                ", timeout=" + timeout +
-                '}';
+    public CommandParam build() {
+      return new CommandParam(this);
     }
+  }
 }

+ 60 - 48
src/main/java/io/milvus/client/ConnectParam.java

@@ -1,65 +1,77 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Contains parameters for connecting to Milvus server
- */
+/** Contains parameters for connecting to Milvus server */
 public class ConnectParam {
-    private final String host;
-    private final String port;
+  private final String host;
+  private final String port;
 
-    /**
-     * Builder for <code>ConnectParam</code>
-     */
-    public static class Builder {
-        // Optional parameters - initialized to default values
-        private String host = "127.0.0.1";
-        private String port = "19530";
+  private ConnectParam(@Nonnull Builder builder) {
+    this.host = builder.host;
+    this.port = builder.port;
+  }
 
-        /**
-         * Optional. Default to "127.0.0.1".
-         * @param host server host
-         * @return <code>Builder</code>
-         */
-        public Builder withHost(@Nonnull String host) {
-            this.host = host;
-            return this;
-        }
+  public String getHost() {
+    return host;
+  }
 
-        /**
-         * Optional. Default to "19530".
-         * @param port server port
-         * @return <code>Builder</code>
-         */
-        public Builder withPort(@Nonnull String port) {
-            this.port = port;
-            return this;
-        }
+  public String getPort() {
+    return port;
+  }
 
-        public ConnectParam build() {
-            return new ConnectParam(this);
-        }
-    }
+  @Override
+  public String toString() {
+    return "ConnectParam {" + "host='" + host + '\'' + ", port='" + port + '\'' + '}';
+  }
 
-    private ConnectParam(@Nonnull Builder builder) {
-        this.host = builder.host;
-        this.port = builder.port;
-    }
+  /** Builder for <code>ConnectParam</code> */
+  public static class Builder {
+    // Optional parameters - initialized to default values
+    private String host = "127.0.0.1";
+    private String port = "19530";
 
-    public String getHost() {
-        return host;
+    /**
+     * Optional. Default to "127.0.0.1".
+     *
+     * @param host server host
+     * @return <code>Builder</code>
+     */
+    public Builder withHost(@Nonnull String host) {
+      this.host = host;
+      return this;
     }
 
-    public String getPort() {
-        return port;
+    /**
+     * Optional. Default to "19530".
+     *
+     * @param port server port
+     * @return <code>Builder</code>
+     */
+    public Builder withPort(@Nonnull String port) {
+      this.port = port;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "ConnectParam {" +
-                "host='" + host + '\'' +
-                ", port='" + port + '\'' +
-                '}';
+    public ConnectParam build() {
+      return new ConnectParam(this);
     }
+  }
 }

+ 74 - 60
src/main/java/io/milvus/client/CreateIndexParam.java

@@ -1,82 +1,96 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Contains parameters for <code>createIndex</code>
- */
+/** Contains parameters for <code>createIndex</code> */
 public class CreateIndexParam {
 
-    private final String tableName;
-    private final Index index;
-    private final long timeout;
+  private final String tableName;
+  private final Index index;
+  private final long timeout;
 
-    /**
-     * Builder for <code>CreateIndexParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final String tableName;
+  private CreateIndexParam(@Nonnull Builder builder) {
+    this.tableName = builder.tableName;
+    this.index = builder.index;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private Index index;
-        private long timeout = 86400;
+  public String getTableName() {
+    return tableName;
+  }
 
-        /**
-         * @param tableName table to create index on
-         */
-        public Builder(@Nonnull String tableName) {
-            this.tableName = tableName;
-        }
+  public Index getIndex() {
+    return index;
+  }
 
-        /**
-         * Optional. Default to Index{indexType = IndexType.FLAT, nList = 16384}
-         * @param index a <code>Index</code> object
-         * @return <code>Builder</code>
-         * @see Index
-         */
-        public Builder withIndex(Index index) {
-            this.index = index;
-            return this;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-         /**
-          * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-          * Default to 86400s (1 day).
-          * @param timeout in seconds
-          * @return <code>Builder</code>
-          */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  @Override
+  public String toString() {
+    return String.format(
+        "IndexParam = {tableName = %s, index = {indexType = %s, nList = %d}, timeout = %d}",
+        tableName, index.getIndexType().name(), index.getNList(), timeout);
+  }
 
-        public CreateIndexParam build() {
-            return new CreateIndexParam(this);
-        }
-    }
+  /** Builder for <code>CreateIndexParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final String tableName;
 
-    private CreateIndexParam(@Nonnull Builder builder) {
-        this.tableName = builder.tableName;
-        this.index = builder.index;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private Index index;
+    private long timeout = 86400;
 
-    public String getTableName() {
-        return tableName;
+    /** @param tableName table to create index on */
+    public Builder(@Nonnull String tableName) {
+      this.tableName = tableName;
     }
 
-    public Index getIndex() {
-        return index;
+    /**
+     * Optional. Default to Index{indexType = IndexType.FLAT, nList = 16384}
+     *
+     * @param index a <code>Index</code> object
+     * @return <code>Builder</code>
+     * @see Index
+     */
+    public Builder withIndex(Index index) {
+      this.index = index;
+      return this;
     }
 
-    public long getTimeout() {
-        return timeout;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return String.format("IndexParam = {tableName = %s, index = {indexType = %s, nList = %d}, timeout = %d}",
-                                tableName, index.getIndexType().name(), index.getNList(), timeout);
+    public CreateIndexParam build() {
+      return new CreateIndexParam(this);
     }
+  }
 }

+ 47 - 36
src/main/java/io/milvus/client/DateRange.java

@@ -1,43 +1,54 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 import java.util.Date;
 
-/**
- * Represents a date range [<code>startDate</code>, <code>endDate</code>)
- */
+/** Represents a date range [<code>startDate</code>, <code>endDate</code>) */
 public class DateRange {
-    private Date startDate;
-    private Date endDate;
-
-    /**
-     * @see Date
-     */
-    public DateRange(@Nonnull Date startDate, @Nonnull Date endDate) {
-        this.startDate = startDate;
-        this.endDate = endDate;
-    }
-
-    public void setStartDate(@Nonnull Date startDate) {
-        this.startDate = startDate;
-    }
-
-    public void setEndDate(@Nonnull Date endDate) {
-        this.endDate = endDate;
-    }
-
-    public Date getStartDate() {
-        return startDate;
-    }
-
-    public Date getEndDate() {
-        return endDate;
-    }
-
-    @Override
-    public String toString() {
-        return "{startDate=" + startDate +
-                ", endDate=" + endDate +
-                '}';
-    }
+  private Date startDate;
+  private Date endDate;
+
+  /** @see Date */
+  public DateRange(@Nonnull Date startDate, @Nonnull Date endDate) {
+    this.startDate = startDate;
+    this.endDate = endDate;
+  }
+
+  public Date getStartDate() {
+    return startDate;
+  }
+
+  public void setStartDate(@Nonnull Date startDate) {
+    this.startDate = startDate;
+  }
+
+  public Date getEndDate() {
+    return endDate;
+  }
+
+  public void setEndDate(@Nonnull Date endDate) {
+    this.endDate = endDate;
+  }
+
+  @Override
+  public String toString() {
+    return "{startDate=" + startDate + ", endDate=" + endDate + '}';
+  }
 }

+ 75 - 57
src/main/java/io/milvus/client/DeleteByRangeParam.java

@@ -1,76 +1,94 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Contains parameters for <code>deleteByRange</code>
- */
+/** Contains parameters for <code>deleteByRange</code> */
 public class DeleteByRangeParam {
-    private final DateRange dateRange;
-    private final String tableName;
-    private final long timeout;
+  private final DateRange dateRange;
+  private final String tableName;
+  private final long timeout;
 
-    /**
-     * Builder for <code>DeleteByRangeParam</code>
-     */
-    public static final class Builder {
-        // Required parameters
-        private final DateRange dateRange;
-        private final String tableName;
+  private DeleteByRangeParam(@Nonnull Builder builder) {
+    this.dateRange = builder.dateRange;
+    this.tableName = builder.tableName;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private long timeout = 86400;
+  public DateRange getDateRange() {
+    return dateRange;
+  }
 
-        /**
-         * @param dateRange a <code>DateRange</code> object
-         * @param tableName table to delete from
-         * @see DateRange
-         */
-        public Builder(@Nonnull DateRange dateRange, @Nonnull String tableName) {
-            this.dateRange = dateRange;
-            this.tableName = tableName;
-        }
+  public String getTableName() {
+    return tableName;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-        public DeleteByRangeParam build() {
-            return new DeleteByRangeParam(this);
-        }
-    }
+  @Override
+  public String toString() {
+    return "DeleteByRangeParam {"
+        + "dateRange = "
+        + dateRange.toString()
+        + ", tableName = '"
+        + tableName
+        + '\''
+        + ", timeout = "
+        + timeout
+        + '}';
+  }
 
-    private DeleteByRangeParam(@Nonnull Builder builder) {
-        this.dateRange = builder.dateRange;
-        this.tableName = builder.tableName;
-        this.timeout = builder.timeout;
-    }
+  /** Builder for <code>DeleteByRangeParam</code> */
+  public static final class Builder {
+    // Required parameters
+    private final DateRange dateRange;
+    private final String tableName;
 
-    public DateRange getDateRange() {
-        return dateRange;
-    }
+    // Optional parameters - initialized to default values
+    private long timeout = 86400;
 
-    public String getTableName() {
-        return tableName;
+    /**
+     * @param dateRange a <code>DateRange</code> object
+     * @param tableName table to delete from
+     * @see DateRange
+     */
+    public Builder(@Nonnull DateRange dateRange, @Nonnull String tableName) {
+      this.dateRange = dateRange;
+      this.tableName = tableName;
     }
 
-    public long getTimeout() {
-        return timeout;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "DeleteByRangeParam {" +
-                "dateRange = " + dateRange.toString() +
-                ", tableName = '" + tableName + '\'' +
-                ", timeout = " + timeout +
-                '}';
+    public DeleteByRangeParam build() {
+      return new DeleteByRangeParam(this);
     }
+  }
 }

+ 40 - 21
src/main/java/io/milvus/client/DescribeIndexResponse.java

@@ -1,3 +1,20 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nullable;
@@ -7,29 +24,31 @@ import java.util.Optional;
  * Contains the returned <code>response</code> and <code>index</code> for <code>describeIndex</code>
  */
 public class DescribeIndexResponse {
-    private final Response response;
-    private final Index index;
+  private final Response response;
+  private final Index index;
 
-    public DescribeIndexResponse(Response response, @Nullable Index index) {
-        this.response = response;
-        this.index = index;
-    }
+  public DescribeIndexResponse(Response response, @Nullable Index index) {
+    this.response = response;
+    this.index = index;
+  }
 
-    /**
-     * @return an <code>Optional</code> object which may or may not contain an <code>Index</code> object
-     * @see Optional
-     */
-    public Optional<Index> getIndex() {
-        return Optional.ofNullable(index);
-    }
+  /**
+   * @return an <code>Optional</code> object which may or may not contain an <code>Index</code>
+   *     object
+   * @see Optional
+   */
+  public Optional<Index> getIndex() {
+    return Optional.ofNullable(index);
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("DescribeIndexResponse {%s, %s}", response.toString(),
-                             index == null ? "Index = Null" : index.toString());
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "DescribeIndexResponse {%s, %s}",
+        response.toString(), index == null ? "Index = Null" : index.toString());
+  }
 }

+ 42 - 22
src/main/java/io/milvus/client/DescribeTableResponse.java

@@ -1,35 +1,55 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nullable;
 import java.util.Optional;
 
 /**
- * Contains the returned <code>response</code> and <code>tableSchema</code> for <code>describeTable</code>
+ * Contains the returned <code>response</code> and <code>tableSchema</code> for <code>describeTable
+ * </code>
  */
 public class DescribeTableResponse {
-    private final Response response;
-    private final TableSchema tableSchema;
+  private final Response response;
+  private final TableSchema tableSchema;
 
-    public DescribeTableResponse(Response response, @Nullable TableSchema tableSchema) {
-        this.response = response;
-        this.tableSchema = tableSchema;
-    }
+  public DescribeTableResponse(Response response, @Nullable TableSchema tableSchema) {
+    this.response = response;
+    this.tableSchema = tableSchema;
+  }
 
-    /**
-     * @return an <code>Optional</code> object which may or may not contain a <code>TableSchema</code> object
-     * @see Optional
-     */
-    public Optional<TableSchema> getTableSchema() {
-        return Optional.ofNullable(tableSchema);
-    }
+  /**
+   * @return an <code>Optional</code> object which may or may not contain a <code>TableSchema</code>
+   *     object
+   * @see Optional
+   */
+  public Optional<TableSchema> getTableSchema() {
+    return Optional.ofNullable(tableSchema);
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("DescribeTableResponse {%s, %s}", response.toString(),
-                              tableSchema == null ? "Table schema = None" : tableSchema.toString());
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "DescribeTableResponse {%s, %s}",
+        response.toString(), tableSchema == null ? "Table schema = None" : tableSchema.toString());
+  }
 }

+ 36 - 19
src/main/java/io/milvus/client/GetTableRowCountResponse.java

@@ -1,29 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package io.milvus.client;
 
 /**
- * Contains the returned <code>response</code> and <code>tableRowCount</code> for <code>getTableRowCount</code>
+ * Contains the returned <code>response</code> and <code>tableRowCount</code> for <code>
+ * getTableRowCount</code>
  */
 public class GetTableRowCountResponse {
-    private final Response response;
-    private final long tableRowCount;
+  private final Response response;
+  private final long tableRowCount;
 
-    public GetTableRowCountResponse(Response response, long tableRowCount) {
-        this.response = response;
-        this.tableRowCount = tableRowCount;
-    }
+  public GetTableRowCountResponse(Response response, long tableRowCount) {
+    this.response = response;
+    this.tableRowCount = tableRowCount;
+  }
 
-    public long getTableRowCount() {
-        return tableRowCount;
-    }
+  public long getTableRowCount() {
+    return tableRowCount;
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("CountTableResponse {%s, table row count = %d}",
-                              response.toString(),
-                              tableRowCount);
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "CountTableResponse {%s, table row count = %d}", response.toString(), tableRowCount);
+  }
 }

+ 33 - 18
src/main/java/io/milvus/client/HasTableResponse.java

@@ -1,29 +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.client;
 
 /**
  * Contains the returned <code>response</code> and <code>hasTable</code> for <code>hasTable</code>
  */
 public class HasTableResponse {
-    private final Response response;
-    private final boolean hasTable;
+  private final Response response;
+  private final boolean hasTable;
 
-    public HasTableResponse(Response response, boolean hasTable) {
-        this.response = response;
-        this.hasTable = hasTable;
-    }
+  public HasTableResponse(Response response, boolean hasTable) {
+    this.response = response;
+    this.hasTable = hasTable;
+  }
 
-    public boolean hasTable() {
-        return hasTable;
-    }
+  public boolean hasTable() {
+    return hasTable;
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("HasTableResponse {%s, has table = %s}",
-                              response.toString(),
-                              hasTable);
-    }
+  @Override
+  public String toString() {
+    return String.format("HasTableResponse {%s, has table = %s}", response.toString(), hasTable);
+  }
 }

+ 60 - 48
src/main/java/io/milvus/client/Index.java

@@ -1,65 +1,77 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Represents an index containing <code>indexType</code> and <code>nList</code>
- */
+/** Represents an index containing <code>indexType</code> and <code>nList</code> */
 public class Index {
-    private final IndexType indexType;
-    private final int nList;
+  private final IndexType indexType;
+  private final int nList;
 
-    /**
-     * Builder for <code>Index</code>
-     */
-    public static class Builder {
-        // Optional parameters - initialized to default values
-        private IndexType indexType = IndexType.FLAT;
-        private int nList = 16384;
+  private Index(@Nonnull Builder builder) {
+    this.indexType = builder.indexType;
+    this.nList = builder.nList;
+  }
 
-        /**
-         * Optional. Default to <code>IndexType.FLAT</code>
-         * @param indexType a <code>IndexType</code> object
-         * @return <code>Builder</code>
-         */
-        public Builder withIndexType(@Nonnull IndexType indexType) {
-            this.indexType = indexType;
-            return this;
-        }
+  public IndexType getIndexType() {
+    return indexType;
+  }
 
-        /**
-         * Optional. Default to 16384.
-         * @param nList nList of the index
-         * @return <code>Builder</code>
-         */
-        public Builder withNList(int nList) {
-            this.nList = nList;
-            return this;
-        }
+  public int getNList() {
+    return nList;
+  }
 
-        public Index build() {
-            return new Index(this);
-        }
-    }
+  @Override
+  public String toString() {
+    return "Index {" + "indexType=" + indexType + ", nList=" + nList + '}';
+  }
 
-    private Index(@Nonnull Builder builder) {
-        this.indexType = builder.indexType;
-        this.nList = builder.nList;
-    }
+  /** Builder for <code>Index</code> */
+  public static class Builder {
+    // Optional parameters - initialized to default values
+    private IndexType indexType = IndexType.FLAT;
+    private int nList = 16384;
 
-    public IndexType getIndexType() {
-        return indexType;
+    /**
+     * Optional. Default to <code>IndexType.FLAT</code>
+     *
+     * @param indexType a <code>IndexType</code> object
+     * @return <code>Builder</code>
+     */
+    public Builder withIndexType(@Nonnull IndexType indexType) {
+      this.indexType = indexType;
+      return this;
     }
 
-    public int getNList() {
-        return nList;
+    /**
+     * Optional. Default to 16384.
+     *
+     * @param nList nList of the index
+     * @return <code>Builder</code>
+     */
+    public Builder withNList(int nList) {
+      this.nList = nList;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "Index {" +
-                "indexType=" + indexType +
-                ", nList=" + nList +
-                '}';
+    public Index build() {
+      return new Index(this);
     }
+  }
 }

+ 42 - 29
src/main/java/io/milvus/client/IndexType.java

@@ -1,36 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package io.milvus.client;
 
 import java.util.Arrays;
 import java.util.Optional;
 
-/**
- * Represents available index types
- */
+/** Represents available index types */
 public enum IndexType {
-
-    INVALID(0),
-    FLAT(1),
-    IVFLAT(2),
-    IVF_SQ8(3),
-    MIX_NSG(4),
-    IVF_SQ8_H(5),
-
-    UNKNOWN(-1);
-
-    private final int val;
-
-    IndexType(int val) {
-        this.val = val;
-    }
-
-    public int getVal() {
-        return val;
-    }
-
-    public static IndexType valueOf(int val) {
-        Optional<IndexType> search = Arrays.stream(values())
-                                           .filter(indexType -> indexType.val == val)
-                                           .findFirst();
-        return search.orElse(UNKNOWN);
-    }
+  INVALID(0),
+  FLAT(1),
+  IVFLAT(2),
+  IVF_SQ8(3),
+  MIX_NSG(4),
+  IVF_SQ8_H(5),
+
+  UNKNOWN(-1);
+
+  private final int val;
+
+  IndexType(int val) {
+    this.val = val;
+  }
+
+  public static IndexType valueOf(int val) {
+    Optional<IndexType> search =
+        Arrays.stream(values()).filter(indexType -> indexType.val == val).findFirst();
+    return search.orElse(UNKNOWN);
+  }
+
+  public int getVal() {
+    return val;
+  }
 }

+ 78 - 62
src/main/java/io/milvus/client/InsertParam.java

@@ -1,85 +1,101 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * Contains parameters for <code>insert</code>
- */
+/** Contains parameters for <code>insert</code> */
 public class InsertParam {
-    private final String tableName;
-    private final List<List<Float>> vectors;
-    private final List<Long> vectorIds;
-    private final long timeout;
+  private final String tableName;
+  private final List<List<Float>> vectors;
+  private final List<Long> vectorIds;
+  private final long timeout;
 
-    /**
-     * Builder for <code>InsertParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final String tableName;
-        private final List<List<Float>> vectors;
+  private InsertParam(@Nonnull Builder builder) {
+    this.tableName = builder.tableName;
+    this.vectors = builder.vectors;
+    this.vectorIds = builder.vectorIds;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private List<Long> vectorIds = new ArrayList<>();
-        private long timeout = 86400;
+  public String getTableName() {
+    return tableName;
+  }
 
-        /**
-         * @param tableName table to insert vectors to
-         * @param vectors a <code>List</code> of vectors to insert. Each inner <code>List</code> represents a vector.
-         */
-        public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> vectors) {
-            this.tableName = tableName;
-            this.vectors = vectors;
-        }
+  public List<List<Float>> getVectors() {
+    return vectors;
+  }
 
-        /**
-         * Optional. Default to an empty <code>ArrayList</code>
-         * @param vectorIds a <code>List</code> of ids associated with the vectors to insert
-         * @return <code>Builder</code>
-         */
-        public Builder withVectorIds(@Nonnull List<Long> vectorIds) {
-            this.vectorIds = vectorIds;
-            return this;
-        }
+  public List<Long> getVectorIds() {
+    return vectorIds;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-        public InsertParam build() {
-            return new InsertParam(this);
-        }
-    }
+  /** Builder for <code>InsertParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final String tableName;
+    private final List<List<Float>> vectors;
 
-    private InsertParam(@Nonnull Builder builder) {
-        this.tableName = builder.tableName;
-        this.vectors = builder.vectors;
-        this.vectorIds = builder.vectorIds;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private List<Long> vectorIds = new ArrayList<>();
+    private long timeout = 86400;
 
-    public String getTableName() {
-        return tableName;
+    /**
+     * @param tableName table to insert vectors to
+     * @param vectors a <code>List</code> of vectors to insert. Each inner <code>List</code>
+     *     represents a vector.
+     */
+    public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> vectors) {
+      this.tableName = tableName;
+      this.vectors = vectors;
     }
 
-    public List<List<Float>> getVectors() {
-        return vectors;
+    /**
+     * Optional. Default to an empty <code>ArrayList</code>
+     *
+     * @param vectorIds a <code>List</code> of ids associated with the vectors to insert
+     * @return <code>Builder</code>
+     */
+    public Builder withVectorIds(@Nonnull List<Long> vectorIds) {
+      this.vectorIds = vectorIds;
+      return this;
     }
 
-    public List<Long> getVectorIds() {
-        return vectorIds;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    public long getTimeout() {
-        return timeout;
+    public InsertParam build() {
+      return new InsertParam(this);
     }
+  }
 }

+ 34 - 17
src/main/java/io/milvus/client/InsertResponse.java

@@ -1,3 +1,20 @@
+/*
+ * 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.client;
 
 import java.util.List;
@@ -6,25 +23,25 @@ import java.util.List;
  * Contains the returned <code>response</code> and <code>vectorIds</code> for <code>insert</code>
  */
 public class InsertResponse {
-    private final Response response;
-    private final List<Long> vectorIds;
+  private final Response response;
+  private final List<Long> vectorIds;
 
-    public InsertResponse(Response response, List<Long> vectorIds) {
-        this.response = response;
-        this.vectorIds = vectorIds;
-    }
+  public InsertResponse(Response response, List<Long> vectorIds) {
+    this.response = response;
+    this.vectorIds = vectorIds;
+  }
 
-    public List<Long> getVectorIds() {
-        return vectorIds;
-    }
+  public List<Long> getVectorIds() {
+    return vectorIds;
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("InsertResponse {%s, returned %d vector ids}",
-                              response.toString(), this.vectorIds.size());
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "InsertResponse {%s, returned %d vector ids}", response.toString(), this.vectorIds.size());
+  }
 }

+ 33 - 19
src/main/java/io/milvus/client/MetricType.java

@@ -1,31 +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.client;
 
 import java.util.Arrays;
 import java.util.Optional;
 
-/**
- * Represents available metric types
- */
+/** Represents available metric types */
 public enum MetricType {
-    L2(1),
-    IP(2),
+  L2(1),
+  IP(2),
 
-    UNKNOWN(-1);
+  UNKNOWN(-1);
 
-    private final int val;
+  private final int val;
 
-    MetricType(int val) {
-        this.val = val;
-    }
+  MetricType(int val) {
+    this.val = val;
+  }
 
-    public int getVal() {
-        return val;
-    }
+  public static MetricType valueOf(int val) {
+    Optional<MetricType> search =
+        Arrays.stream(values()).filter(metricType -> metricType.val == val).findFirst();
+    return search.orElse(UNKNOWN);
+  }
 
-    public static MetricType valueOf(int val) {
-        Optional<MetricType> search = Arrays.stream(values())
-                                     .filter(metricType -> metricType.val == val)
-                                     .findFirst();
-        return search.orElse(UNKNOWN);
-    }
+  public int getVal() {
+    return val;
+  }
 }

+ 343 - 300
src/main/java/io/milvus/client/MilvusClient.java

@@ -1,325 +1,368 @@
+/*
+ * 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.client;
 
-/**
- * The Milvus Client Interface
- */
+/** The Milvus Client Interface */
 public interface MilvusClient {
 
-    String clientVersion = "0.1.0";
+  String clientVersion = "0.1.0";
 
-    /**
-     * @return the current Milvus client version
-     */
-    default String clientVersion() {
-        return clientVersion;
-    }
+  /** @return the current Milvus client version */
+  default String clientVersion() {
+    return clientVersion;
+  }
 
-    /**
-     * Connects to Milvus server
-     * @param connectParam the <code>ConnectParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * ConnectParam connectParam = new ConnectParam.Builder()
-     *                                             .withHost("localhost")
-     *                                             .withPort("19530")
-     *                                             .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see ConnectParam
-     * @see Response
-     */
-    Response connect(ConnectParam connectParam);
+  /**
+   * Connects to Milvus server
+   *
+   * @param connectParam the <code>ConnectParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * ConnectParam connectParam = new ConnectParam.Builder()
+   *                                             .withHost("localhost")
+   *                                             .withPort("19530")
+   *                                             .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see ConnectParam
+   * @see Response
+   */
+  Response connect(ConnectParam connectParam);
 
-    /**
-     * @return <code>true</code> if the client is connected to Milvus server
-     */
-    boolean connected();
+  /** @return <code>true</code> if the client is connected to Milvus server */
+  boolean connected();
 
-    /**
-     * Disconnects from Milvus server
-     * @return <code>Response</code>
-     * @throws InterruptedException
-     * @see Response
-     */
-    Response disconnect() throws InterruptedException;
+  /**
+   * Disconnects from Milvus server
+   *
+   * @return <code>Response</code>
+   * @throws InterruptedException
+   * @see Response
+   */
+  Response disconnect() throws InterruptedException;
 
-    /**
-     * Creates table specified by <code>tableSchemaParam</code>
-     * @param tableSchemaParam the <code>TableSchemaParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
-     *                                          .withIndexFileSize(1024)
-     *                                          .withMetricType(MetricType.IP)
-     *                                          .build();
-     * TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema)
-     *                                                         .withTimeout(timeout)
-     *                                                         .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see TableSchema
-     * @see TableSchemaParam
-     * @see MetricType
-     * @see Response
-     */
-    Response createTable(TableSchemaParam tableSchemaParam);
+  /**
+   * Creates table specified by <code>tableSchemaParam</code>
+   *
+   * @param tableSchemaParam the <code>TableSchemaParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
+   *                                          .withIndexFileSize(1024)
+   *                                          .withMetricType(MetricType.IP)
+   *                                          .build();
+   * TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema)
+   *                                                         .withTimeout(timeout)
+   *                                                         .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see TableSchema
+   * @see TableSchemaParam
+   * @see MetricType
+   * @see Response
+   */
+  Response createTable(TableSchemaParam tableSchemaParam);
 
-    /**
-     * Check whether the table specified by <code>tableParam</code> exists
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>HasTableResponse</code>
-     * @see TableParam
-     * @see HasTableResponse
-     * @see Response
-     */
-    HasTableResponse hasTable(TableParam tableParam);
+  /**
+   * Check whether the table specified by <code>tableParam</code> exists
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>HasTableResponse</code>
+   * @see TableParam
+   * @see HasTableResponse
+   * @see Response
+   */
+  HasTableResponse hasTable(TableParam tableParam);
 
-    /**
-     * Drops the table specified by <code>tableParam</code>
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see TableParam
-     * @see Response
-     */
-    Response dropTable(TableParam tableParam);
+  /**
+   * Drops the table specified by <code>tableParam</code>
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see TableParam
+   * @see Response
+   */
+  Response dropTable(TableParam tableParam);
 
-    /**
-     * Creates index specified by <code>indexParam</code>
-     * @param createIndexParam the <code>IndexParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * Index index = new Index.Builder()
-     *                        .withIndexType(IndexType.IVF_SQ8)
-     *                        .withNList(16384)
-     *                        .build();
-     * IndexParam indexParam = new IndexParam.Builder(tableName)
-     *                                       .withIndex(index)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see Index
-     * @see CreateIndexParam
-     * @see IndexType
-     * @see Response
-     */
-    Response createIndex(CreateIndexParam createIndexParam);
+  /**
+   * Creates index specified by <code>indexParam</code>
+   *
+   * @param createIndexParam the <code>IndexParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * Index index = new Index.Builder()
+   *                        .withIndexType(IndexType.IVF_SQ8)
+   *                        .withNList(16384)
+   *                        .build();
+   * IndexParam indexParam = new IndexParam.Builder(tableName)
+   *                                       .withIndex(index)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see Index
+   * @see CreateIndexParam
+   * @see IndexType
+   * @see Response
+   */
+  Response createIndex(CreateIndexParam createIndexParam);
 
-    /**
-     * Inserts data specified by <code>insertParam</code>
-     * @param insertParam the <code>InsertParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * InsertParam insertParam = new InsertParam.Builder(tableName, vectors)
-     *                                          .withVectorIds(vectorIds)
-     *                                          .withTimeout(timeout)
-     *                                          .build();
-     * </code>
-     * </pre>
-     * @return <code>InsertResponse</code>
-     * @see InsertParam
-     * @see InsertResponse
-     * @see Response
-     */
-    InsertResponse insert(InsertParam insertParam);
+  /**
+   * Inserts data specified by <code>insertParam</code>
+   *
+   * @param insertParam the <code>InsertParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * InsertParam insertParam = new InsertParam.Builder(tableName, vectors)
+   *                                          .withVectorIds(vectorIds)
+   *                                          .withTimeout(timeout)
+   *                                          .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>InsertResponse</code>
+   * @see InsertParam
+   * @see InsertResponse
+   * @see Response
+   */
+  InsertResponse insert(InsertParam insertParam);
 
-    /**
-     * Searches vectors specified by <code>searchParam</code>
-     * @param searchParam the <code>SearchParam</code> object
-     * <pre>
-     * example usage:                   
-     * <code>
-     * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
-     *                                          .withTopK(topK)
-     *                                          .withNProbe(nProbe)
-     *                                          .withDateRanges(dateRanges)
-     *                                          .withTimeout(timeout)                      
-     *                                          .build();
-     * </code>
-     * </pre>
-     * @return <code>SearchResponse</code>
-     * @see SearchParam
-     * @see DateRange
-     * @see SearchResponse
-     * @see SearchResponse.QueryResult
-     * @see Response
-     */
-    SearchResponse search(SearchParam searchParam);
+  /**
+   * Searches vectors specified by <code>searchParam</code>
+   *
+   * @param searchParam the <code>SearchParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
+   *                                          .withTopK(topK)
+   *                                          .withNProbe(nProbe)
+   *                                          .withDateRanges(dateRanges)
+   *                                          .withTimeout(timeout)
+   *                                          .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>SearchResponse</code>
+   * @see SearchParam
+   * @see DateRange
+   * @see SearchResponse
+   * @see SearchResponse.QueryResult
+   * @see Response
+   */
+  SearchResponse search(SearchParam searchParam);
 
-    /**
-     * Searches vectors in specific files specified by <code>searchInFilesParam</code>
-     * @param searchInFilesParam the <code>SearchInFilesParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
-     *                                          .withTopK(topK)
-     *                                          .withNProbe(nProbe)
-     *                                          .withDateRanges(dateRanges)
-     *                                          .build(); 
-     * SearchInFilesParam searchInFilesParam = new SearchInFilesParam.Builder(fileIds, searchParam)
-     *                                                               .withTimeout(timeout)
-     *                                                               .build();                                    
-     * </code>                          
-     * </pre>                          
-     * @return <code>SearchResponse</code>
-     * @see SearchInFilesParam
-     * @see SearchParam
-     * @see DateRange
-     * @see SearchResponse
-     * @see SearchResponse.QueryResult
-     * @see Response
-     */
-    SearchResponse searchInFiles(SearchInFilesParam searchInFilesParam);
+  /**
+   * Searches vectors in specific files specified by <code>searchInFilesParam</code>
+   *
+   * @param searchInFilesParam the <code>SearchInFilesParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
+   *                                          .withTopK(topK)
+   *                                          .withNProbe(nProbe)
+   *                                          .withDateRanges(dateRanges)
+   *                                          .build();
+   * SearchInFilesParam searchInFilesParam = new SearchInFilesParam.Builder(fileIds, searchParam)
+   *                                                               .withTimeout(timeout)
+   *                                                               .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>SearchResponse</code>
+   * @see SearchInFilesParam
+   * @see SearchParam
+   * @see DateRange
+   * @see SearchResponse
+   * @see SearchResponse.QueryResult
+   * @see Response
+   */
+  SearchResponse searchInFiles(SearchInFilesParam searchInFilesParam);
 
-    /** 
-     * Describes table specified by <code>tableParam</code>
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();                  
-     * </code>                  
-     * </pre>                  
-     * @return <code>DescribeTableResponse</code>
-     * @see TableParam
-     * @see DescribeTableResponse
-     * @see Response
-     */
-    DescribeTableResponse describeTable(TableParam tableParam);
+  /**
+   * Describes table specified by <code>tableParam</code>
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>DescribeTableResponse</code>
+   * @see TableParam
+   * @see DescribeTableResponse
+   * @see Response
+   */
+  DescribeTableResponse describeTable(TableParam tableParam);
 
-    /**
-     * Shows current tables
-     * @return <code>ShowTablesResponse</code>
-     * @see ShowTablesResponse
-     * @see Response
-     */
-    ShowTablesResponse showTables();
+  /**
+   * Shows current tables
+   *
+   * @return <code>ShowTablesResponse</code>
+   * @see ShowTablesResponse
+   * @see Response
+   */
+  ShowTablesResponse showTables();
 
-    /**
-     * Gets current row count of table specified by <code>tableParam</code>
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>GetTableRowCountResponse</code>
-     * @see GetTableRowCountResponse
-     * @see Response
-     */
-    GetTableRowCountResponse getTableRowCount(TableParam tableParam);
+  /**
+   * Gets current row count of table specified by <code>tableParam</code>
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>GetTableRowCountResponse</code>
+   * @see GetTableRowCountResponse
+   * @see Response
+   */
+  GetTableRowCountResponse getTableRowCount(TableParam tableParam);
 
-    /**
-     * Prints server status
-     * @return <code>Response</code>
-     * @see Response
-     */
-    Response serverStatus();
+  /**
+   * Prints server status
+   *
+   * @return <code>Response</code>
+   * @see Response
+   */
+  Response serverStatus();
 
-    /**
-     * Prints server version
-     * @return <code>Response</code>
-     * @see Response
-     */
-    Response serverVersion();
+  /**
+   * Prints server version
+   *
+   * @return <code>Response</code>
+   * @see Response
+   */
+  Response serverVersion();
 
-    /**
-     * Deletes vectors by date range, specified by <code>deleteByRangeParam</code>
-     * @param deleteByRangeParam the <code>DeleteByRangeParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * DeleteByRangeParam deleteByRangeParam = new DeleteByRangeParam.Builder(dateRange, tableName)
-     *                                                               .withTimeout(timeout)
-     *                                                               .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see DeleteByRangeParam
-     * @see DateRange
-     * @see Response
-     */
-    Response deleteByRange(DeleteByRangeParam deleteByRangeParam);
+  /**
+   * Deletes vectors by date range, specified by <code>deleteByRangeParam</code>
+   *
+   * @param deleteByRangeParam the <code>DeleteByRangeParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * DeleteByRangeParam deleteByRangeParam = new DeleteByRangeParam.Builder(dateRange, tableName)
+   *                                                               .withTimeout(timeout)
+   *                                                               .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see DeleteByRangeParam
+   * @see DateRange
+   * @see Response
+   */
+  Response deleteByRange(DeleteByRangeParam deleteByRangeParam);
 
-    /**
-     * Pre-loads table to memory
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>Response</code>
-     * @see TableParam
-     * @see Response
-     */
-    Response preloadTable(TableParam tableParam);
+  /**
+   * Pre-loads table to memory
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>Response</code>
+   * @see TableParam
+   * @see Response
+   */
+  Response preloadTable(TableParam tableParam);
 
-    /**
-     * Describes table index specified by <code>tableParam</code>
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>DescribeIndexResponse</code>
-     * @see TableParam
-     * @see DescribeIndexResponse
-     * @see Index
-     * @see Response
-     */
-    DescribeIndexResponse describeIndex(TableParam tableParam);
+  /**
+   * Describes table index specified by <code>tableParam</code>
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>DescribeIndexResponse</code>
+   * @see TableParam
+   * @see DescribeIndexResponse
+   * @see Index
+   * @see Response
+   */
+  DescribeIndexResponse describeIndex(TableParam tableParam);
 
-    /**
-     * Drops table index specified by <code>tableParam</code>
-     * @param tableParam the <code>TableParam</code> object
-     * <pre>
-     * example usage:
-     * <code>
-     * TableParam tableParam = new TableParam.Builder(tableName)
-     *                                       .withTimeout(timeout)
-     *                                       .build();
-     * </code>
-     * </pre>
-     * @return <code>dropIndex</code>
-     * @see TableParam
-     * @see Response
-     */
-    Response dropIndex(TableParam tableParam);
+  /**
+   * Drops table index specified by <code>tableParam</code>
+   *
+   * @param tableParam the <code>TableParam</code> object
+   *     <pre>
+   * example usage:
+   * <code>
+   * TableParam tableParam = new TableParam.Builder(tableName)
+   *                                       .withTimeout(timeout)
+   *                                       .build();
+   * </code>
+   * </pre>
+   *
+   * @return <code>dropIndex</code>
+   * @see TableParam
+   * @see Response
+   */
+  Response dropIndex(TableParam tableParam);
 }

+ 705 - 665
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -1,767 +1,807 @@
+/*
+ * 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.client;
 
-import io.grpc.*;
+import io.grpc.ConnectivityState;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.grpc.StatusRuntimeException;
 
 import javax.annotation.Nonnull;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-/**
- * Actual implementation of interface <code>MilvusClient</code>
- */
+/** Actual implementation of interface <code>MilvusClient</code> */
 public class MilvusGrpcClient implements MilvusClient {
 
-    private static final Logger logger = Logger.getLogger(MilvusGrpcClient.class.getName());
+  private static final Logger logger = Logger.getLogger(MilvusGrpcClient.class.getName());
+  private static final String ANSI_RESET = "\u001B[0m";
+  private static final String ANSI_YELLOW = "\u001B[33m";
+  private static final String ANSI_PURPLE = "\u001B[35m";
+  private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
 
-    private ManagedChannel channel = null;
-    private io.milvus.client.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub;
+  private ManagedChannel channel = null;
+  private io.milvus.client.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub;
 
-    ///////////////////////Client Calls///////////////////////
+  /////////////////////// Client Calls///////////////////////
 
-    @Override
-    public Response connect(ConnectParam connectParam) {
-        if (channel != null) {
-            logWarning("You have already connected!");
-            return new Response(Response.Status.CONNECT_FAILED, "You have already connected!");
-        }
+  @Override
+  public Response connect(ConnectParam connectParam) {
+    if (channel != null) {
+      logWarning("You have already connected!");
+      return new Response(Response.Status.CONNECT_FAILED, "You have already connected!");
+    }
 
-        try {
-            int port = Integer.parseInt(connectParam.getPort());
-            if (port < 0 || port > 0xFFFF) {
-                logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
-                return new Response(Response.Status.CONNECT_FAILED);
-            }
+    try {
+      int port = Integer.parseInt(connectParam.getPort());
+      if (port < 0 || port > 0xFFFF) {
+        logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
+        return new Response(Response.Status.CONNECT_FAILED);
+      }
 
-            channel = ManagedChannelBuilder
-                    .forAddress(connectParam.getHost(), port)
-                    .usePlaintext()
-                    .maxInboundMessageSize(Integer.MAX_VALUE)
-                    .build();
+      channel =
+          ManagedChannelBuilder.forAddress(connectParam.getHost(), port)
+              .usePlaintext()
+              .maxInboundMessageSize(Integer.MAX_VALUE)
+              .build();
 
-            ConnectivityState connectivityState;
-            connectivityState = channel.getState(true);
+      ConnectivityState connectivityState;
+      connectivityState = channel.getState(true);
 
-            logInfo("Waiting to connect...");
-            TimeUnit.MILLISECONDS.sleep(500);
+      logInfo("Waiting to connect...");
+      TimeUnit.MILLISECONDS.sleep(500);
 
-            connectivityState = channel.getState(false);
-            if (connectivityState != ConnectivityState.READY) {
-                logSevere("Connect failed! {0}", connectParam.toString());
-                return new Response(Response.Status.CONNECT_FAILED);
-            }
+      connectivityState = channel.getState(false);
+      if (connectivityState != ConnectivityState.READY) {
+        logSevere("Connect failed! {0}", connectParam.toString());
+        return new Response(Response.Status.CONNECT_FAILED);
+      }
 
-            blockingStub = io.milvus.client.grpc.MilvusServiceGrpc.newBlockingStub(channel);
+      blockingStub = io.milvus.client.grpc.MilvusServiceGrpc.newBlockingStub(channel);
 
-        } catch (Exception e) {
-            logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
-            return new Response(Response.Status.CONNECT_FAILED);
-        }
+    } catch (Exception e) {
+      logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
+      return new Response(Response.Status.CONNECT_FAILED);
+    }
 
-        logInfo("Connected successfully!\n{0}", connectParam.toString());
-        return new Response(Response.Status.SUCCESS);
+    logInfo("Connected successfully!\n{0}", connectParam.toString());
+    return new Response(Response.Status.SUCCESS);
+  }
+
+  @Override
+  public boolean connected() {
+    if (channel == null) {
+      return false;
+    }
+    ConnectivityState connectivityState = channel.getState(false);
+    return connectivityState == ConnectivityState.READY;
+  }
+
+  @Override
+  public Response disconnect() throws InterruptedException {
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
+    } else {
+      if (channel.shutdown().awaitTermination(60, TimeUnit.SECONDS)) {
+        logInfo("Channel terminated");
+      } else {
+        logSevere("Encountered error when terminating channel");
+        return new Response(Response.Status.RPC_ERROR);
+      }
     }
+    return new Response(Response.Status.SUCCESS);
+  }
 
-    @Override
-    public boolean connected() {
-        if (channel == null) {
-            return false;
-        }
-        ConnectivityState connectivityState = channel.getState(false);
-        return connectivityState == ConnectivityState.READY;
+  @Override
+  public Response createTable(@Nonnull TableSchemaParam tableSchemaParam) {
+
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    @Override
-    public Response disconnect() throws InterruptedException {
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
-        else {
-            if (channel.shutdown().awaitTermination(60, TimeUnit.SECONDS)) {
-                logInfo("Channel terminated");
-            } else {
-                logSevere("Encountered error when terminating channel");
-                return new Response(Response.Status.RPC_ERROR);
-            }
-        }
+    TableSchema tableSchema = tableSchemaParam.getTableSchema();
+    io.milvus.client.grpc.TableSchema request =
+        io.milvus.client.grpc.TableSchema.newBuilder()
+            .setTableName(tableSchema.getTableName())
+            .setDimension(tableSchema.getDimension())
+            .setIndexFileSize(tableSchema.getIndexFileSize())
+            .setMetricType(tableSchema.getMetricType().getVal())
+            .build();
+
+    io.milvus.client.grpc.Status response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableSchemaParam.getTimeout(), TimeUnit.SECONDS)
+              .createTable(request);
+
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Created table successfully!\n{0}", tableSchema.toString());
         return new Response(Response.Status.SUCCESS);
+      } else if (response.getReason().contentEquals("Table already exists")) {
+        logWarning("Table `{0}` already exists", tableSchema.getTableName());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      } else {
+        logSevere("Create table failed\n{0}\n{1}", tableSchema.toString(), response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("createTable RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
     }
+  }
 
-    @Override
-    public Response createTable(@Nonnull TableSchemaParam tableSchemaParam) {
-
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+  @Override
+  public HasTableResponse hasTable(@Nonnull TableParam tableParam) {
 
-        TableSchema tableSchema = tableSchemaParam.getTableSchema();
-        io.milvus.client.grpc.TableSchema request = io.milvus.client.grpc.TableSchema
-                                                    .newBuilder()
-                                                    .setTableName(tableSchema.getTableName())
-                                                    .setDimension(tableSchema.getDimension())
-                                                    .setIndexFileSize(tableSchema.getIndexFileSize())
-                                                    .setMetricType(tableSchema.getMetricType().getVal())
-                                                    .build();
-
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableSchemaParam.getTimeout(), TimeUnit.SECONDS)
-                       .createTable(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Created table successfully!\n{0}", tableSchema.toString());
-                return new Response(Response.Status.SUCCESS);
-            } else if (response.getReason().contentEquals("Table already exists")) {
-                logWarning("Table `{0}` already exists", tableSchema.getTableName());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            } else {
-                logSevere("Create table failed\n{0}\n{1}", tableSchema.toString(), response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("createTable RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new HasTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), false);
     }
 
-    @Override
-    public HasTableResponse hasTable(@Nonnull TableParam tableParam) {
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.BoolReply response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .hasTable(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
+        return new HasTableResponse(new Response(Response.Status.SUCCESS), response.getBoolReply());
+      } else {
+        logSevere("hasTable `{0}` failed:\n{1}", tableName, response.toString());
+        return new HasTableResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            false);
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("hasTable RPC failed:\n{0}", e.getStatus().toString());
+      return new HasTableResponse(new Response(Response.Status.RPC_ERROR, e.toString()), false);
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new HasTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), false);
-        }
+  @Override
+  public Response dropTable(@Nonnull TableParam tableParam) {
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                                                  .newBuilder()
-                                                  .setTableName(tableName)
-                                                  .build();
-        io.milvus.client.grpc.BoolReply response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .hasTable(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
-                return new HasTableResponse(new Response(Response.Status.SUCCESS), response.getBoolReply());
-            } else {
-                logSevere("hasTable `{0}` failed:\n{1}", tableName, response.toString());
-                return new HasTableResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                         response.getStatus().getReason()),
-                                    false);
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("hasTable RPC failed:\n{0}", e.getStatus().toString());
-            return new HasTableResponse(new Response(Response.Status.RPC_ERROR, e.toString()), false);
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    @Override
-    public Response dropTable(@Nonnull TableParam tableParam) {
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.Status response;
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .dropTable(request);
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                                                  .newBuilder()
-                                                  .setTableName(tableName)
-                                                  .build();
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .dropTable(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Dropped table `{0}` successfully!", tableName);
-                return new Response(Response.Status.SUCCESS);
-            } else {
-                logSevere("Drop table `{0}` failed:\n{1}", tableName, response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("dropTable RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Dropped table `{0}` successfully!", tableName);
+        return new Response(Response.Status.SUCCESS);
+      } else {
+        logSevere("Drop table `{0}` failed:\n{1}", tableName, response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("dropTable RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
     }
+  }
 
-    @Override
-    public Response createIndex(@Nonnull CreateIndexParam createIndexParam) {
-
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+  @Override
+  public Response createIndex(@Nonnull CreateIndexParam createIndexParam) {
 
-        io.milvus.client.grpc.Index index = io.milvus.client.grpc.Index
-                                            .newBuilder()
-                                            .setIndexType(createIndexParam.getIndex().getIndexType().getVal())
-                                            .setNlist(createIndexParam.getIndex().getNList())
-                                            .build();
-        io.milvus.client.grpc.IndexParam request = io.milvus.client.grpc.IndexParam
-                                           .newBuilder()
-                                           .setTableName(createIndexParam.getTableName())
-                                           .setIndex(index)
-                                           .build();
-
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(createIndexParam.getTimeout(), TimeUnit.SECONDS)
-                       .createIndex(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Created index successfully!\n{0}", createIndexParam.toString());
-                return new Response(Response.Status.SUCCESS);
-            } else {
-                logSevere("Create index failed\n{0}\n{1}", createIndexParam.toString(), response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("createIndex RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    @Override
-    public InsertResponse insert(@Nonnull InsertParam insertParam) {
+    io.milvus.client.grpc.Index index =
+        io.milvus.client.grpc.Index.newBuilder()
+            .setIndexType(createIndexParam.getIndex().getIndexType().getVal())
+            .setNlist(createIndexParam.getIndex().getNList())
+            .build();
+    io.milvus.client.grpc.IndexParam request =
+        io.milvus.client.grpc.IndexParam.newBuilder()
+            .setTableName(createIndexParam.getTableName())
+            .setIndex(index)
+            .build();
+
+    io.milvus.client.grpc.Status response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(createIndexParam.getTimeout(), TimeUnit.SECONDS)
+              .createIndex(request);
+
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Created index successfully!\n{0}", createIndexParam.toString());
+        return new Response(Response.Status.SUCCESS);
+      } else {
+        logSevere(
+            "Create index failed\n{0}\n{1}", createIndexParam.toString(), response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("createIndex RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new InsertResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
-        }
+  @Override
+  public InsertResponse insert(@Nonnull InsertParam insertParam) {
 
-        List<io.milvus.client.grpc.RowRecord> rowRecordList = new ArrayList<>();
-        for (List<Float> vectors : insertParam.getVectors()) {
-            io.milvus.client.grpc.RowRecord rowRecord = io.milvus.client.grpc.RowRecord
-                                                        .newBuilder()
-                                                        .addAllVectorData(vectors)
-                                                        .build();
-            rowRecordList.add(rowRecord);
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new InsertResponse(
+          new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
+    }
 
-        io.milvus.client.grpc.InsertParam request = io.milvus.client.grpc.InsertParam
-                                                    .newBuilder()
-                                                    .setTableName(insertParam.getTableName())
-                                                    .addAllRowRecordArray(rowRecordList)
-                                                    .addAllRowIdArray(insertParam.getVectorIds())
-                                                    .build();
-        io.milvus.client.grpc.VectorIds response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(insertParam.getTimeout(), TimeUnit.SECONDS)
-                       .insert(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
-                logInfo("Inserted {0} vectors to table `{1} successfully!", resultVectorIds.map(List::size).orElse(0), insertParam.getTableName());
-                return new InsertResponse(new Response(Response.Status.SUCCESS), resultVectorIds.orElse(new ArrayList<>()));
-            } else {
-                logSevere("Insert vectors failed:\n{0}", response.toString());
-                return new InsertResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                       response.getStatus().getReason()),
-                                          new ArrayList<>());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("insert RPC failed:\n{0}", e.getStatus().toString());
-            return new InsertResponse(new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
-        }
+    List<io.milvus.client.grpc.RowRecord> rowRecordList = new ArrayList<>();
+    for (List<Float> vectors : insertParam.getVectors()) {
+      io.milvus.client.grpc.RowRecord rowRecord =
+          io.milvus.client.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
+      rowRecordList.add(rowRecord);
     }
 
-    @Override
-    public SearchResponse search(@Nonnull SearchParam searchParam) {
+    io.milvus.client.grpc.InsertParam request =
+        io.milvus.client.grpc.InsertParam.newBuilder()
+            .setTableName(insertParam.getTableName())
+            .addAllRowRecordArray(rowRecordList)
+            .addAllRowIdArray(insertParam.getVectorIds())
+            .build();
+    io.milvus.client.grpc.VectorIds response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(insertParam.getTimeout(), TimeUnit.SECONDS)
+              .insert(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
+        logInfo(
+            "Inserted {0} vectors to table `{1} successfully!",
+            resultVectorIds.map(List::size).orElse(0), insertParam.getTableName());
+        return new InsertResponse(
+            new Response(Response.Status.SUCCESS), resultVectorIds.orElse(new ArrayList<>()));
+      } else {
+        logSevere("Insert vectors failed:\n{0}", response.toString());
+        return new InsertResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            new ArrayList<>());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("insert RPC failed:\n{0}", e.getStatus().toString());
+      return new InsertResponse(
+          new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new SearchResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
-        }
+  @Override
+  public SearchResponse search(@Nonnull SearchParam searchParam) {
 
-        List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
-
-        List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
-
-        io.milvus.client.grpc.SearchParam request = io.milvus.client.grpc.SearchParam
-                                                    .newBuilder()
-                                                    .setTableName(searchParam.getTableName())
-                                                    .addAllQueryRecordArray(queryRowRecordList)
-                                                    .addAllQueryRangeArray(queryRangeList)
-                                                    .setTopk(searchParam.getTopK())
-                                                    .setNprobe(searchParam.getNProbe())
-                                                    .build();
-
-        io.milvus.client.grpc.TopKQueryResultList response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(searchParam.getTimeout(), TimeUnit.SECONDS)
-                       .search(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
-                logInfo("Search completed successfully! Returned results for {0} queries", queryResultsList.size());
-                return new SearchResponse(new Response(Response.Status.SUCCESS), queryResultsList);
-            } else {
-                logSevere("Search failed:\n{0}", response.toString());
-                return new SearchResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                       response.getStatus().getReason()),
-                                          new ArrayList<>());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("search RPC failed:\n{0}", e.getStatus().toString());
-            return new SearchResponse(new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new SearchResponse(
+          new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
-    @Override
-    public SearchResponse searchInFiles(@Nonnull SearchInFilesParam searchInFilesParam) {
+    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
+
+    List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
+
+    io.milvus.client.grpc.SearchParam request =
+        io.milvus.client.grpc.SearchParam.newBuilder()
+            .setTableName(searchParam.getTableName())
+            .addAllQueryRecordArray(queryRowRecordList)
+            .addAllQueryRangeArray(queryRangeList)
+            .setTopk(searchParam.getTopK())
+            .setNprobe(searchParam.getNProbe())
+            .build();
+
+    io.milvus.client.grpc.TopKQueryResultList response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(searchParam.getTimeout(), TimeUnit.SECONDS)
+              .search(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
+        logInfo(
+            "Search completed successfully! Returned results for {0} queries",
+            queryResultsList.size());
+        return new SearchResponse(new Response(Response.Status.SUCCESS), queryResultsList);
+      } else {
+        logSevere("Search failed:\n{0}", response.toString());
+        return new SearchResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            new ArrayList<>());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("search RPC failed:\n{0}", e.getStatus().toString());
+      return new SearchResponse(
+          new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new SearchResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
-        }
+  @Override
+  public SearchResponse searchInFiles(@Nonnull SearchInFilesParam searchInFilesParam) {
 
-        SearchParam searchParam = searchInFilesParam.getSearchParam();
-
-        List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
-
-        List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
-
-        io.milvus.client.grpc.SearchParam searchParamToSet = io.milvus.client.grpc.SearchParam
-                                                             .newBuilder()
-                                                             .setTableName(searchParam.getTableName())
-                                                             .addAllQueryRecordArray(queryRowRecordList)
-                                                             .addAllQueryRangeArray(queryRangeList)
-                                                             .setTopk(searchParam.getTopK())
-                                                             .setNprobe(searchParam.getNProbe())
-                                                             .build();
-
-        io.milvus.client.grpc.SearchInFilesParam request = io.milvus.client.grpc.SearchInFilesParam
-                                                           .newBuilder()
-                                                           .addAllFileIdArray(searchInFilesParam.getFileIds())
-                                                           .setSearchParam(searchParamToSet)
-                                                           .build();
-
-        io.milvus.client.grpc.TopKQueryResultList response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(searchInFilesParam.getTimeout(), TimeUnit.SECONDS)
-                       .searchInFiles(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
-
-                List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
-                return new SearchResponse(new Response(Response.Status.SUCCESS), queryResultsList);
-            } else {
-                logSevere("Search in files {0} failed:\n{1}", searchInFilesParam.getFileIds(), response.toString());
-                return new SearchResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                       response.getStatus().getReason()),
-                                          new ArrayList<>());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("searchInFiles RPC failed:\n{0}", e.getStatus().toString());
-            return new SearchResponse(new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new SearchResponse(
+          new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
-    @Override
-    public DescribeTableResponse describeTable(@Nonnull TableParam tableParam) {
+    SearchParam searchParam = searchInFilesParam.getSearchParam();
+
+    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = getQueryRowRecordList(searchParam);
+
+    List<io.milvus.client.grpc.Range> queryRangeList = getQueryRangeList(searchParam);
+
+    io.milvus.client.grpc.SearchParam searchParamToSet =
+        io.milvus.client.grpc.SearchParam.newBuilder()
+            .setTableName(searchParam.getTableName())
+            .addAllQueryRecordArray(queryRowRecordList)
+            .addAllQueryRangeArray(queryRangeList)
+            .setTopk(searchParam.getTopK())
+            .setNprobe(searchParam.getNProbe())
+            .build();
+
+    io.milvus.client.grpc.SearchInFilesParam request =
+        io.milvus.client.grpc.SearchInFilesParam.newBuilder()
+            .addAllFileIdArray(searchInFilesParam.getFileIds())
+            .setSearchParam(searchParamToSet)
+            .build();
+
+    io.milvus.client.grpc.TopKQueryResultList response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(searchInFilesParam.getTimeout(), TimeUnit.SECONDS)
+              .searchInFiles(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
+
+        List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
+        return new SearchResponse(new Response(Response.Status.SUCCESS), queryResultsList);
+      } else {
+        logSevere(
+            "Search in files {0} failed:\n{1}",
+            searchInFilesParam.getFileIds(), response.toString());
+        return new SearchResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            new ArrayList<>());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("searchInFiles RPC failed:\n{0}", e.getStatus().toString());
+      return new SearchResponse(
+          new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new DescribeTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
-        }
+  @Override
+  public DescribeTableResponse describeTable(@Nonnull TableParam tableParam) {
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                                                  .newBuilder()
-                                                  .setTableName(tableName)
-                                                  .build();
-        io.milvus.client.grpc.TableSchema response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .describeTable(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                TableSchema tableSchema = new TableSchema.Builder(response.getTableName(), response.getDimension())
-                        .withIndexFileSize(response.getIndexFileSize())
-                        .withMetricType(MetricType.valueOf(response.getMetricType()))
-                        .build();
-                logInfo("Describe Table `{0}` returned:\n{1}", tableName, tableSchema);
-                return new DescribeTableResponse(new Response(Response.Status.SUCCESS), tableSchema);
-            } else {
-                logSevere("Describe Table `{0}` failed:\n{1}", tableName, response.toString());
-                return new DescribeTableResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                              response.getStatus().getReason()),
-                                      null);
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("describeTable RPC failed:\n{0}", e.getStatus().toString());
-            return new DescribeTableResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new DescribeTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
     }
 
-    @Override
-    public ShowTablesResponse showTables() {
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.TableSchema response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .describeTable(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        TableSchema tableSchema =
+            new TableSchema.Builder(response.getTableName(), response.getDimension())
+                .withIndexFileSize(response.getIndexFileSize())
+                .withMetricType(MetricType.valueOf(response.getMetricType()))
+                .build();
+        logInfo("Describe Table `{0}` returned:\n{1}", tableName, tableSchema);
+        return new DescribeTableResponse(new Response(Response.Status.SUCCESS), tableSchema);
+      } else {
+        logSevere("Describe Table `{0}` failed:\n{1}", tableName, response.toString());
+        return new DescribeTableResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            null);
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("describeTable RPC failed:\n{0}", e.getStatus().toString());
+      return new DescribeTableResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new ShowTablesResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
-        }
+  @Override
+  public ShowTablesResponse showTables() {
 
-        io.milvus.client.grpc.Command request = io.milvus.client.grpc.Command
-                                                .newBuilder()
-                                                .setCmd("")
-                                                .build();
-        io.milvus.client.grpc.TableNameList response;
-
-        try {
-            response = blockingStub.showTables(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                List<String> tableNames = response.getTableNamesList();
-                logInfo("Current tables: {0}", tableNames.toString());
-                return new ShowTablesResponse(new Response(Response.Status.SUCCESS), tableNames);
-            } else {
-                logSevere("Show tables failed:\n{0}", response.toString());
-                return new ShowTablesResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                           response.getStatus().getReason()),
-                                              new ArrayList<>());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("showTables RPC failed:\n{0}", e.getStatus().toString());
-            return new ShowTablesResponse(new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new ShowTablesResponse(
+          new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
-    @Override
-    public GetTableRowCountResponse getTableRowCount(@Nonnull TableParam tableParam) {
+    io.milvus.client.grpc.Command request =
+        io.milvus.client.grpc.Command.newBuilder().setCmd("").build();
+    io.milvus.client.grpc.TableNameList response;
+
+    try {
+      response = blockingStub.showTables(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        List<String> tableNames = response.getTableNamesList();
+        logInfo("Current tables: {0}", tableNames.toString());
+        return new ShowTablesResponse(new Response(Response.Status.SUCCESS), tableNames);
+      } else {
+        logSevere("Show tables failed:\n{0}", response.toString());
+        return new ShowTablesResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            new ArrayList<>());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("showTables RPC failed:\n{0}", e.getStatus().toString());
+      return new ShowTablesResponse(
+          new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new GetTableRowCountResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), 0);
-        }
+  @Override
+  public GetTableRowCountResponse getTableRowCount(@Nonnull TableParam tableParam) {
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                                                  .newBuilder()
-                                                  .setTableName(tableName)
-                                                  .build();
-        io.milvus.client.grpc.TableRowCount response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .countTable(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                long tableRowCount = response.getTableRowCount();
-                logInfo("Table `{0}` has {1} rows", tableName, tableRowCount);
-                return new GetTableRowCountResponse(new Response(Response.Status.SUCCESS), tableRowCount);
-            } else {
-                logSevere("Get table `{0}` row count failed:\n{1}", tableName, response.toString());
-                return new GetTableRowCountResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                                 response.getStatus().getReason()),
-                                        0);
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("countTable RPC failed:\n{0}", e.getStatus().toString());
-            return new GetTableRowCountResponse(new Response(Response.Status.RPC_ERROR, e.toString()), 0);
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new GetTableRowCountResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), 0);
     }
 
-    @Override
-    public Response serverStatus() {
-        CommandParam commandParam = new CommandParam.Builder("OK").build();
-        return command(commandParam);
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.TableRowCount response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .countTable(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        long tableRowCount = response.getTableRowCount();
+        logInfo("Table `{0}` has {1} rows", tableName, tableRowCount);
+        return new GetTableRowCountResponse(new Response(Response.Status.SUCCESS), tableRowCount);
+      } else {
+        logSevere("Get table `{0}` row count failed:\n{1}", tableName, response.toString());
+        return new GetTableRowCountResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            0);
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("countTable RPC failed:\n{0}", e.getStatus().toString());
+      return new GetTableRowCountResponse(new Response(Response.Status.RPC_ERROR, e.toString()), 0);
     }
+  }
 
-    @Override
-    public Response serverVersion() {
-        CommandParam commandParam = new CommandParam.Builder("version").build();
-        return command(commandParam);
-    }
+  @Override
+  public Response serverStatus() {
+    CommandParam commandParam = new CommandParam.Builder("OK").build();
+    return command(commandParam);
+  }
 
-    private Response command(@Nonnull CommandParam commandParam) {
+  @Override
+  public Response serverVersion() {
+    CommandParam commandParam = new CommandParam.Builder("version").build();
+    return command(commandParam);
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+  private Response command(@Nonnull CommandParam commandParam) {
 
-        String command = commandParam.getCommand();
-        io.milvus.client.grpc.Command request = io.milvus.client.grpc.Command
-                                                .newBuilder()
-                                                .setCmd(command)
-                                                .build();
-        io.milvus.client.grpc.StringReply response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(commandParam.getTimeout(), TimeUnit.SECONDS)
-                       .cmd(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Command `{0}`: {1}", command, response.getStringReply());
-                return new Response(Response.Status.SUCCESS, response.getStringReply());
-            } else {
-                logSevere("Command `{0}` failed:\n{1}", command, response.toString());
-                return new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                    response.getStatus().getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("Command RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    public Response deleteByRange(@Nonnull DeleteByRangeParam deleteByRangeParam) {
+    String command = commandParam.getCommand();
+    io.milvus.client.grpc.Command request =
+        io.milvus.client.grpc.Command.newBuilder().setCmd(command).build();
+    io.milvus.client.grpc.StringReply response;
+
+    try {
+      response =
+          blockingStub.withDeadlineAfter(commandParam.getTimeout(), TimeUnit.SECONDS).cmd(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Command `{0}`: {1}", command, response.getStringReply());
+        return new Response(Response.Status.SUCCESS, response.getStringReply());
+      } else {
+        logSevere("Command `{0}` failed:\n{1}", command, response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+            response.getStatus().getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("Command RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+  public Response deleteByRange(@Nonnull DeleteByRangeParam deleteByRangeParam) {
 
-        io.milvus.client.grpc.DeleteByRangeParam request = io.milvus.client.grpc.DeleteByRangeParam
-                                                           .newBuilder()
-                                                           .setRange(getRange(deleteByRangeParam.getDateRange()))
-                                                           .setTableName(deleteByRangeParam.getTableName())
-                                                           .build();
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(deleteByRangeParam.getTimeout(), TimeUnit.SECONDS)
-                       .deleteByRange(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Deleted vectors from table `{0}` in range {1} successfully!",
-                             deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString());
-                return new Response(Response.Status.SUCCESS);
-            } else {
-                logSevere("Deleted vectors from table `{0}` in range {1} failed:\n{2}",
-                          deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString(),
-                          response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("deleteByRange RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    @Override
-    public Response preloadTable(@Nonnull TableParam tableParam) {
+    io.milvus.client.grpc.DeleteByRangeParam request =
+        io.milvus.client.grpc.DeleteByRangeParam.newBuilder()
+            .setRange(getRange(deleteByRangeParam.getDateRange()))
+            .setTableName(deleteByRangeParam.getTableName())
+            .build();
+    io.milvus.client.grpc.Status response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(deleteByRangeParam.getTimeout(), TimeUnit.SECONDS)
+              .deleteByRange(request);
+
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo(
+            "Deleted vectors from table `{0}` in range {1} successfully!",
+            deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString());
+        return new Response(Response.Status.SUCCESS);
+      } else {
+        logSevere(
+            "Deleted vectors from table `{0}` in range {1} failed:\n{2}",
+            deleteByRangeParam.getTableName(),
+            deleteByRangeParam.getDateRange().toString(),
+            response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("deleteByRange RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
+    }
+  }
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+  @Override
+  public Response preloadTable(@Nonnull TableParam tableParam) {
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                .newBuilder()
-                .setTableName(tableName)
-                .build();
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .preloadTable(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Preloaded table `{0}` successfully!", tableName);
-                return new Response(Response.Status.SUCCESS);
-            } else {
-                logSevere("Preload table `{0}` failed:\n{1}", tableName, response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("preloadTable RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    @Override
-    public DescribeIndexResponse describeIndex(@Nonnull TableParam tableParam) {
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.Status response;
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new DescribeIndexResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
-        }
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .preloadTable(request);
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                                                  .newBuilder()
-                                                  .setTableName(tableName)
-                                                  .build();
-        io.milvus.client.grpc.IndexParam response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .describeIndex(request);
-
-            if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                Index index = new Index.Builder()
-                        .withIndexType(IndexType.valueOf(response.getIndex().getIndexType()))
-                        .withNList(response.getIndex().getNlist())
-                        .build();
-                logInfo("Describe index for table `{0}` returned:\n{1}", tableName, index.toString());
-                return new DescribeIndexResponse(new Response(Response.Status.SUCCESS), index);
-            } else {
-                logSevere("Describe index for table `{0}` failed:\n{1}", tableName, response.toString());
-                return new DescribeIndexResponse(new Response(Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                                                              response.getStatus().getReason()),
-                                            null);
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("describeIndex RPC failed:\n{0}", e.getStatus().toString());
-            return new DescribeIndexResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
-        }
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Preloaded table `{0}` successfully!", tableName);
+        return new Response(Response.Status.SUCCESS);
+      } else {
+        logSevere("Preload table `{0}` failed:\n{1}", tableName, response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("preloadTable RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
     }
+  }
 
-    @Override
-    public Response dropIndex(@Nonnull TableParam tableParam) {
+  @Override
+  public DescribeIndexResponse describeIndex(@Nonnull TableParam tableParam) {
 
-        if (!connected()) {
-            logWarning("You are not connected to Milvus server");
-            return new Response(Response.Status.CLIENT_NOT_CONNECTED);
-        }
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new DescribeIndexResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
+    }
 
-        String tableName = tableParam.getTableName();
-        io.milvus.client.grpc.TableName request = io.milvus.client.grpc.TableName
-                .newBuilder()
-                .setTableName(tableName)
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.IndexParam response;
+
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .describeIndex(request);
+
+      if (response.getStatus().getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        Index index =
+            new Index.Builder()
+                .withIndexType(IndexType.valueOf(response.getIndex().getIndexType()))
+                .withNList(response.getIndex().getNlist())
                 .build();
-        io.milvus.client.grpc.Status response;
-
-        try {
-            response = blockingStub
-                       .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-                       .dropIndex(request);
-
-            if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
-                logInfo("Dropped index for table `{0}` successfully!", tableName);
-                return new Response(Response.Status.SUCCESS);
-            } else {
-                logSevere("Drop index for table `{0}` failed:\n{1}", tableName, response.toString());
-                return new Response(Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
-            }
-        } catch (StatusRuntimeException e) {
-            logSevere("dropIndex RPC failed:\n{0}", e.getStatus().toString());
-            return new Response(Response.Status.RPC_ERROR, e.toString());
-        }
+        logInfo("Describe index for table `{0}` returned:\n{1}", tableName, index.toString());
+        return new DescribeIndexResponse(new Response(Response.Status.SUCCESS), index);
+      } else {
+        logSevere("Describe index for table `{0}` failed:\n{1}", tableName, response.toString());
+        return new DescribeIndexResponse(
+            new Response(
+                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
+                response.getStatus().getReason()),
+            null);
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("describeIndex RPC failed:\n{0}", e.getStatus().toString());
+      return new DescribeIndexResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
     }
+  }
 
-    /////////////////////Util Functions/////////////////////
-    private List<io.milvus.client.grpc.RowRecord> getQueryRowRecordList(@Nonnull SearchParam searchParam) {
-        List<io.milvus.client.grpc.RowRecord> queryRowRecordList = new ArrayList<>();
-        for (List<Float> vectors : searchParam.getQueryVectors()) {
-            io.milvus.client.grpc.RowRecord rowRecord = io.milvus.client.grpc.RowRecord
-                    .newBuilder()
-                    .addAllVectorData(vectors)
-                    .build();
-            queryRowRecordList.add(rowRecord);
-        }
-        return queryRowRecordList;
-    }
-
-    private List<io.milvus.client.grpc.Range> getQueryRangeList(@Nonnull SearchParam searchParam) {
-        List<io.milvus.client.grpc.Range> queryRangeList = new ArrayList<>();
-        String datePattern = "yyyy-MM-dd";
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
-        for (DateRange queryRange : searchParam.getQueryRanges()) {
-            io.milvus.client.grpc.Range dateRange = io.milvus.client.grpc.Range
-                    .newBuilder()
-                    .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))
-                    .setEndValue(simpleDateFormat.format(queryRange.getEndDate()))
-                    .build();
-            queryRangeList.add(dateRange);
-        }
-        return queryRangeList;
-    }
+  @Override
+  public Response dropIndex(@Nonnull TableParam tableParam) {
 
-    private io.milvus.client.grpc.Range getRange(@Nonnull DateRange dateRange) {
-        String datePattern = "yyyy-MM-dd";
-        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
-        return io.milvus.client.grpc.Range
-                .newBuilder()
-                .setStartValue(simpleDateFormat.format(dateRange.getStartDate()))
-                .setEndValue(simpleDateFormat.format(dateRange.getEndDate()))
-                .build();
+    if (!connected()) {
+      logWarning("You are not connected to Milvus server");
+      return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
 
-    private List<List<SearchResponse.QueryResult>> getQueryResultsList
-            (io.milvus.client.grpc.TopKQueryResultList searchResponse) {
-        //TODO: refactor
-        List<List<SearchResponse.QueryResult>> queryResultsList = new ArrayList<>();
-        Optional<List<io.milvus.client.grpc.TopKQueryResult>> topKQueryResultList
-                = Optional.ofNullable(searchResponse.getTopkQueryResultList());
-        if (topKQueryResultList.isPresent()) {
-            for (io.milvus.client.grpc.TopKQueryResult topKQueryResult : topKQueryResultList.get()) {
-                List<SearchResponse.QueryResult> responseQueryResults = new ArrayList<>();
-                List<io.milvus.client.grpc.QueryResult> queryResults = topKQueryResult.getQueryResultArraysList();
-                for (io.milvus.client.grpc.QueryResult queryResult : queryResults) {
-                    SearchResponse.QueryResult responseQueryResult
-                            = new SearchResponse.QueryResult(queryResult.getId(), queryResult.getDistance());
-                    responseQueryResults.add(responseQueryResult);
-                }
-                queryResultsList.add(responseQueryResults);
-            }
-        }
-        return queryResultsList;
-    }
+    String tableName = tableParam.getTableName();
+    io.milvus.client.grpc.TableName request =
+        io.milvus.client.grpc.TableName.newBuilder().setTableName(tableName).build();
+    io.milvus.client.grpc.Status response;
 
-    /////////////////////Log Functions//////////////////////
+    try {
+      response =
+          blockingStub
+              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
+              .dropIndex(request);
 
-    private static final String ANSI_RESET = "\u001B[0m";
-    private static final String ANSI_BLACK = "\u001B[30m";
-    private static final String ANSI_RED = "\u001B[31m";
-    private static final String ANSI_GREEN = "\u001B[32m";
-    private static final String ANSI_YELLOW = "\u001B[33m";
-    private static final String ANSI_BLUE = "\u001B[34m";
-    private static final String ANSI_PURPLE = "\u001B[35m";
-    private static final String ANSI_CYAN = "\u001B[36m";
-    private static final String ANSI_WHITE = "\u001B[37m";
+      if (response.getErrorCode() == io.milvus.client.grpc.ErrorCode.SUCCESS) {
+        logInfo("Dropped index for table `{0}` successfully!", tableName);
+        return new Response(Response.Status.SUCCESS);
+      } else {
+        logSevere("Drop index for table `{0}` failed:\n{1}", tableName, response.toString());
+        return new Response(
+            Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
+      }
+    } catch (StatusRuntimeException e) {
+      logSevere("dropIndex RPC failed:\n{0}", e.getStatus().toString());
+      return new Response(Response.Status.RPC_ERROR, e.toString());
+    }
+  }
+
+  ///////////////////// Util Functions/////////////////////
+  private List<io.milvus.client.grpc.RowRecord> getQueryRowRecordList(
+      @Nonnull SearchParam searchParam) {
+    List<io.milvus.client.grpc.RowRecord> queryRowRecordList = new ArrayList<>();
+    for (List<Float> vectors : searchParam.getQueryVectors()) {
+      io.milvus.client.grpc.RowRecord rowRecord =
+          io.milvus.client.grpc.RowRecord.newBuilder().addAllVectorData(vectors).build();
+      queryRowRecordList.add(rowRecord);
+    }
+    return queryRowRecordList;
+  }
+
+  private List<io.milvus.client.grpc.Range> getQueryRangeList(@Nonnull SearchParam searchParam) {
+    List<io.milvus.client.grpc.Range> queryRangeList = new ArrayList<>();
+    String datePattern = "yyyy-MM-dd";
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
+    for (DateRange queryRange : searchParam.getdateRanges()) {
+      io.milvus.client.grpc.Range dateRange =
+          io.milvus.client.grpc.Range.newBuilder()
+              .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))
+              .setEndValue(simpleDateFormat.format(queryRange.getEndDate()))
+              .build();
+      queryRangeList.add(dateRange);
+    }
+    return queryRangeList;
+  }
+
+  private io.milvus.client.grpc.Range getRange(@Nonnull DateRange dateRange) {
+    String datePattern = "yyyy-MM-dd";
+    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
+    return io.milvus.client.grpc.Range.newBuilder()
+        .setStartValue(simpleDateFormat.format(dateRange.getStartDate()))
+        .setEndValue(simpleDateFormat.format(dateRange.getEndDate()))
+        .build();
+  }
+
+  private List<List<SearchResponse.QueryResult>> getQueryResultsList(
+      io.milvus.client.grpc.TopKQueryResultList searchResponse) {
+    // TODO: refactor
+    List<List<SearchResponse.QueryResult>> queryResultsList = new ArrayList<>();
+    Optional<List<io.milvus.client.grpc.TopKQueryResult>> topKQueryResultList =
+        Optional.ofNullable(searchResponse.getTopkQueryResultList());
+    if (topKQueryResultList.isPresent()) {
+      for (io.milvus.client.grpc.TopKQueryResult topKQueryResult : topKQueryResultList.get()) {
+        List<SearchResponse.QueryResult> responseQueryResults = new ArrayList<>();
+        List<io.milvus.client.grpc.QueryResult> queryResults =
+            topKQueryResult.getQueryResultArraysList();
+        for (io.milvus.client.grpc.QueryResult queryResult : queryResults) {
+          SearchResponse.QueryResult responseQueryResult =
+              new SearchResponse.QueryResult(queryResult.getId(), queryResult.getDistance());
+          responseQueryResults.add(responseQueryResult);
+        }
+        queryResultsList.add(responseQueryResults);
+      }
+    }
+    return queryResultsList;
+  }
 
-    private static final String ANSI_BRIGHT_BLACK  = "\u001B[90m";
-    private static final String ANSI_BRIGHT_RED    = "\u001B[91m";
-    private static final String ANSI_BRIGHT_GREEN  = "\u001B[92m";
-    private static final String ANSI_BRIGHT_YELLOW = "\u001B[93m";
-    private static final String ANSI_BRIGHT_BLUE   = "\u001B[94m";
-    private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
-    private static final String ANSI_BRIGHT_CYAN   = "\u001B[96m";
-    private static final String ANSI_BRIGHT_WHITE  = "\u001B[97m";
+  ///////////////////// Log Functions//////////////////////
 
-    private void logInfo(String msg, Object... params) {
-        logger.log(Level.INFO, ANSI_YELLOW + msg + ANSI_RESET, params);
-    }
+  private void logInfo(String msg, Object... params) {
+    logger.log(Level.INFO, ANSI_YELLOW + msg + ANSI_RESET, params);
+  }
 
-    private void logWarning(String msg, Object... params) {
-        logger.log(Level.WARNING, ANSI_PURPLE + msg + ANSI_RESET, params);
-    }
+  private void logWarning(String msg, Object... params) {
+    logger.log(Level.WARNING, ANSI_PURPLE + msg + ANSI_RESET, params);
+  }
 
-    private void logSevere(String msg, Object... params) {
-        logger.log(Level.SEVERE, ANSI_BRIGHT_PURPLE + msg + ANSI_RESET, params);
-    }
+  private void logSevere(String msg, Object... params) {
+    logger.log(Level.SEVERE, ANSI_BRIGHT_PURPLE + msg + ANSI_RESET, params);
+  }
 }

+ 87 - 76
src/main/java/io/milvus/client/Response.java

@@ -1,3 +1,20 @@
+/*
+ * 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.client;
 
 import java.util.Arrays;
@@ -8,94 +25,88 @@ import java.util.Optional;
  */
 public class Response {
 
-    /**
-     * Represents server and client side status code
-     */
-    public enum Status {
-        //Server side error
-        SUCCESS(0),
-        UNEXPECTED_ERROR(1),
-        CONNECT_FAILED(2),
-        PERMISSION_DENIED(3),
-        TABLE_NOT_EXISTS(4),
-        ILLEGAL_ARGUMENT(5),
-        ILLEGAL_RANGE(6),
-        ILLEGAL_DIMENSION(7),
-        ILLEGAL_INDEX_TYPE(8),
-        ILLEGAL_TABLE_NAME(9),
-        ILLEGAL_TOPK(10),
-        ILLEGAL_ROWRECORD(11),
-        ILLEGAL_VECTOR_ID(12),
-        ILLEGAL_SEARCH_RESULT(13),
-        FILE_NOT_FOUND(14),
-        META_FAILED(15),
-        CACHE_FAILED(16),
-        CANNOT_CREATE_FOLDER(17),
-        CANNOT_CREATE_FILE(18),
-        CANNOT_DELETE_FOLDER(19),
-        CANNOT_DELETE_FILE(20),
-        BUILD_INDEX_ERROR(21),
-        ILLEGAL_NLIST(22),
-        ILLEGAL_METRIC_TYPE(23),
-        OUT_OF_MEMORY(24),
+    private final Status status;
+    private final String message;
+  public Response(Status status, String message) {
+    this.status = status;
+    this.message = message;
+  }
 
-        //Client side error
-        RPC_ERROR(-1),
-        CLIENT_NOT_CONNECTED(-2),
-        UNKNOWN(-3);
+  public Response(Status status) {
+    this.status = status;
+    if (status == Status.CLIENT_NOT_CONNECTED) {
+      this.message = "You are not connected to Milvus server";
+    } else {
+      this.message = "Success!";
+    }
+  }
 
-        private final int code;
+  public Status getStatus() {
+    return status;
+  }
 
-        Status(int code) {
-            this.code = code;
-        }
+  public String getMessage() {
+    return message;
+  }
 
-        public int getCode() {
-            return code;
-        }
+  /** @return <code>true</code> if status equals SUCCESS */
+  public boolean ok() {
+    return status == Status.SUCCESS;
+  }
 
-        public static Status valueOf(int val) {
-            Optional<Status> search = Arrays.stream(values())
-                                            .filter(status -> status.code == val)
-                                            .findFirst();
-            return search.orElse(UNKNOWN);
-        }
-    };
+  @Override
+  public String toString() {
+    return String.format("Response {code = %s, message = %s}", status.name(), this.message);
+  }
 
-    private final Status status;
-    private final String message;
+/** Represents server and client side status code */
+  public enum Status {
+    // Server side error
+    SUCCESS(0),
+    UNEXPECTED_ERROR(1),
+    CONNECT_FAILED(2),
+    PERMISSION_DENIED(3),
+    TABLE_NOT_EXISTS(4),
+    ILLEGAL_ARGUMENT(5),
+    ILLEGAL_RANGE(6),
+    ILLEGAL_DIMENSION(7),
+    ILLEGAL_INDEX_TYPE(8),
+    ILLEGAL_TABLE_NAME(9),
+    ILLEGAL_TOPK(10),
+    ILLEGAL_ROWRECORD(11),
+    ILLEGAL_VECTOR_ID(12),
+    ILLEGAL_SEARCH_RESULT(13),
+    FILE_NOT_FOUND(14),
+    META_FAILED(15),
+    CACHE_FAILED(16),
+    CANNOT_CREATE_FOLDER(17),
+    CANNOT_CREATE_FILE(18),
+    CANNOT_DELETE_FOLDER(19),
+    CANNOT_DELETE_FILE(20),
+    BUILD_INDEX_ERROR(21),
+    ILLEGAL_NLIST(22),
+    ILLEGAL_METRIC_TYPE(23),
+    OUT_OF_MEMORY(24),
 
-    public Response(Status status, String message) {
-        this.status = status;
-        this.message = message;
-    }
+    // Client side error
+    RPC_ERROR(-1),
+    CLIENT_NOT_CONNECTED(-2),
+    UNKNOWN(-3);
 
-    public Response(Status status) {
-        this.status = status;
-        if (status == Status.CLIENT_NOT_CONNECTED) {
-            this.message = "You are not connected to Milvus server";
-        } else {
-            this.message = "Success!";
-        }
-    }
-
-    public Status getStatus() {
-        return status;
-    }
+    private final int code;
 
-    public String getMessage() {
-        return message;
+    Status(int code) {
+      this.code = code;
     }
 
-    /**
-     * @return <code>true</code> if status equals SUCCESS
-     */
-    public boolean ok() {
-        return status == Status.SUCCESS;
+    public static Status valueOf(int val) {
+      Optional<Status> search =
+          Arrays.stream(values()).filter(status -> status.code == val).findFirst();
+      return search.orElse(UNKNOWN);
     }
 
-    @Override
-    public String toString() {
-        return String.format("Response {code = %s, message = %s}", status.name(), this.message);
+    public int getCode() {
+      return code;
     }
+  }
 }

+ 62 - 48
src/main/java/io/milvus/client/SearchInFilesParam.java

@@ -1,67 +1,81 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 import java.util.List;
 
-/**
- * Contains parameters for <code>searchInFiles</code>
- */
+/** Contains parameters for <code>searchInFiles</code> */
 public class SearchInFilesParam {
-    private final List<String> fileIds;
-    private final SearchParam searchParam;
-    private final long timeout;
+  private final List<String> fileIds;
+  private final SearchParam searchParam;
+  private final long timeout;
 
-    /**
-     * Builder for <code>SearchInFilesParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final List<String> fileIds;
-        private final SearchParam searchParam;
+  private SearchInFilesParam(@Nonnull Builder builder) {
+    this.fileIds = builder.fileIds;
+    this.searchParam = builder.searchParam;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private long timeout = 86400;
+  public List<String> getFileIds() {
+    return fileIds;
+  }
 
-        /**
-         * @param fileIds a <code>List</code> of file ids to search from
-         * @param searchParam a <code>searchParam</code> object
-         */
-        public Builder(List<String> fileIds, SearchParam searchParam) {
-            this.fileIds = fileIds;
-            this.searchParam = searchParam;
-        }
+  public SearchParam getSearchParam() {
+    return searchParam;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-        public SearchInFilesParam build() {
-            return new SearchInFilesParam(this);
-        }
-    }
+  /** Builder for <code>SearchInFilesParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final List<String> fileIds;
+    private final SearchParam searchParam;
 
-    private SearchInFilesParam(@Nonnull Builder builder) {
-        this.fileIds = builder.fileIds;
-        this.searchParam = builder.searchParam;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private long timeout = 86400;
 
-    public List<String> getFileIds() {
-        return fileIds;
+    /**
+     * @param fileIds a <code>List</code> of file ids to search from
+     * @param searchParam a <code>searchParam</code> object
+     */
+    public Builder(List<String> fileIds, SearchParam searchParam) {
+      this.fileIds = fileIds;
+      this.searchParam = searchParam;
     }
 
-    public SearchParam getSearchParam() {
-        return searchParam;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    public long getTimeout() {
-        return timeout;
+    public SearchInFilesParam build() {
+      return new SearchInFilesParam(this);
     }
+  }
 }

+ 115 - 96
src/main/java/io/milvus/client/SearchParam.java

@@ -1,121 +1,140 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 import java.util.ArrayList;
 import java.util.List;
 
-/**
- * Contains parameters for <code>search</code>
- */
+/** Contains parameters for <code>search</code> */
 public class SearchParam {
 
+  private final String tableName;
+  private final List<List<Float>> queryVectors;
+  private final List<DateRange> dateRanges;
+  private final long topK;
+  private final long nProbe;
+  private final long timeout;
+
+  private SearchParam(@Nonnull Builder builder) {
+    this.tableName = builder.tableName;
+    this.queryVectors = builder.queryVectors;
+    this.dateRanges = builder.dateRanges;
+    this.nProbe = builder.nProbe;
+    this.topK = builder.topK;
+    this.timeout = builder.timeout;
+  }
+
+  public String getTableName() {
+    return tableName;
+  }
+
+  public List<List<Float>> getQueryVectors() {
+    return queryVectors;
+  }
+
+  public List<DateRange> getdateRanges() {
+    return dateRanges;
+  }
+
+  public long getTopK() {
+    return topK;
+  }
+
+  public long getNProbe() {
+    return nProbe;
+  }
+
+  public long getTimeout() {
+    return timeout;
+  }
+
+  /** Builder for <code>SearchParam</code> */
+  public static class Builder {
+    // Required parameters
     private final String tableName;
     private final List<List<Float>> queryVectors;
-    private final List<DateRange> dateRanges;
-    private final long topK;
-    private final long nProbe;
-    private final long timeout;
+
+    // Optional parameters - initialized to default values
+    private List<DateRange> dateRanges = new ArrayList<>();
+    private long topK = 1024;
+    private long nProbe = 20;
+    private long timeout = 86400;
 
     /**
-     * Builder for <code>SearchParam</code>
+     * @param tableName table to search from
+     * @param queryVectors a <code>List</code> of vectors to be queried. Each inner <code>List
+     *     </code> represents a vector.
      */
-    public static class Builder {
-        // Required parameters
-        private final String tableName;
-        private final List<List<Float>> queryVectors;
-
-        // Optional parameters - initialized to default values
-        private List<DateRange> dateRanges = new ArrayList<>();
-        private long topK = 1024;
-        private long nProbe = 20;
-        private long timeout = 86400;
-
-        /**
-         * @param tableName table to search from
-         * @param queryVectors a <code>List</code> of vectors to be queried. Each inner <code>List</code> represents a vector.
-         */
-        public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> queryVectors) {
-            this.tableName = tableName;
-            this.queryVectors = queryVectors;
-        }
-
-        /**
-         * Optional. Searches vectors in their corresponding date range. Default to an empty <code>ArrayList</code>
-         * @param dateRanges a <code>List</code> of <code>DateRange</code> objects
-         * @return <code>Builder</code>
-         * @see DateRange
-         */
-        public Builder withDateRanges(@Nonnull List<DateRange> dateRanges) {
-            this.dateRanges = dateRanges;
-            return this;
-        }
-
-        /**
-         * Optional. Limits search result to <code>topK</code>. Default to 1024.
-         * @param topK a topK number
-         * @return <code>Builder</code>
-         */
-        public Builder withTopK(long topK) {
-            this.topK = topK;
-            return this;
-        }
-
-        /**
-         * Optional. Default to 20.
-         * @param nProbe a nProbe number
-         * @return <code>Builder</code>
-         */
-        public Builder withNProbe(long nProbe) {
-            this.nProbe = nProbe;
-            return this;
-        }
-
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
-
-        public SearchParam build() {
-            return new SearchParam(this);
-        }
-    }
-
-    private SearchParam(@Nonnull Builder builder) {
-        this.tableName = builder.tableName;
-        this.queryVectors = builder.queryVectors;
-        this.dateRanges = builder.dateRanges;
-        this.nProbe = builder.nProbe;
-        this.topK = builder.topK;
-        this.timeout = builder.timeout;
-    }
-
-    public String getTableName() {
-        return tableName;
+    public Builder(@Nonnull String tableName, @Nonnull List<List<Float>> queryVectors) {
+      this.tableName = tableName;
+      this.queryVectors = queryVectors;
     }
 
-    public List<List<Float>> getQueryVectors() {
-        return queryVectors;
+    /**
+     * Optional. Searches vectors in their corresponding date range. Default to an empty <code>
+     * ArrayList</code>
+     *
+     * @param dateRanges a <code>List</code> of <code>DateRange</code> objects
+     * @return <code>Builder</code>
+     * @see DateRange
+     */
+    public Builder withDateRanges(@Nonnull List<DateRange> dateRanges) {
+      this.dateRanges = dateRanges;
+      return this;
     }
 
-    public List<DateRange> getdateRanges() {
-        return dateRanges;
+    /**
+     * Optional. Limits search result to <code>topK</code>. Default to 1024.
+     *
+     * @param topK a topK number
+     * @return <code>Builder</code>
+     */
+    public Builder withTopK(long topK) {
+      this.topK = topK;
+      return this;
     }
 
-    public long getTopK() {
-        return topK;
+    /**
+     * Optional. Default to 20.
+     *
+     * @param nProbe a nProbe number
+     * @return <code>Builder</code>
+     */
+    public Builder withNProbe(long nProbe) {
+      this.nProbe = nProbe;
+      return this;
     }
 
-    public long getNProbe() {
-        return nProbe;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    public long getTimeout() {
-        return timeout;
+    public SearchParam build() {
+      return new SearchParam(this);
     }
+  }
 }

+ 85 - 67
src/main/java/io/milvus/client/SearchResponse.java

@@ -1,91 +1,109 @@
+/*
+ * 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.client;
 
 import java.util.ArrayList;
 import java.util.List;
 
 /**
- * Contains the returned <code>response</code> and <code>queryResultsList</code> for <code>search</code>
+ * Contains the returned <code>response</code> and <code>queryResultsList</code> for <code>search
+ * </code>
  */
 public class SearchResponse {
 
-    private final Response response;
+  private final Response response;
+  private final List<List<QueryResult>> queryResultsList;
 
-    /**
-     * Represents a single result of a vector query. Contains the result <code>vectorId</code> and its
-     * <code>distance</code> to the vector being queried
-     */
-    public static class QueryResult {
-        private final long vectorId;
-        private final double distance;
+  public SearchResponse(Response response, List<List<QueryResult>> queryResultsList) {
+    this.response = response;
+    this.queryResultsList = queryResultsList;
+  }
 
-        public QueryResult(long vectorId, double distance) {
-            this.vectorId = vectorId;
-            this.distance = distance;
-        }
+  /**
+   * @return a <code>List</code> of <code>QueryResult</code>s. Each inner <code>List</code> contains
+   *     the query result of a vector.
+   */
+  public List<List<QueryResult>> getQueryResultsList() {
+    return queryResultsList;
+  }
 
-        public long getVectorId() {
-            return vectorId;
-        }
-
-        public double getDistance() {
-            return distance;
-        }
+  /**
+   * @return a <code>List</code> of result ids. Each inner <code>List</code> contains the result ids
+   *     of a vector.
+   */
+  public List<List<Long>> getResultIdsList() {
+    List<List<Long>> resultIdsList = new ArrayList<>();
+    for (List<QueryResult> queryResults : queryResultsList) {
+      List<Long> resultIds = new ArrayList<>();
+      for (QueryResult queryResult : queryResults) {
+        resultIds.add(queryResult.vectorId);
+      }
+      resultIdsList.add(resultIds);
     }
+    return resultIdsList;
+  }
 
-    private final List<List<QueryResult>> queryResultsList;
-
-    public SearchResponse(Response response, List<List<QueryResult>> queryResultsList) {
-        this.response = response;
-        this.queryResultsList = queryResultsList;
+  /**
+   * @return @return a <code>List</code> of result distances. Each inner <code>List</code> contains
+   *     the result distances of a vector.
+   */
+  public List<List<Double>> getResultDistancesList() {
+    List<List<Double>> resultDistancesList = new ArrayList<>();
+    for (List<QueryResult> queryResults : queryResultsList) {
+      List<Double> resultDistances = new ArrayList<>();
+      for (QueryResult queryResult : queryResults) {
+        resultDistances.add(queryResult.distance);
+      }
+      resultDistancesList.add(resultDistances);
     }
+    return resultDistancesList;
+  }
 
-    /**
-     * @return a <code>List</code> of <code>QueryResult</code>s. Each inner <code>List</code> contains
-     * the query result of a vector.
-     */
-    public List<List<QueryResult>> getQueryResultsList() {
-        return queryResultsList;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    /**
-     * @return a <code>List</code> of result ids. Each inner <code>List</code> contains
-     * the result ids of a vector.
-     */
-    public List<List<Long>> getResultIdsList() {
-        List<List<Long>> resultIdsList = new ArrayList<>();
-        for (List<QueryResult> queryResults : queryResultsList) {
-            List<Long> resultIds = new ArrayList<>();
-            for (QueryResult queryResult : queryResults) {
-                resultIds.add(queryResult.vectorId);
-            }
-            resultIdsList.add(resultIds);
-        }
-        return resultIdsList;
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "SearchResponse {%s, returned results for %d queries}",
+        response.toString(), this.queryResultsList.size());
+  }
+
+  /**
+   * Represents a single result of a vector query. Contains the result <code>vectorId</code> and its
+   * <code>distance</code> to the vector being queried
+   */
+  public static class QueryResult {
+    private final long vectorId;
+    private final double distance;
 
-    /**
-     * @return @return a <code>List</code> of result distances. Each inner <code>List</code> contains
-     * the result distances of a vector.
-     */
-    public List<List<Double>> getResultDistancesList() {
-        List<List<Double>> resultDistancesList = new ArrayList<>();
-        for (List<QueryResult> queryResults : queryResultsList) {
-            List<Double> resultDistances = new ArrayList<>();
-            for (QueryResult queryResult : queryResults) {
-                resultDistances.add(queryResult.distance);
-            }
-            resultDistancesList.add(resultDistances);
-        }
-        return resultDistancesList;
+    public QueryResult(long vectorId, double distance) {
+      this.vectorId = vectorId;
+      this.distance = distance;
     }
 
-    public Response getResponse() {
-        return response;
+    public long getVectorId() {
+      return vectorId;
     }
 
-    @Override
-    public String toString() {
-        return String.format("SearchResponse {%s, returned results for %d queries}",
-                              response.toString(), this.queryResultsList.size());
+    public double getDistance() {
+      return distance;
     }
+  }
 }

+ 36 - 19
src/main/java/io/milvus/client/ShowTablesResponse.java

@@ -1,31 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 package io.milvus.client;
 
 import java.util.List;
 
 /**
- * Contains the returned <code>response</code> and <code>tableNames</code> for <code>showTables</code>
+ * Contains the returned <code>response</code> and <code>tableNames</code> for <code>showTables
+ * </code>
  */
 public class ShowTablesResponse {
-    private final Response response;
-    private final List<String> tableNames;
+  private final Response response;
+  private final List<String> tableNames;
 
-    public ShowTablesResponse(Response response, List<String> tableNames) {
-        this.response = response;
-        this.tableNames = tableNames;
-    }
+  public ShowTablesResponse(Response response, List<String> tableNames) {
+    this.response = response;
+    this.tableNames = tableNames;
+  }
 
-    public List<String> getTableNames() {
-        return tableNames;
-    }
+  public List<String> getTableNames() {
+    return tableNames;
+  }
 
-    public Response getResponse() {
-        return response;
-    }
+  public Response getResponse() {
+    return response;
+  }
 
-    @Override
-    public String toString() {
-        return String.format("ShowTablesResponse {%s, table names = %s}",
-                              response,
-                              tableNames.toString());
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "ShowTablesResponse {%s, table names = %s}", response, tableNames.toString());
+  }
 }

+ 58 - 46
src/main/java/io/milvus/client/TableParam.java

@@ -1,66 +1,78 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
 /**
- * Contains parameters for <code>hasTable</code>, <code>dropTable</code>, <code>describeTable</code>,
- * <code>getTableRowCount</code>, <code>preloadTable</code>, <code>describeIndex</code> and <code>dropIndex</code>
+ * Contains parameters for <code>hasTable</code>, <code>dropTable</code>, <code>describeTable</code>
+ * , <code>getTableRowCount</code>, <code>preloadTable</code>, <code>describeIndex</code> and <code>
+ * dropIndex</code>
  */
 public class TableParam {
-    private final String tableName;
-    private final long timeout;
+  private final String tableName;
+  private final long timeout;
 
-    /**
-     * Builder for <code>TableParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final String tableName;
+  private TableParam(@Nonnull Builder builder) {
+    this.tableName = builder.tableName;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private long timeout = 86400;
+  public String getTableName() {
+    return tableName;
+  }
 
-        /**
-         * @param tableName table name
-         */
-        public Builder(@Nonnull String tableName) {
-            this.tableName = tableName;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  @Override
+  public String toString() {
+    return "TableParam {" + "tableName = '" + tableName + '\'' + ", timeout = " + timeout + '}';
+  }
 
-        public TableParam build() {
-            return new TableParam(this);
-        }
-    }
+  /** Builder for <code>TableParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final String tableName;
 
-    private TableParam(@Nonnull Builder builder) {
-        this.tableName = builder.tableName;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private long timeout = 86400;
 
-    public String getTableName() {
-        return tableName;
+    /** @param tableName table name */
+    public Builder(@Nonnull String tableName) {
+      this.tableName = tableName;
     }
 
-    public long getTimeout() {
-        return timeout;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "TableParam {" +
-                "tableName = '" + tableName + '\'' +
-                ", timeout = " + timeout +
-                '}';
+    public TableParam build() {
+      return new TableParam(this);
     }
+  }
 }

+ 84 - 68
src/main/java/io/milvus/client/TableSchema.java

@@ -1,90 +1,106 @@
+/*
+ * 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.client;
 
-import javax.annotation.*;
+import javax.annotation.Nonnull;
 
-/**
- * Represents a table schema
- */
+/** Represents a table schema */
 // Builder Pattern
 public class TableSchema {
-    private final String tableName;
-    private final long dimension;
-    private final long indexFileSize;
-    private final MetricType metricType;
+  private final String tableName;
+  private final long dimension;
+  private final long indexFileSize;
+  private final MetricType metricType;
 
-    /**
-     * Builder for <code>TableSchema</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final String tableName;
-        private final long dimension;
+  private TableSchema(@Nonnull Builder builder) {
+    tableName = builder.tableName;
+    dimension = builder.dimension;
+    indexFileSize = builder.indexFileSize;
+    metricType = builder.metricType;
+  }
 
-        // Optional parameters - initialized to default values
-        private long indexFileSize = 1024;
-        private MetricType metricType = MetricType.L2;
+  public String getTableName() {
+    return tableName;
+  }
 
-        /**
-         * @param tableName table name
-         * @param dimension vector dimension
-         */
-        public Builder(@Nonnull String tableName, long dimension) {
-            this.tableName = tableName;
-            this.dimension = dimension;
-        }
+  public long getDimension() {
+    return dimension;
+  }
 
-        /**
-         * Optional. Default to 1024 MB.
-         * @param indexFileSize in megabytes.
-         * @return <code>Builder</code>
-         */
-        public Builder withIndexFileSize(long indexFileSize) {
-            this.indexFileSize = indexFileSize;
-            return this;
-        }
+  public long getIndexFileSize() {
+    return indexFileSize;
+  }
 
-        /**
-         * Optional. Default to MetricType.L2
-         * @param metricType a <code>MetricType</code> value
-         * @return <code>Builder</code>
-         * @see MetricType
-         */
-        public Builder withMetricType(@Nonnull MetricType metricType) {
-            this.metricType = metricType;
-            return this;
-        }
+  public MetricType getMetricType() {
+    return metricType;
+  }
 
-        public TableSchema build() {
-            return new TableSchema(this);
-        }
-    }
+  @Override
+  public String toString() {
+    return String.format(
+        "TableSchema = {tableName = %s, dimension = %d, indexFileSize = %d, metricType = %s}",
+        tableName, dimension, indexFileSize, metricType.name());
+  }
 
-    private TableSchema(@Nonnull Builder builder) {
-        tableName = builder.tableName;
-        dimension = builder.dimension;
-        indexFileSize = builder.indexFileSize;
-        metricType = builder.metricType;
-    }
+  /** Builder for <code>TableSchema</code> */
+  public static class Builder {
+    // Required parameters
+    private final String tableName;
+    private final long dimension;
 
-    public String getTableName() {
-        return tableName;
-    }
+    // Optional parameters - initialized to default values
+    private long indexFileSize = 1024;
+    private MetricType metricType = MetricType.L2;
 
-    public long getDimension() {
-        return dimension;
+    /**
+     * @param tableName table name
+     * @param dimension vector dimension
+     */
+    public Builder(@Nonnull String tableName, long dimension) {
+      this.tableName = tableName;
+      this.dimension = dimension;
     }
 
-    public long getIndexFileSize() {
-        return indexFileSize;
+    /**
+     * Optional. Default to 1024 MB.
+     *
+     * @param indexFileSize in megabytes.
+     * @return <code>Builder</code>
+     */
+    public Builder withIndexFileSize(long indexFileSize) {
+      this.indexFileSize = indexFileSize;
+      return this;
     }
 
-    public MetricType getMetricType() {
-        return metricType;
+    /**
+     * Optional. Default to MetricType.L2
+     *
+     * @param metricType a <code>MetricType</code> value
+     * @return <code>Builder</code>
+     * @see MetricType
+     */
+    public Builder withMetricType(@Nonnull MetricType metricType) {
+      this.metricType = metricType;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return String.format("TableSchema = {tableName = %s, dimension = %d, indexFileSize = %d, metricType = %s}",
-                             tableName, dimension, indexFileSize, metricType.name());
+    public TableSchema build() {
+      return new TableSchema(this);
     }
+  }
 }

+ 59 - 48
src/main/java/io/milvus/client/TableSchemaParam.java

@@ -1,66 +1,77 @@
+/*
+ * 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.client;
 
 import javax.annotation.Nonnull;
 
-/**
- * Contains parameters for <code>createTable</code>
- */
+/** Contains parameters for <code>createTable</code> */
 public class TableSchemaParam {
-    private final TableSchema tableSchema;
-    private final long timeout;
+  private final TableSchema tableSchema;
+  private final long timeout;
 
-    /**
-     * Builder for <code>TableSchemaParam</code>
-     */
-    public static class Builder {
-        // Required parameters
-        private final TableSchema tableSchema;
+  private TableSchemaParam(@Nonnull Builder builder) {
+    this.tableSchema = builder.tableSchema;
+    this.timeout = builder.timeout;
+  }
 
-        // Optional parameters - initialized to default values
-        private long timeout = 86400;
+  public TableSchema getTableSchema() {
+    return tableSchema;
+  }
 
-        /**
-         * @param tableSchema a <code>TableSchema</code> object
-         * @see TableSchema
-         */
-        public Builder(@Nonnull TableSchema tableSchema) {
-            this.tableSchema = tableSchema;
-        }
+  public long getTimeout() {
+    return timeout;
+  }
 
-         /**
-         * Optional. Sets the deadline from when the client RPC is set to when the response is picked up by the client.
-         * Default to 86400s (1 day).
-         * @param timeout in seconds
-         * @return <code>Builder</code>
-         */
-        public Builder withTimeout(long timeout) {
-            this.timeout = timeout;
-            return this;
-        }
+  @Override
+  public String toString() {
+    return "CreateTableParam {" + tableSchema + ", timeout = " + timeout + '}';
+  }
 
-        public TableSchemaParam build() {
-            return new TableSchemaParam(this);
-        }
-    }
+  /** Builder for <code>TableSchemaParam</code> */
+  public static class Builder {
+    // Required parameters
+    private final TableSchema tableSchema;
 
-    private TableSchemaParam(@Nonnull Builder builder) {
-        this.tableSchema = builder.tableSchema;
-        this.timeout = builder.timeout;
-    }
+    // Optional parameters - initialized to default values
+    private long timeout = 86400;
 
-    public TableSchema getTableSchema() {
-        return tableSchema;
+    /**
+     * @param tableSchema a <code>TableSchema</code> object
+     * @see TableSchema
+     */
+    public Builder(@Nonnull TableSchema tableSchema) {
+      this.tableSchema = tableSchema;
     }
 
-    public long getTimeout() {
-        return timeout;
+    /**
+     * Optional. Sets the deadline from when the client RPC is set to when the response is picked up
+     * by the client. Default to 86400s (1 day).
+     *
+     * @param timeout in seconds
+     * @return <code>Builder</code>
+     */
+    public Builder withTimeout(long timeout) {
+      this.timeout = timeout;
+      return this;
     }
 
-    @Override
-    public String toString() {
-        return "CreateTableParam {" +
-                tableSchema +
-                ", timeout = " + timeout +
-                '}';
+    public TableSchemaParam build() {
+      return new TableSchemaParam(this);
     }
+  }
 }

+ 248 - 242
src/test/java/io/milvus/client/MilvusGrpcClientTest.java

@@ -1,256 +1,262 @@
+/*
+ * 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.client;
 
-import io.grpc.inprocess.InProcessChannelBuilder;
-import io.grpc.inprocess.InProcessServerBuilder;
-import io.grpc.testing.GrpcCleanupRule;
-import io.grpc.util.MutableHandlerRegistry;
-import org.junit.Rule;
 import org.apache.commons.text.RandomStringGenerator;
 
 import java.util.*;
 import java.util.concurrent.TimeUnit;
-import java.util.function.Function;
 import java.util.stream.Collectors;
 
 import static org.junit.jupiter.api.Assertions.*;
 
 class MilvusGrpcClientTest {
 
-    private MilvusGrpcClient client;
-
-    private RandomStringGenerator generator;
-
-    private String randomTableName;
-    private long size;
-    private long dimension;
-    private TableParam tableParam;
-    private TableSchema tableSchema;
-
-    @org.junit.jupiter.api.BeforeEach
-    void setUp() throws Exception {
-
-        client = new MilvusGrpcClient();
-        ConnectParam connectParam = new ConnectParam.Builder()
-                                        .withHost("localhost")
-                                        .withPort("19530")
-                                        .build();
-        client.connect(connectParam);
-
-        generator = new RandomStringGenerator.Builder()
-                                            .withinRange('a', 'z').build();
-        randomTableName = generator.generate(10);
-        size = 100;
-        dimension = 128;
-        tableParam = new TableParam.Builder(randomTableName).build();
-        tableSchema = new TableSchema.Builder(randomTableName, dimension)
-                                                    .withIndexFileSize(1024)
-                                                    .withMetricType(MetricType.IP)
-                                                    .build();
-        TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
-
-        assertTrue(client.createTable(tableSchemaParam).ok());
-    }
-
-    @org.junit.jupiter.api.AfterEach
-    void tearDown() throws InterruptedException {
-        assertTrue(client.dropTable(tableParam).ok());
-        client.disconnect();
-    }
-
-    @org.junit.jupiter.api.Test
-    void connected() {
-        assertTrue(client.connected());
-    }
-
-    @org.junit.jupiter.api.Test
-    void createTable() {
-        String invalidTableName = "╯°□°)╯";
-        TableSchema invalidTableSchema = new TableSchema.Builder(invalidTableName, dimension).build();
-        TableSchemaParam invalidTableSchemaParam = new TableSchemaParam.Builder(invalidTableSchema).withTimeout(20).build();
-        Response createTableResponse = client.createTable(invalidTableSchemaParam);
-        assertFalse(createTableResponse.ok());
-        assertEquals(Response.Status.ILLEGAL_TABLE_NAME, createTableResponse.getStatus());
-    }
-
-    @org.junit.jupiter.api.Test
-    void hasTable() {
-        HasTableResponse hasTableResponse = client.hasTable(tableParam);
-        assertTrue(hasTableResponse.getResponse().ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void dropTable() {
-        String nonExistingTableName = generator.generate(10);
-        TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
-        Response dropTableResponse = client.dropTable(tableParam);
-        assertFalse(dropTableResponse.ok());
-        assertEquals(Response.Status.TABLE_NOT_EXISTS, dropTableResponse.getStatus());
-    }
-
-    @org.junit.jupiter.api.Test
-    void createIndex() {
-        Index index = new Index.Builder()
-                                .withIndexType(IndexType.IVF_SQ8)
-                                .withNList(16384)
-                                .build();
-        IndexParam indexParam = new IndexParam.Builder(randomTableName)
-                                                .withIndex(index)
-                                                .build();
-        Response createIndexResponse = client.createIndex(indexParam);
-        assertTrue(createIndexResponse.ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void insert() {
-        Random random = new Random();
-        List<List<Float>> vectors = new ArrayList<>();
-        for (int i = 0; i < size; ++i) {
-            List<Float> vector = new ArrayList<>();
-            for (int j = 0; j < dimension; ++j) {
-                vector.add(random.nextFloat());
-            }
-            vectors.add(vector);
-        }
-        InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
-        InsertResponse insertResponse = client.insert(insertParam);
-        assertTrue(insertResponse.getResponse().ok());
-        assertEquals(size, insertResponse.getVectorIds().size());
-    }
-
-    List<Float> normalize(List<Float> vector) {
-        float squareSum = vector.stream().map(x -> x * x).reduce((float) 0, Float::sum);
-        final float norm = (float) Math.sqrt(squareSum);
-        vector = vector.stream().map(x -> x / norm).collect(Collectors.toList());
-        return vector;
-    }
-
-    @org.junit.jupiter.api.Test
-    void search() throws InterruptedException {
-        Random random = new Random();
-        List<List<Float>> vectors = new ArrayList<>();
-        List<List<Float>> vectorsToSearch = new ArrayList<>();
-        int searchSize = 5;
-        for (int i = 0; i < size; ++i) {
-            List<Float> vector = new ArrayList<>();
-            for (int j = 0; j < dimension; ++j) {
-                vector.add(random.nextFloat());
-            }
-            if (tableSchema.getMetricType() == MetricType.IP) {
-                vector = normalize(vector);
-            }
-            vectors.add(vector);
-            if (i < searchSize) {
-                vectorsToSearch.add(vector);
-            }
-        }
-        InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
-        InsertResponse insertResponse = client.insert(insertParam);
-        assertTrue(insertResponse.getResponse().ok());
-        assertEquals(size, insertResponse.getVectorIds().size());
-
-        TimeUnit.SECONDS.sleep(1);
-
-        List<DateRange> queryRanges = new ArrayList<>();
-        Date today = new Date();
-        Calendar c = Calendar.getInstance();
-        c.setTime(today);
-        c.add(Calendar.DAY_OF_MONTH, -1);
-        Date yesterday = c.getTime();
-        c.setTime(today);
-        c.add(Calendar.DAY_OF_MONTH, 1);
-        Date tomorrow = c.getTime();
-        queryRanges.add(new DateRange(yesterday, tomorrow));
-        System.out.println(queryRanges);
-        SearchParam searchParam = new SearchParam
-                                        .Builder(randomTableName, vectorsToSearch)
-                                        .withTopK(1)
-                                        .withNProbe(20)
-                                        .withDateRanges(queryRanges)
-                                        .build();
-        SearchResponse searchResponse = client.search(searchParam);
-        assertTrue(searchResponse.getResponse().ok());
-        System.out.println(searchResponse);
-        assertEquals(searchSize, searchResponse.getQueryResultsList().size());
+  private MilvusGrpcClient client;
+
+  private RandomStringGenerator generator;
+
+  private String randomTableName;
+  private long size;
+  private long dimension;
+  private TableParam tableParam;
+  private TableSchema tableSchema;
+
+  @org.junit.jupiter.api.BeforeEach
+  void setUp() throws Exception {
+
+    client = new MilvusGrpcClient();
+    ConnectParam connectParam =
+        new ConnectParam.Builder().withHost("localhost").withPort("19530").build();
+    client.connect(connectParam);
+
+    generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
+    randomTableName = generator.generate(10);
+    size = 100;
+    dimension = 128;
+    tableParam = new TableParam.Builder(randomTableName).build();
+    tableSchema =
+        new TableSchema.Builder(randomTableName, dimension)
+            .withIndexFileSize(1024)
+            .withMetricType(MetricType.IP)
+            .build();
+    TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
+
+    assertTrue(client.createTable(tableSchemaParam).ok());
+  }
+
+  @org.junit.jupiter.api.AfterEach
+  void tearDown() throws InterruptedException {
+    assertTrue(client.dropTable(tableParam).ok());
+    client.disconnect();
+  }
+
+  @org.junit.jupiter.api.Test
+  void connected() {
+    assertTrue(client.connected());
+  }
+
+  @org.junit.jupiter.api.Test
+  void createTable() {
+    String invalidTableName = "╯°□°)╯";
+    TableSchema invalidTableSchema = new TableSchema.Builder(invalidTableName, dimension).build();
+    TableSchemaParam invalidTableSchemaParam =
+        new TableSchemaParam.Builder(invalidTableSchema).withTimeout(20).build();
+    Response createTableResponse = client.createTable(invalidTableSchemaParam);
+    assertFalse(createTableResponse.ok());
+    assertEquals(Response.Status.ILLEGAL_TABLE_NAME, createTableResponse.getStatus());
+  }
+
+  @org.junit.jupiter.api.Test
+  void hasTable() {
+    HasTableResponse hasTableResponse = client.hasTable(tableParam);
+    assertTrue(hasTableResponse.getResponse().ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void dropTable() {
+    String nonExistingTableName = generator.generate(10);
+    TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
+    Response dropTableResponse = client.dropTable(tableParam);
+    assertFalse(dropTableResponse.ok());
+    assertEquals(Response.Status.TABLE_NOT_EXISTS, dropTableResponse.getStatus());
+  }
+
+  @org.junit.jupiter.api.Test
+  void createIndex() {
+    Index index = new Index.Builder().withIndexType(IndexType.IVF_SQ8).withNList(16384).build();
+    CreateIndexParam createIndexParam =
+        new CreateIndexParam.Builder(randomTableName).withIndex(index).build();
+    Response createIndexResponse = client.createIndex(createIndexParam);
+    assertTrue(createIndexResponse.ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void insert() {
+    Random random = new Random();
+    List<List<Float>> vectors = new ArrayList<>();
+    for (int i = 0; i < size; ++i) {
+      List<Float> vector = new ArrayList<>();
+      for (int j = 0; j < dimension; ++j) {
+        vector.add(random.nextFloat());
+      }
+      vectors.add(vector);
     }
-
-//    @org.junit.jupiter.api.Test
-//    void searchInFiles() {
-//    }
-
-    @org.junit.jupiter.api.Test
-    void describeTable() {
-        DescribeTableResponse describeTableResponse = client.describeTable(tableParam);
-        assertTrue(describeTableResponse.getResponse().ok());
-        assertTrue(describeTableResponse.getTableSchema().isPresent());
-
-        String nonExistingTableName = generator.generate(10);
-        TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
-        describeTableResponse = client.describeTable(tableParam);
-        assertFalse(describeTableResponse.getResponse().ok());
-        assertFalse(describeTableResponse.getTableSchema().isPresent());
-    }
-
-    @org.junit.jupiter.api.Test
-    void showTables() {
-        ShowTablesResponse showTablesResponse = client.showTables();
-        assertTrue(showTablesResponse.getResponse().ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void serverStatus() {
-        Response serverStatusResponse = client.serverStatus();
-        assertTrue(serverStatusResponse.ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void serverVersion() {
-        Response serverVersionResponse = client.serverVersion();
-        assertTrue(serverVersionResponse.ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void getTableRowCount() throws InterruptedException {
-        insert();
-        TimeUnit.SECONDS.sleep(1);
-
-        GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
-        assertTrue(getTableRowCountResponse.getResponse().ok());
-        assertEquals(size, getTableRowCountResponse.getTableRowCount());
-    }
-
-    @org.junit.jupiter.api.Test
-    void deleteByRange() {
-        Date today = new Date();
-        Calendar c = Calendar.getInstance();
-        c.setTime(today);
-        c.add(Calendar.DAY_OF_MONTH, -1);
-        Date yesterday = c.getTime();
-        c.setTime(today);
-        c.add(Calendar.DAY_OF_MONTH, 1);
-        Date tomorrow = c.getTime();
-
-        DeleteByRangeParam deleteByRangeParam = new DeleteByRangeParam.Builder(
-                new DateRange(yesterday, tomorrow), randomTableName).build();
-        Response deleteByRangeResponse = client.deleteByRange(deleteByRangeParam);
-        assertTrue(deleteByRangeResponse.ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void preloadTable() {
-        Response preloadTableResponse = client.preloadTable(tableParam);
-        assertTrue(preloadTableResponse.ok());
-    }
-
-    @org.junit.jupiter.api.Test
-    void describeIndex() {
-        DescribeIndexResponse describeIndexResponse = client.describeIndex(tableParam);
-        assertTrue(describeIndexResponse.getResponse().ok());
-        assertTrue(describeIndexResponse.getIndex().isPresent());
-    }
-
-    @org.junit.jupiter.api.Test
-    void dropIndex() {
-        Response dropIndexResponse = client.dropIndex(tableParam);
-        assertTrue(dropIndexResponse.ok());
+    InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
+    InsertResponse insertResponse = client.insert(insertParam);
+    assertTrue(insertResponse.getResponse().ok());
+    assertEquals(size, insertResponse.getVectorIds().size());
+  }
+
+  List<Float> normalize(List<Float> vector) {
+    float squareSum = vector.stream().map(x -> x * x).reduce((float) 0, Float::sum);
+    final float norm = (float) Math.sqrt(squareSum);
+    vector = vector.stream().map(x -> x / norm).collect(Collectors.toList());
+    return vector;
+  }
+
+  @org.junit.jupiter.api.Test
+  void search() throws InterruptedException {
+    Random random = new Random();
+    List<List<Float>> vectors = new ArrayList<>();
+    List<List<Float>> vectorsToSearch = new ArrayList<>();
+    int searchSize = 5;
+    for (int i = 0; i < size; ++i) {
+      List<Float> vector = new ArrayList<>();
+      for (int j = 0; j < dimension; ++j) {
+        vector.add(random.nextFloat());
+      }
+      if (tableSchema.getMetricType() == MetricType.IP) {
+        vector = normalize(vector);
+      }
+      vectors.add(vector);
+      if (i < searchSize) {
+        vectorsToSearch.add(vector);
+      }
     }
-}
+    InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
+    InsertResponse insertResponse = client.insert(insertParam);
+    assertTrue(insertResponse.getResponse().ok());
+    assertEquals(size, insertResponse.getVectorIds().size());
+
+    TimeUnit.SECONDS.sleep(1);
+
+    List<DateRange> queryRanges = new ArrayList<>();
+    Date today = new Date();
+    Calendar c = Calendar.getInstance();
+    c.setTime(today);
+    c.add(Calendar.DAY_OF_MONTH, -1);
+    Date yesterday = c.getTime();
+    c.setTime(today);
+    c.add(Calendar.DAY_OF_MONTH, 1);
+    Date tomorrow = c.getTime();
+    queryRanges.add(new DateRange(yesterday, tomorrow));
+    System.out.println(queryRanges);
+    SearchParam searchParam =
+        new SearchParam.Builder(randomTableName, vectorsToSearch)
+            .withTopK(1)
+            .withNProbe(20)
+            .withDateRanges(queryRanges)
+            .build();
+    SearchResponse searchResponse = client.search(searchParam);
+    assertTrue(searchResponse.getResponse().ok());
+    System.out.println(searchResponse);
+    assertEquals(searchSize, searchResponse.getQueryResultsList().size());
+  }
+
+  //    @org.junit.jupiter.api.Test
+  //    void searchInFiles() {
+  //    }
+
+  @org.junit.jupiter.api.Test
+  void describeTable() {
+    DescribeTableResponse describeTableResponse = client.describeTable(tableParam);
+    assertTrue(describeTableResponse.getResponse().ok());
+    assertTrue(describeTableResponse.getTableSchema().isPresent());
+
+    String nonExistingTableName = generator.generate(10);
+    TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
+    describeTableResponse = client.describeTable(tableParam);
+    assertFalse(describeTableResponse.getResponse().ok());
+    assertFalse(describeTableResponse.getTableSchema().isPresent());
+  }
+
+  @org.junit.jupiter.api.Test
+  void showTables() {
+    ShowTablesResponse showTablesResponse = client.showTables();
+    assertTrue(showTablesResponse.getResponse().ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void serverStatus() {
+    Response serverStatusResponse = client.serverStatus();
+    assertTrue(serverStatusResponse.ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void serverVersion() {
+    Response serverVersionResponse = client.serverVersion();
+    assertTrue(serverVersionResponse.ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void getTableRowCount() throws InterruptedException {
+    insert();
+    TimeUnit.SECONDS.sleep(1);
+
+    GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
+    assertTrue(getTableRowCountResponse.getResponse().ok());
+    assertEquals(size, getTableRowCountResponse.getTableRowCount());
+  }
+
+  @org.junit.jupiter.api.Test
+  void deleteByRange() {
+    Date today = new Date();
+    Calendar c = Calendar.getInstance();
+    c.setTime(today);
+    c.add(Calendar.DAY_OF_MONTH, -1);
+    Date yesterday = c.getTime();
+    c.setTime(today);
+    c.add(Calendar.DAY_OF_MONTH, 1);
+    Date tomorrow = c.getTime();
+
+    DeleteByRangeParam deleteByRangeParam =
+        new DeleteByRangeParam.Builder(new DateRange(yesterday, tomorrow), randomTableName).build();
+    Response deleteByRangeResponse = client.deleteByRange(deleteByRangeParam);
+    assertTrue(deleteByRangeResponse.ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void preloadTable() {
+    Response preloadTableResponse = client.preloadTable(tableParam);
+    assertTrue(preloadTableResponse.ok());
+  }
+
+  @org.junit.jupiter.api.Test
+  void describeIndex() {
+    DescribeIndexResponse describeIndexResponse = client.describeIndex(tableParam);
+    assertTrue(describeIndexResponse.getResponse().ok());
+    assertTrue(describeIndexResponse.getIndex().isPresent());
+  }
+
+  @org.junit.jupiter.api.Test
+  void dropIndex() {
+    Response dropIndexResponse = client.dropIndex(tableParam);
+    assertTrue(dropIndexResponse.ok());
+  }
+}