Browse Source

Merge pull request #43 from milvus-io/0.5.0

Merge from 0.5.0
Jin Hai 5 years ago
parent
commit
51aa279193
32 changed files with 655 additions and 1161 deletions
  1. 7 0
      CHANGELOG.md
  2. 3 3
      README.md
  3. 15 13
      examples/pom.xml
  4. 70 58
      examples/src/main/java/MilvusClientExample.java
  5. 0 75
      milvus-sdk-java.iml
  6. 18 13
      pom.xml
  7. 0 74
      src/main/java/io/milvus/client/CommandParam.java
  8. 28 0
      src/main/java/io/milvus/client/ConnectFailedException.java
  9. 15 13
      src/main/java/io/milvus/client/ConnectParam.java
  10. 15 34
      src/main/java/io/milvus/client/CreateIndexParam.java
  11. 14 12
      src/main/java/io/milvus/client/DateRange.java
  12. 0 94
      src/main/java/io/milvus/client/DeleteByRangeParam.java
  13. 14 12
      src/main/java/io/milvus/client/DescribeIndexResponse.java
  14. 14 12
      src/main/java/io/milvus/client/DescribeTableResponse.java
  15. 14 12
      src/main/java/io/milvus/client/GetTableRowCountResponse.java
  16. 14 12
      src/main/java/io/milvus/client/HasTableResponse.java
  17. 14 12
      src/main/java/io/milvus/client/Index.java
  18. 41 17
      src/main/java/io/milvus/client/IndexType.java
  19. 14 31
      src/main/java/io/milvus/client/InsertParam.java
  20. 14 12
      src/main/java/io/milvus/client/InsertResponse.java
  21. 16 12
      src/main/java/io/milvus/client/MetricType.java
  22. 50 146
      src/main/java/io/milvus/client/MilvusClient.java
  23. 89 132
      src/main/java/io/milvus/client/MilvusGrpcClient.java
  24. 14 12
      src/main/java/io/milvus/client/Response.java
  25. 14 33
      src/main/java/io/milvus/client/SearchInFilesParam.java
  26. 15 32
      src/main/java/io/milvus/client/SearchParam.java
  27. 14 12
      src/main/java/io/milvus/client/SearchResponse.java
  28. 14 12
      src/main/java/io/milvus/client/ShowTablesResponse.java
  29. 0 78
      src/main/java/io/milvus/client/TableParam.java
  30. 14 12
      src/main/java/io/milvus/client/TableSchema.java
  31. 0 77
      src/main/java/io/milvus/client/TableSchemaParam.java
  32. 91 94
      src/test/java/io/milvus/client/MilvusGrpcClientTest.java

+ 7 - 0
CHANGELOG.md

@@ -1,5 +1,12 @@
+### Releases
+---
+- \#40: Release v0.2.0
+    - Remove timeout parameter
+    - Several API changes
+
 ### Bug
 ### Bug
 ---
 ---
+- \#42: fix search result validation
     
     
 ### Improvement
 ### Improvement
 ---
 ---

+ 3 - 3
README.md

@@ -3,7 +3,7 @@
 [![Maven Central](https://img.shields.io/maven-central/v/io.milvus/milvus-sdk-java.svg)](https://search.maven.org/artifact/io.milvus/milvus-sdk-java/)
 [![Maven Central](https://img.shields.io/maven-central/v/io.milvus/milvus-sdk-java.svg)](https://search.maven.org/artifact/io.milvus/milvus-sdk-java/)
 
 
 Java SDK for Milvus distributed high-performance vector search engine. 
 Java SDK for Milvus distributed high-performance vector search engine. 
-If you want to contribute to this repo, please read our [contribution guidelines]().
+If you want to contribute to this repo, please read our [contribution guidelines](https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md).
 
 
 ## Getting started
 ## Getting started
 
 
@@ -14,13 +14,13 @@ Apache Maven
 <dependency>
 <dependency>
     <groupId>io.milvus</groupId>
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>0.1.1</version>
+    <version>0.2.0</version>
 </dependency>
 </dependency>
 ```
 ```
 
 
 Gradle/Grails 
 Gradle/Grails 
 
 
-`compile 'io.milvus:milvus-sdk-java:0.1.1'`
+`compile 'io.milvus:milvus-sdk-java:0.2.0'`
 
 
 ### Examples
 ### Examples
 
 

+ 15 - 13
examples/pom.xml

@@ -1,19 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 <!--
-  ~ 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
+  ~ 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
+  ~   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.
+  ~ 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.
   -->
   -->
 
 
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -46,7 +48,7 @@
         <dependency>
         <dependency>
             <groupId>io.milvus</groupId>
             <groupId>io.milvus</groupId>
             <artifactId>milvus-sdk-java</artifactId>
             <artifactId>milvus-sdk-java</artifactId>
-            <version>0.1.1</version>
+            <version>0.2.0</version>
         </dependency>
         </dependency>
     </dependencies>
     </dependencies>
 
 

+ 70 - 58
examples/src/main/java/MilvusClientExample.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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.
  */
  */
 
 
 import io.milvus.client.*;
 import io.milvus.client.*;
@@ -27,10 +29,11 @@ import java.util.stream.DoubleStream;
 public class MilvusClientExample {
 public class MilvusClientExample {
 
 
   // Helper function that generates random vectors
   // Helper function that generates random vectors
-  static List<List<Float>> generateRandomVectors(long vectorCount, long dimension) {
+  static List<List<Float>> generateVectors(long vectorCount, long dimension) {
     SplittableRandom splittableRandom = new SplittableRandom();
     SplittableRandom splittableRandom = new SplittableRandom();
     List<List<Float>> vectors = new ArrayList<>();
     List<List<Float>> vectors = new ArrayList<>();
     for (int i = 0; i < vectorCount; ++i) {
     for (int i = 0; i < vectorCount; ++i) {
+      splittableRandom = splittableRandom.split();
       DoubleStream doubleStream = splittableRandom.doubles(dimension);
       DoubleStream doubleStream = splittableRandom.doubles(dimension);
       List<Float> vector =
       List<Float> vector =
           doubleStream.boxed().map(Double::floatValue).collect(Collectors.toList());
           doubleStream.boxed().map(Double::floatValue).collect(Collectors.toList());
@@ -41,15 +44,16 @@ public class MilvusClientExample {
 
 
   // Helper function that normalizes a vector if you are using IP (Inner product) as your metric
   // Helper function that normalizes a vector if you are using IP (Inner product) as your metric
   // type
   // type
-  static List<Float> normalize(List<Float> vector) {
+  static List<Float> normalizeVector(List<Float> vector) {
     float squareSum = vector.stream().map(x -> x * x).reduce((float) 0, Float::sum);
     float squareSum = vector.stream().map(x -> x * x).reduce((float) 0, Float::sum);
     final float norm = (float) Math.sqrt(squareSum);
     final float norm = (float) Math.sqrt(squareSum);
     vector = vector.stream().map(x -> x / norm).collect(Collectors.toList());
     vector = vector.stream().map(x -> x / norm).collect(Collectors.toList());
     return vector;
     return vector;
   }
   }
 
 
-  public static void main(String[] args) throws InterruptedException {
+  public static void main(String[] args) throws InterruptedException, ConnectFailedException {
 
 
+    // You may need to change the following to the host and port of your Milvus server
     final String host = "localhost";
     final String host = "localhost";
     final String port = "19530";
     final String port = "19530";
 
 
@@ -58,105 +62,113 @@ public class MilvusClientExample {
 
 
     // Connect to Milvus server
     // Connect to Milvus server
     ConnectParam connectParam = new ConnectParam.Builder().withHost(host).withPort(port).build();
     ConnectParam connectParam = new ConnectParam.Builder().withHost(host).withPort(port).build();
-    Response connectResponse = client.connect(connectParam);
-    System.out.println(connectResponse);
+    try {
+      Response connectResponse = client.connect(connectParam);
+    } catch (ConnectFailedException e) {
+      System.out.println(e.toString());
+      throw e;
+    }
 
 
     // Check whether we are connected
     // Check whether we are connected
-    boolean connected = client.connected();
+    boolean connected = client.isConnected();
     System.out.println("Connected = " + connected);
     System.out.println("Connected = " + connected);
 
 
     // Create a table with the following table schema
     // Create a table with the following table schema
-    final String tableName = "example";
-    final long dimension = 128;
-    final long indexFileSize = 1024;
-    final MetricType metricType = MetricType.IP;
+    final String tableName = "example"; // table name
+    final long dimension = 128; // dimension of each vector
+    final long indexFileSize = 1024; // maximum size (in MB) of each index file
+    final MetricType metricType = MetricType.IP; // we choose IP (Inner project) as our metric type
     TableSchema tableSchema =
     TableSchema tableSchema =
         new TableSchema.Builder(tableName, dimension)
         new TableSchema.Builder(tableName, dimension)
             .withIndexFileSize(indexFileSize)
             .withIndexFileSize(indexFileSize)
             .withMetricType(metricType)
             .withMetricType(metricType)
             .build();
             .build();
-    TableSchemaParam tableSchemaParam =
-        new TableSchemaParam.Builder(tableSchema).withTimeout(10).build();
-    Response createTableResponse = client.createTable(tableSchemaParam);
+    Response createTableResponse = client.createTable(tableSchema);
     System.out.println(createTableResponse);
     System.out.println(createTableResponse);
 
 
     // Check whether the table exists
     // Check whether the table exists
-    TableParam hasTableParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    HasTableResponse hasTableResponse = client.hasTable(hasTableParam);
+    HasTableResponse hasTableResponse = client.hasTable(tableName);
     System.out.println(hasTableResponse);
     System.out.println(hasTableResponse);
 
 
     // Describe the table
     // Describe the table
-    TableParam describeTableParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    DescribeTableResponse describeTableResponse = client.describeTable(describeTableParam);
+    DescribeTableResponse describeTableResponse = client.describeTable(tableName);
     System.out.println(describeTableResponse);
     System.out.println(describeTableResponse);
 
 
     // Insert randomly generated vectors to table
     // Insert randomly generated vectors to table
     final int vectorCount = 100000;
     final int vectorCount = 100000;
-    List<List<Float>> vectors = generateRandomVectors(vectorCount, dimension);
-    vectors.forEach(MilvusClientExample::normalize);
-    InsertParam insertParam = new InsertParam.Builder(tableName, vectors).withTimeout(10).build();
+    List<List<Float>> vectors = generateVectors(vectorCount, dimension);
+    vectors =
+        vectors.stream().map(MilvusClientExample::normalizeVector).collect(Collectors.toList());
+    InsertParam insertParam = new InsertParam.Builder(tableName, vectors).build();
     InsertResponse insertResponse = client.insert(insertParam);
     InsertResponse insertResponse = client.insert(insertParam);
     System.out.println(insertResponse);
     System.out.println(insertResponse);
     // Insert returns a list of vector ids that you will be using (if you did not supply them
     // Insert returns a list of vector ids that you will be using (if you did not supply them
     // yourself) to reference the vectors you just inserted
     // yourself) to reference the vectors you just inserted
     List<Long> vectorIds = insertResponse.getVectorIds();
     List<Long> vectorIds = insertResponse.getVectorIds();
 
 
-    // Sleep for 1 second
+    // The data we just inserted won't be serialized and written to meta until the next second
+    // wait 1 second here
     TimeUnit.SECONDS.sleep(1);
     TimeUnit.SECONDS.sleep(1);
 
 
     // Get current row count of table
     // Get current row count of table
-    TableParam getTableRowCountParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    GetTableRowCountResponse getTableRowCountResponse =
-        client.getTableRowCount(getTableRowCountParam);
+    GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableName);
     System.out.println(getTableRowCountResponse);
     System.out.println(getTableRowCountResponse);
 
 
     // Create index for the table
     // Create index for the table
+    // We choose IVF_SQ8 as our index type here. Refer to IndexType javadoc for a
+    // complete explanation of different index types
     final IndexType indexType = IndexType.IVF_SQ8;
     final IndexType indexType = IndexType.IVF_SQ8;
     Index index = new Index.Builder().withIndexType(IndexType.IVF_SQ8).build();
     Index index = new Index.Builder().withIndexType(IndexType.IVF_SQ8).build();
     CreateIndexParam createIndexParam =
     CreateIndexParam createIndexParam =
-        new CreateIndexParam.Builder(tableName).withIndex(index).withTimeout(10).build();
+        new CreateIndexParam.Builder(tableName).withIndex(index).build();
     Response createIndexResponse = client.createIndex(createIndexParam);
     Response createIndexResponse = client.createIndex(createIndexParam);
     System.out.println(createIndexResponse);
     System.out.println(createIndexResponse);
 
 
     // Describe the index for your table
     // Describe the index for your table
-    TableParam describeIndexParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    DescribeIndexResponse describeIndexResponse = client.describeIndex(describeIndexParam);
+    DescribeIndexResponse describeIndexResponse = client.describeIndex(tableName);
     System.out.println(describeIndexResponse);
     System.out.println(describeIndexResponse);
 
 
     // Search vectors
     // Search vectors
-    final int searchSize = 5;
     // Searching the first 5 vectors of the vectors we just inserted
     // Searching the first 5 vectors of the vectors we just inserted
-    List<List<Float>> vectorsToSearch = vectors.subList(0, searchSize);
+    final int searchBatchSize = 5;
+    List<List<Float>> vectorsToSearch = vectors.subList(0, searchBatchSize);
     final long topK = 10;
     final long topK = 10;
     SearchParam searchParam =
     SearchParam searchParam =
-        new SearchParam.Builder(tableName, vectorsToSearch).withTopK(topK).withTimeout(10).build();
+        new SearchParam.Builder(tableName, vectorsToSearch).withTopK(topK).build();
     SearchResponse searchResponse = client.search(searchParam);
     SearchResponse searchResponse = client.search(searchParam);
     System.out.println(searchResponse);
     System.out.println(searchResponse);
-    List<List<SearchResponse.QueryResult>> queryResultsList = searchResponse.getQueryResultsList();
-    final double epsilon = 0.001;
-    for (int i = 0; i < searchSize; i++) {
-      // Since we are searching for vector that is already present in the table,
-      // the first result vector should be itself and the distance (inner product) should be
-      // very close to 1 (some precision is lost during the process)
-      SearchResponse.QueryResult firstQueryResult = queryResultsList.get(i).get(0);
-      if (firstQueryResult.getVectorId() != vectorIds.get(i)
-          || firstQueryResult.getDistance() <= (1 - epsilon)) {
-        throw new AssertionError();
+    if (searchResponse.getResponse().ok()) {
+      List<List<SearchResponse.QueryResult>> queryResultsList =
+          searchResponse.getQueryResultsList();
+      final double epsilon = 0.001;
+      for (int i = 0; i < searchBatchSize; i++) {
+        // Since we are searching for vector that is already present in the table,
+        // the first result vector should be itself and the distance (inner product) should be
+        // very close to 1 (some precision is lost during the process)
+        SearchResponse.QueryResult firstQueryResult = queryResultsList.get(i).get(0);
+        if (firstQueryResult.getVectorId() != vectorIds.get(i)
+            || Math.abs(1 - firstQueryResult.getDistance()) > epsilon) {
+          throw new AssertionError("Wrong results!");
+        }
       }
       }
     }
     }
 
 
     // Drop index for the table
     // Drop index for the table
-    TableParam dropIndexParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    Response dropIndexResponse = client.dropIndex(dropIndexParam);
+    Response dropIndexResponse = client.dropIndex(tableName);
     System.out.println(dropIndexResponse);
     System.out.println(dropIndexResponse);
 
 
     // Drop table
     // Drop table
-    TableParam dropTableParam = new TableParam.Builder(tableName).withTimeout(1).build();
-    Response dropTableResponse = client.dropTable(dropTableParam);
+    Response dropTableResponse = client.dropTable(tableName);
     System.out.println(dropTableResponse);
     System.out.println(dropTableResponse);
 
 
     // Disconnect from Milvus server
     // Disconnect from Milvus server
-    Response disconnectResponse = client.disconnect();
-    System.out.println(disconnectResponse);
+    try {
+      Response disconnectResponse = client.disconnect();
+    } catch (InterruptedException e) {
+      System.out.println("Failed to disconnect: " + e.toString());
+      throw e;
+    }
+
+    return;
   }
   }
 }
 }

+ 0 - 75
milvus-sdk-java.iml

@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
-    <output url="file://$MODULE_DIR$/target/classes" />
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
-    <content url="file://$MODULE_DIR$">
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
-      <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/grpc-java" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/target/generated-sources/protobuf/java" isTestSource="false" generated="true" />
-      <sourceFolder url="file://$MODULE_DIR$/src/main/proto" type="java-resource" />
-      <excludeFolder url="file://$MODULE_DIR$/target" />
-    </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" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.perfmark:perfmark-api:0.17.0" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.opencensus:opencensus-api:0.21.0" level="project" />
-    <orderEntry type="library" scope="RUNTIME" name="Maven: io.opencensus:opencensus-contrib-grpc-metrics:0.21.0" level="project" />
-    <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.protobuf:protobuf-java:3.9.0" 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" 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.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" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.5.2" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-params:5.5.2" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.5.2" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.5.2" level="project" />
-    <orderEntry type="library" name="Maven: org.apache.commons:commons-text:1.6" level="project" />
-    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.8.1" level="project" />
-  </component>
-</module>

+ 18 - 13
pom.xml

@@ -1,19 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
 <!--
-  ~ 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
+  ~ 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
+  ~   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.
+  ~ 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.
   -->
   -->
 
 
 <project xmlns="http://maven.apache.org/POM/4.0.0"
 <project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -23,7 +25,7 @@
 
 
     <groupId>io.milvus</groupId>
     <groupId>io.milvus</groupId>
     <artifactId>milvus-sdk-java</artifactId>
     <artifactId>milvus-sdk-java</artifactId>
-    <version>0.1.1</version>
+    <version>0.2.0</version>
     <packaging>jar</packaging>
     <packaging>jar</packaging>
 
 
     <name>io.milvus:milvus-sdk-java</name>
     <name>io.milvus:milvus-sdk-java</name>
@@ -156,6 +158,9 @@
                         <groupId>org.apache.maven.plugins</groupId>
                         <groupId>org.apache.maven.plugins</groupId>
                         <artifactId>maven-javadoc-plugin</artifactId>
                         <artifactId>maven-javadoc-plugin</artifactId>
                         <version>3.1.1</version>
                         <version>3.1.1</version>
+                        <configuration>
+                            <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
+                        </configuration>
                         <executions>
                         <executions>
                             <execution>
                             <execution>
                                 <id>attach-javadocs</id>
                                 <id>attach-javadocs</id>

+ 0 - 74
src/main/java/io/milvus/client/CommandParam.java

@@ -1,74 +0,0 @@
-/*
- * 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> */
-class CommandParam {
-  private final String command;
-  private final long timeout;
-
-  private CommandParam(@Nonnull Builder builder) {
-    this.command = builder.command;
-    this.timeout = builder.timeout;
-  }
-
-  String getCommand() {
-    return command;
-  }
-
-  long getTimeout() {
-    return timeout;
-  }
-
-  @Override
-  public String toString() {
-    return "CommandParam {" + "command='" + command + '\'' + ", timeout=" + timeout + '}';
-  }
-
-  /** Builder for <code>CommandParam</code> */
-  public static class Builder {
-    // Required parameters
-    private final String command;
-
-    // Optional parameters - initialized to default values
-    private long timeout = 86400;
-
-    /** @param command a string command */
-    public Builder(@Nonnull String command) {
-      this.command = command;
-    }
-
-    /**
-     * 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 CommandParam build() {
-      return new CommandParam(this);
-    }
-  }
-}

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

@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/** Thrown when client failed to connect to server */
+public class ConnectFailedException extends Exception {
+
+  public ConnectFailedException(String message) {
+    super(message);
+  }
+}

+ 15 - 13
src/main/java/io/milvus/client/ConnectParam.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -39,7 +41,7 @@ public class ConnectParam {
 
 
   @Override
   @Override
   public String toString() {
   public String toString() {
-    return "ConnectParam {" + "host='" + host + '\'' + ", port='" + port + '\'' + '}';
+    return "ConnectParam{" + "host='" + host + '\'' + ", port='" + port + '\'' + '}';
   }
   }
 
 
   /** Builder for <code>ConnectParam</code> */
   /** Builder for <code>ConnectParam</code> */

+ 15 - 34
src/main/java/io/milvus/client/CreateIndexParam.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -24,12 +26,10 @@ public class CreateIndexParam {
 
 
   private final String tableName;
   private final String tableName;
   private final Index index;
   private final Index index;
-  private final long timeout;
 
 
   private CreateIndexParam(@Nonnull Builder builder) {
   private CreateIndexParam(@Nonnull Builder builder) {
     this.tableName = builder.tableName;
     this.tableName = builder.tableName;
     this.index = builder.index;
     this.index = builder.index;
-    this.timeout = builder.timeout;
   }
   }
 
 
   public String getTableName() {
   public String getTableName() {
@@ -40,15 +40,9 @@ public class CreateIndexParam {
     return index;
     return index;
   }
   }
 
 
-  public long getTimeout() {
-    return timeout;
-  }
-
   @Override
   @Override
   public String toString() {
   public String toString() {
-    return String.format(
-        "IndexParam = {tableName = %s, index = {indexType = %s, nList = %d}, timeout = %d}",
-        tableName, index.getIndexType().name(), index.getNList(), timeout);
+    return "CreateIndexParam{" + "tableName='" + tableName + '\'' + ", index=" + index + '}';
   }
   }
 
 
   /** Builder for <code>CreateIndexParam</code> */
   /** Builder for <code>CreateIndexParam</code> */
@@ -58,7 +52,6 @@ public class CreateIndexParam {
 
 
     // Optional parameters - initialized to default values
     // Optional parameters - initialized to default values
     private Index index;
     private Index index;
-    private long timeout = 86400;
 
 
     /** @param tableName table to create index on */
     /** @param tableName table to create index on */
     public Builder(@Nonnull String tableName) {
     public Builder(@Nonnull String tableName) {
@@ -77,18 +70,6 @@ public class CreateIndexParam {
       return this;
       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 CreateIndexParam build() {
     public CreateIndexParam build() {
       return new CreateIndexParam(this);
       return new CreateIndexParam(this);
     }
     }

+ 14 - 12
src/main/java/io/milvus/client/DateRange.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 0 - 94
src/main/java/io/milvus/client/DeleteByRangeParam.java

@@ -1,94 +0,0 @@
-/*
- * 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> */
-public class DeleteByRangeParam {
-  private final DateRange dateRange;
-  private final String tableName;
-  private final long timeout;
-
-  private DeleteByRangeParam(@Nonnull Builder builder) {
-    this.dateRange = builder.dateRange;
-    this.tableName = builder.tableName;
-    this.timeout = builder.timeout;
-  }
-
-  public DateRange getDateRange() {
-    return dateRange;
-  }
-
-  public String getTableName() {
-    return tableName;
-  }
-
-  public long getTimeout() {
-    return timeout;
-  }
-
-  @Override
-  public String toString() {
-    return "DeleteByRangeParam {"
-        + "dateRange = "
-        + dateRange.toString()
-        + ", tableName = '"
-        + tableName
-        + '\''
-        + ", timeout = "
-        + timeout
-        + '}';
-  }
-
-  /** Builder for <code>DeleteByRangeParam</code> */
-  public static final class Builder {
-    // Required parameters
-    private final DateRange dateRange;
-    private final String tableName;
-
-    // Optional parameters - initialized to default values
-    private long timeout = 86400;
-
-    /**
-     * @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;
-    }
-
-    /**
-     * 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 DeleteByRangeParam build() {
-      return new DeleteByRangeParam(this);
-    }
-  }
-}

+ 14 - 12
src/main/java/io/milvus/client/DescribeIndexResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 12
src/main/java/io/milvus/client/DescribeTableResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 12
src/main/java/io/milvus/client/GetTableRowCountResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 12
src/main/java/io/milvus/client/HasTableResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 12
src/main/java/io/milvus/client/Index.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 41 - 17
src/main/java/io/milvus/client/IndexType.java

@@ -1,18 +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.
+ * 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;
 package io.milvus.client;
@@ -20,14 +22,36 @@ package io.milvus.client;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.Optional;
 import java.util.Optional;
 
 
-/** Represents available index types */
+/**
+ * Represents different types of indexing method to query the table:
+ *
+ * <pre>
+ *
+ * 1. FLAT - Provides 100% accuracy for recalls. However, performance might be downgraded due to huge computation effort;
+ *
+ * 2. IVFLAT - K-means based similarity search which is balanced between accuracy and performance;
+ *
+ * 3. IVF_SQ8 - Vector indexing that adopts a scalar quantization strategy that significantly reduces the size of a
+ * vector (by about 3/4), thus improving the overall throughput of vector processing;
+ *
+ * 4. NSG - NSG (Navigating Spreading-out Graph) is a graph-base search algorithm that a) lowers the average
+ * out-degree of the graph for fast traversal; b) shortens the search path; c) reduces the index
+ * size; d) lowers the indexing complexity. Extensive tests show that NSG can achieve very high
+ * search performance at high precision, and needs much less memory. Compared to non-graph-based
+ * algorithms, it is faster to achieve the same search precision.
+ *
+ * 5. IVF_SQ8H - An enhanced index algorithm of IVF_SQ8. It supports hybrid computation on both CPU and GPU,
+ * which significantly improves the search performance. To use this index type, make sure both cpu and gpu are added as
+ * resources for search usage in the Milvus configuration file.
+ * </pre>
+ */
 public enum IndexType {
 public enum IndexType {
   INVALID(0),
   INVALID(0),
   FLAT(1),
   FLAT(1),
   IVFLAT(2),
   IVFLAT(2),
   IVF_SQ8(3),
   IVF_SQ8(3),
-  MIX_NSG(4),
-  IVF_SQ8_H(5),
+  NSG(4),
+  IVF_SQ8H(5),
 
 
   UNKNOWN(-1);
   UNKNOWN(-1);
 
 

+ 14 - 31
src/main/java/io/milvus/client/InsertParam.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -26,13 +28,11 @@ public class InsertParam {
   private final String tableName;
   private final String tableName;
   private final List<List<Float>> vectors;
   private final List<List<Float>> vectors;
   private final List<Long> vectorIds;
   private final List<Long> vectorIds;
-  private final long timeout;
 
 
   private InsertParam(@Nonnull Builder builder) {
   private InsertParam(@Nonnull Builder builder) {
     this.tableName = builder.tableName;
     this.tableName = builder.tableName;
     this.vectors = builder.vectors;
     this.vectors = builder.vectors;
     this.vectorIds = builder.vectorIds;
     this.vectorIds = builder.vectorIds;
-    this.timeout = builder.timeout;
   }
   }
 
 
   public String getTableName() {
   public String getTableName() {
@@ -47,10 +47,6 @@ public class InsertParam {
     return vectorIds;
     return vectorIds;
   }
   }
 
 
-  public long getTimeout() {
-    return timeout;
-  }
-
   /** Builder for <code>InsertParam</code> */
   /** Builder for <code>InsertParam</code> */
   public static class Builder {
   public static class Builder {
     // Required parameters
     // Required parameters
@@ -59,7 +55,6 @@ public class InsertParam {
 
 
     // Optional parameters - initialized to default values
     // Optional parameters - initialized to default values
     private List<Long> vectorIds = new ArrayList<>();
     private List<Long> vectorIds = new ArrayList<>();
-    private long timeout = 86400;
 
 
     /**
     /**
      * @param tableName table to insert vectors to
      * @param tableName table to insert vectors to
@@ -82,18 +77,6 @@ public class InsertParam {
       return this;
       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 InsertParam build() {
     public InsertParam build() {
       return new InsertParam(this);
       return new InsertParam(this);
     }
     }

+ 14 - 12
src/main/java/io/milvus/client/InsertResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 16 - 12
src/main/java/io/milvus/client/MetricType.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -22,7 +24,9 @@ import java.util.Optional;
 
 
 /** Represents available metric types */
 /** Represents available metric types */
 public enum MetricType {
 public enum MetricType {
+  /** Euclidean distance */
   L2(1),
   L2(1),
+  /** Inner product */
   IP(2),
   IP(2),
 
 
   UNKNOWN(-1);
   UNKNOWN(-1);

+ 50 - 146
src/main/java/io/milvus/client/MilvusClient.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -20,10 +22,10 @@ package io.milvus.client;
 /** The Milvus Client Interface */
 /** The Milvus Client Interface */
 public interface MilvusClient {
 public interface MilvusClient {
 
 
-  String clientVersion = "0.1.1";
+  String clientVersion = "0.2.0";
 
 
   /** @return the current Milvus client version */
   /** @return the current Milvus client version */
-  default String clientVersion() {
+  default String getClientVersion() {
     return clientVersion;
     return clientVersion;
   }
   }
 
 
@@ -31,7 +33,7 @@ public interface MilvusClient {
    * Connects to Milvus server
    * Connects to Milvus server
    *
    *
    * @param connectParam the <code>ConnectParam</code> object
    * @param connectParam the <code>ConnectParam</code> object
-   *     <pre>
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * ConnectParam connectParam = new ConnectParam.Builder()
    * ConnectParam connectParam = new ConnectParam.Builder()
@@ -42,13 +44,15 @@ public interface MilvusClient {
    * </pre>
    * </pre>
    *
    *
    * @return <code>Response</code>
    * @return <code>Response</code>
+   * @throws ConnectFailedException if client failed to connect
    * @see ConnectParam
    * @see ConnectParam
    * @see Response
    * @see Response
+   * @see ConnectFailedException
    */
    */
-  Response connect(ConnectParam connectParam);
+  Response connect(ConnectParam connectParam) throws ConnectFailedException;
 
 
   /** @return <code>true</code> if the client is connected to Milvus server */
   /** @return <code>true</code> if the client is connected to Milvus server */
-  boolean connected();
+  boolean isConnected();
 
 
   /**
   /**
    * Disconnects from Milvus server
    * Disconnects from Milvus server
@@ -62,72 +66,48 @@ public interface MilvusClient {
   /**
   /**
    * Creates table specified by <code>tableSchemaParam</code>
    * Creates table specified by <code>tableSchemaParam</code>
    *
    *
-   * @param tableSchemaParam the <code>TableSchemaParam</code> object
-   *     <pre>
+   * @param tableSchema the <code>TableSchema</code> object
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
    * TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
    *                                          .withIndexFileSize(1024)
    *                                          .withIndexFileSize(1024)
    *                                          .withMetricType(MetricType.IP)
    *                                          .withMetricType(MetricType.IP)
    *                                          .build();
    *                                          .build();
-   * TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema)
-   *                                                         .withTimeout(timeout)
-   *                                                         .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
    *
    *
    * @return <code>Response</code>
    * @return <code>Response</code>
    * @see TableSchema
    * @see TableSchema
-   * @see TableSchemaParam
    * @see MetricType
    * @see MetricType
    * @see Response
    * @see Response
    */
    */
-  Response createTable(TableSchemaParam tableSchemaParam);
+  Response createTable(TableSchema tableSchema);
 
 
   /**
   /**
-   * 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>
+   * Check whether table exists
    *
    *
+   * @param tableName table to check
    * @return <code>HasTableResponse</code>
    * @return <code>HasTableResponse</code>
-   * @see TableParam
    * @see HasTableResponse
    * @see HasTableResponse
    * @see Response
    * @see Response
    */
    */
-  HasTableResponse hasTable(TableParam tableParam);
+  HasTableResponse hasTable(String tableName);
 
 
   /**
   /**
-   * 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>
+   * Drops table
    *
    *
+   * @param tableName table to drop
    * @return <code>Response</code>
    * @return <code>Response</code>
-   * @see TableParam
    * @see Response
    * @see Response
    */
    */
-  Response dropTable(TableParam tableParam);
+  Response dropTable(String tableName);
 
 
   /**
   /**
    * Creates index specified by <code>indexParam</code>
    * Creates index specified by <code>indexParam</code>
    *
    *
    * @param createIndexParam the <code>CreateIndexParam</code> object
    * @param createIndexParam the <code>CreateIndexParam</code> object
-   *     <pre>
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * Index index = new Index.Builder()
    * Index index = new Index.Builder()
@@ -136,7 +116,6 @@ public interface MilvusClient {
    *                        .build();
    *                        .build();
    * CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName)
    * CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName)
    *                                                         .withIndex(index)
    *                                                         .withIndex(index)
-   *                                                         .withTimeout(timeout)
    *                                                         .build();
    *                                                         .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
@@ -153,12 +132,11 @@ public interface MilvusClient {
    * Inserts data specified by <code>insertParam</code>
    * Inserts data specified by <code>insertParam</code>
    *
    *
    * @param insertParam the <code>InsertParam</code> object
    * @param insertParam the <code>InsertParam</code> object
-   *     <pre>
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * InsertParam insertParam = new InsertParam.Builder(tableName, vectors)
    * InsertParam insertParam = new InsertParam.Builder(tableName, vectors)
    *                                          .withVectorIds(vectorIds)
    *                                          .withVectorIds(vectorIds)
-   *                                          .withTimeout(timeout)
    *                                          .build();
    *                                          .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
@@ -174,14 +152,13 @@ public interface MilvusClient {
    * Searches vectors specified by <code>searchParam</code>
    * Searches vectors specified by <code>searchParam</code>
    *
    *
    * @param searchParam the <code>SearchParam</code> object
    * @param searchParam the <code>SearchParam</code> object
-   *     <pre>
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
    * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
    *                                          .withTopK(topK)
    *                                          .withTopK(topK)
    *                                          .withNProbe(nProbe)
    *                                          .withNProbe(nProbe)
    *                                          .withDateRanges(dateRanges)
    *                                          .withDateRanges(dateRanges)
-   *                                          .withTimeout(timeout)
    *                                          .build();
    *                                          .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
@@ -199,7 +176,7 @@ public interface MilvusClient {
    * Searches vectors in specific files specified by <code>searchInFilesParam</code>
    * Searches vectors in specific files specified by <code>searchInFilesParam</code>
    *
    *
    * @param searchInFilesParam the <code>SearchInFilesParam</code> object
    * @param searchInFilesParam the <code>SearchInFilesParam</code> object
-   *     <pre>
+   * <pre>
    * example usage:
    * example usage:
    * <code>
    * <code>
    * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
    * SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
@@ -208,7 +185,6 @@ public interface MilvusClient {
    *                                          .withDateRanges(dateRanges)
    *                                          .withDateRanges(dateRanges)
    *                                          .build();
    *                                          .build();
    * SearchInFilesParam searchInFilesParam = new SearchInFilesParam.Builder(fileIds, searchParam)
    * SearchInFilesParam searchInFilesParam = new SearchInFilesParam.Builder(fileIds, searchParam)
-   *                                                               .withTimeout(timeout)
    *                                                               .build();
    *                                                               .build();
    * </code>
    * </code>
    * </pre>
    * </pre>
@@ -224,24 +200,13 @@ public interface MilvusClient {
   SearchResponse searchInFiles(SearchInFilesParam searchInFilesParam);
   SearchResponse searchInFiles(SearchInFilesParam searchInFilesParam);
 
 
   /**
   /**
-   * Describes table specified by <code>tableParam</code>
+   * Describes table
    *
    *
-   * @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
+   * @param tableName table to describe
    * @see DescribeTableResponse
    * @see DescribeTableResponse
    * @see Response
    * @see Response
    */
    */
-  DescribeTableResponse describeTable(TableParam tableParam);
+  DescribeTableResponse describeTable(String tableName);
 
 
   /**
   /**
    * Shows current tables
    * Shows current tables
@@ -253,23 +218,14 @@ public interface MilvusClient {
   ShowTablesResponse showTables();
   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>
+   * Gets current row count of table
    *
    *
+   * @param tableName table to count
    * @return <code>GetTableRowCountResponse</code>
    * @return <code>GetTableRowCountResponse</code>
    * @see GetTableRowCountResponse
    * @see GetTableRowCountResponse
    * @see Response
    * @see Response
    */
    */
-  GetTableRowCountResponse getTableRowCount(TableParam tableParam);
+  GetTableRowCountResponse getTableRowCount(String tableName);
 
 
   /**
   /**
    * Prints server status
    * Prints server status
@@ -277,7 +233,7 @@ public interface MilvusClient {
    * @return <code>Response</code>
    * @return <code>Response</code>
    * @see Response
    * @see Response
    */
    */
-  Response serverStatus();
+  Response getServerStatus();
 
 
   /**
   /**
    * Prints server version
    * Prints server version
@@ -285,84 +241,32 @@ public interface MilvusClient {
    * @return <code>Response</code>
    * @return <code>Response</code>
    * @see Response
    * @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);
+  Response getServerVersion();
 
 
   /**
   /**
    * Pre-loads table to memory
    * 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>
-   *
+   * @param tableName table to preload
    * @return <code>Response</code>
    * @return <code>Response</code>
-   * @see TableParam
    * @see Response
    * @see Response
    */
    */
-  Response preloadTable(TableParam tableParam);
+  Response preloadTable(String tableName);
 
 
   /**
   /**
-   * 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>
+   * Describes table index
    *
    *
-   * @return <code>DescribeIndexResponse</code>
-   * @see TableParam
+   * @param tableName table to describe index of
    * @see DescribeIndexResponse
    * @see DescribeIndexResponse
    * @see Index
    * @see Index
    * @see Response
    * @see Response
    */
    */
-  DescribeIndexResponse describeIndex(TableParam tableParam);
+  DescribeIndexResponse describeIndex(String tableName);
 
 
   /**
   /**
-   * 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>
+   * Drops table index
    *
    *
-   * @return <code>dropIndex</code>
-   * @see TableParam
+   * @param tableName table to drop index of
    * @see Response
    * @see Response
    */
    */
-  Response dropIndex(TableParam tableParam);
+  Response dropIndex(String tableName);
 }
 }

+ 89 - 132
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -41,22 +43,22 @@ public class MilvusGrpcClient implements MilvusClient {
   private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
   private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
 
 
   private ManagedChannel channel = null;
   private ManagedChannel channel = null;
-  private io.milvus.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub;
+  private io.milvus.grpc.MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub = null;
 
 
   /////////////////////// Client Calls///////////////////////
   /////////////////////// Client Calls///////////////////////
 
 
   @Override
   @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!");
+  public Response connect(ConnectParam connectParam) throws ConnectFailedException {
+    if (channel != null && !(channel.isShutdown() || channel.isTerminated())) {
+      logWarning("Channel is not shutdown or terminated");
+      throw new ConnectFailedException("Channel is not shutdown or terminated");
     }
     }
 
 
     try {
     try {
       int port = Integer.parseInt(connectParam.getPort());
       int port = Integer.parseInt(connectParam.getPort());
       if (port < 0 || port > 0xFFFF) {
       if (port < 0 || port > 0xFFFF) {
         logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
         logSevere("Connect failed! Port {0} out of range", connectParam.getPort());
-        return new Response(Response.Status.CONNECT_FAILED, "Port " + port + " out of range");
+        throw new ConnectFailedException("Port " + port + " out of range");
       }
       }
 
 
       channel =
       channel =
@@ -73,16 +75,19 @@ public class MilvusGrpcClient implements MilvusClient {
 
 
       connectivityState = channel.getState(false);
       connectivityState = channel.getState(false);
       if (connectivityState != ConnectivityState.READY) {
       if (connectivityState != ConnectivityState.READY) {
-        logSevere("Connect failed! {0}", connectParam.toString());
-        return new Response(
-            Response.Status.CONNECT_FAILED, "connectivity state = " + connectivityState);
+        logSevere(
+            "Connect failed! {0}\nConnectivity state = {1}",
+            connectParam.toString(), connectivityState);
+        throw new ConnectFailedException("Connectivity state = " + connectivityState);
       }
       }
 
 
       blockingStub = io.milvus.grpc.MilvusServiceGrpc.newBlockingStub(channel);
       blockingStub = io.milvus.grpc.MilvusServiceGrpc.newBlockingStub(channel);
 
 
     } catch (Exception e) {
     } catch (Exception e) {
-      logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
-      return new Response(Response.Status.CONNECT_FAILED, e.toString());
+      if (!(e instanceof ConnectFailedException)) {
+        logSevere("Connect failed! {0}\n{1}", connectParam.toString(), e.toString());
+      }
+      throw new ConnectFailedException("Exception occurred: " + e.toString());
     }
     }
 
 
     logInfo("Connected successfully!\n{0}", connectParam.toString());
     logInfo("Connected successfully!\n{0}", connectParam.toString());
@@ -90,7 +95,7 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public boolean connected() {
+  public boolean isConnected() {
     if (channel == null) {
     if (channel == null) {
       return false;
       return false;
     }
     }
@@ -100,29 +105,33 @@ public class MilvusGrpcClient implements MilvusClient {
 
 
   @Override
   @Override
   public Response disconnect() throws InterruptedException {
   public Response disconnect() throws InterruptedException {
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     } else {
     } 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);
+      try {
+        if (channel.shutdown().awaitTermination(60, TimeUnit.SECONDS)) {
+          logInfo("Channel terminated");
+        } else {
+          logSevere("Encountered error when terminating channel");
+          return new Response(Response.Status.RPC_ERROR);
+        }
+      } catch (InterruptedException e) {
+        logSevere("Exception thrown when terminating channel: {0}", e.toString());
+        throw e;
       }
       }
     }
     }
     return new Response(Response.Status.SUCCESS);
     return new Response(Response.Status.SUCCESS);
   }
   }
 
 
   @Override
   @Override
-  public Response createTable(@Nonnull TableSchemaParam tableSchemaParam) {
+  public Response createTable(@Nonnull TableSchema tableSchema) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    TableSchema tableSchema = tableSchemaParam.getTableSchema();
     io.milvus.grpc.TableSchema request =
     io.milvus.grpc.TableSchema request =
         io.milvus.grpc.TableSchema.newBuilder()
         io.milvus.grpc.TableSchema.newBuilder()
             .setTableName(tableSchema.getTableName())
             .setTableName(tableSchema.getTableName())
@@ -134,10 +143,7 @@ public class MilvusGrpcClient implements MilvusClient {
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableSchemaParam.getTimeout(), TimeUnit.SECONDS)
-              .createTable(request);
+      response = blockingStub.createTable(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Created table successfully!\n{0}", tableSchema.toString());
         logInfo("Created table successfully!\n{0}", tableSchema.toString());
@@ -158,23 +164,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public HasTableResponse hasTable(@Nonnull TableParam tableParam) {
+  public HasTableResponse hasTable(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new HasTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), false);
       return new HasTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), false);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.BoolReply response;
     io.milvus.grpc.BoolReply response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .hasTable(request);
+      response = blockingStub.hasTable(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
         logInfo("hasTable `{0}` = {1}", tableName, response.getBoolReply());
@@ -194,23 +196,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public Response dropTable(@Nonnull TableParam tableParam) {
+  public Response dropTable(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .dropTable(request);
+      response = blockingStub.dropTable(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Dropped table `{0}` successfully!", tableName);
         logInfo("Dropped table `{0}` successfully!", tableName);
@@ -229,7 +227,7 @@ public class MilvusGrpcClient implements MilvusClient {
   @Override
   @Override
   public Response createIndex(@Nonnull CreateIndexParam createIndexParam) {
   public Response createIndex(@Nonnull CreateIndexParam createIndexParam) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
@@ -248,10 +246,7 @@ public class MilvusGrpcClient implements MilvusClient {
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(createIndexParam.getTimeout(), TimeUnit.SECONDS)
-              .createIndex(request);
+      response = blockingStub.createIndex(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Created index successfully!\n{0}", createIndexParam.toString());
         logInfo("Created index successfully!\n{0}", createIndexParam.toString());
@@ -271,7 +266,7 @@ public class MilvusGrpcClient implements MilvusClient {
   @Override
   @Override
   public InsertResponse insert(@Nonnull InsertParam insertParam) {
   public InsertResponse insert(@Nonnull InsertParam insertParam) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new InsertResponse(
       return new InsertResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
@@ -293,10 +288,7 @@ public class MilvusGrpcClient implements MilvusClient {
     io.milvus.grpc.VectorIds response;
     io.milvus.grpc.VectorIds response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(insertParam.getTimeout(), TimeUnit.SECONDS)
-              .insert(request);
+      response = blockingStub.insert(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
         Optional<List<Long>> resultVectorIds = Optional.ofNullable(response.getVectorIdArrayList());
@@ -323,7 +315,7 @@ public class MilvusGrpcClient implements MilvusClient {
   @Override
   @Override
   public SearchResponse search(@Nonnull SearchParam searchParam) {
   public SearchResponse search(@Nonnull SearchParam searchParam) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new SearchResponse(
       return new SearchResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
@@ -345,10 +337,7 @@ public class MilvusGrpcClient implements MilvusClient {
     io.milvus.grpc.TopKQueryResultList response;
     io.milvus.grpc.TopKQueryResultList response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(searchParam.getTimeout(), TimeUnit.SECONDS)
-              .search(request);
+      response = blockingStub.search(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
         List<List<SearchResponse.QueryResult>> queryResultsList = getQueryResultsList(response);
@@ -374,7 +363,7 @@ public class MilvusGrpcClient implements MilvusClient {
   @Override
   @Override
   public SearchResponse searchInFiles(@Nonnull SearchInFilesParam searchInFilesParam) {
   public SearchResponse searchInFiles(@Nonnull SearchInFilesParam searchInFilesParam) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new SearchResponse(
       return new SearchResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
@@ -404,10 +393,7 @@ public class MilvusGrpcClient implements MilvusClient {
     io.milvus.grpc.TopKQueryResultList response;
     io.milvus.grpc.TopKQueryResultList response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(searchInFilesParam.getTimeout(), TimeUnit.SECONDS)
-              .searchInFiles(request);
+      response = blockingStub.searchInFiles(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
         logInfo("Search in files {0} completed successfully!", searchInFilesParam.getFileIds());
@@ -432,23 +418,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public DescribeTableResponse describeTable(@Nonnull TableParam tableParam) {
+  public DescribeTableResponse describeTable(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new DescribeTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
       return new DescribeTableResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.TableSchema response;
     io.milvus.grpc.TableSchema response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .describeTable(request);
+      response = blockingStub.describeTable(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         TableSchema tableSchema =
         TableSchema tableSchema =
@@ -475,7 +457,7 @@ public class MilvusGrpcClient implements MilvusClient {
   @Override
   @Override
   public ShowTablesResponse showTables() {
   public ShowTablesResponse showTables() {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new ShowTablesResponse(
       return new ShowTablesResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
@@ -507,23 +489,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public GetTableRowCountResponse getTableRowCount(@Nonnull TableParam tableParam) {
+  public GetTableRowCountResponse getTableRowCount(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new GetTableRowCountResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), 0);
       return new GetTableRowCountResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), 0);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.TableRowCount response;
     io.milvus.grpc.TableRowCount response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .countTable(request);
+      response = blockingStub.countTable(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         long tableRowCount = response.getTableRowCount();
         long tableRowCount = response.getTableRowCount();
@@ -544,31 +522,27 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public Response serverStatus() {
-    CommandParam commandParam = new CommandParam.Builder("OK").build();
-    return command(commandParam);
+  public Response getServerStatus() {
+    return command("OK");
   }
   }
 
 
   @Override
   @Override
-  public Response serverVersion() {
-    CommandParam commandParam = new CommandParam.Builder("version").build();
-    return command(commandParam);
+  public Response getServerVersion() {
+    return command("version");
   }
   }
 
 
-  private Response command(@Nonnull CommandParam commandParam) {
+  private Response command(@Nonnull String command) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    String command = commandParam.getCommand();
     io.milvus.grpc.Command request = io.milvus.grpc.Command.newBuilder().setCmd(command).build();
     io.milvus.grpc.Command request = io.milvus.grpc.Command.newBuilder().setCmd(command).build();
     io.milvus.grpc.StringReply response;
     io.milvus.grpc.StringReply response;
 
 
     try {
     try {
-      response =
-          blockingStub.withDeadlineAfter(commandParam.getTimeout(), TimeUnit.SECONDS).cmd(request);
+      response = blockingStub.cmd(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Command `{0}`: {1}", command, response.getStringReply());
         logInfo("Command `{0}`: {1}", command, response.getStringReply());
@@ -585,37 +559,32 @@ public class MilvusGrpcClient implements MilvusClient {
     }
     }
   }
   }
 
 
-  public Response deleteByRange(@Nonnull DeleteByRangeParam deleteByRangeParam) {
+  // TODO: make deleteByRange private for now
+  private Response deleteByRange(@Nonnull String tableName, @Nonnull DateRange dateRange) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
     io.milvus.grpc.DeleteByRangeParam request =
     io.milvus.grpc.DeleteByRangeParam request =
         io.milvus.grpc.DeleteByRangeParam.newBuilder()
         io.milvus.grpc.DeleteByRangeParam.newBuilder()
-            .setRange(getRange(deleteByRangeParam.getDateRange()))
-            .setTableName(deleteByRangeParam.getTableName())
+            .setRange(getRange(dateRange))
+            .setTableName(tableName)
             .build();
             .build();
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(deleteByRangeParam.getTimeout(), TimeUnit.SECONDS)
-              .deleteByRange(request);
+      response = blockingStub.deleteByRange(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo(
         logInfo(
-            "Deleted vectors from table `{0}` in range {1} successfully!",
-            deleteByRangeParam.getTableName(), deleteByRangeParam.getDateRange().toString());
+            "Deleted vectors from table `{0}` in range {1} successfully!", tableName, dateRange);
         return new Response(Response.Status.SUCCESS);
         return new Response(Response.Status.SUCCESS);
       } else {
       } else {
         logSevere(
         logSevere(
             "Deleted vectors from table `{0}` in range {1} failed:\n{2}",
             "Deleted vectors from table `{0}` in range {1} failed:\n{2}",
-            deleteByRangeParam.getTableName(),
-            deleteByRangeParam.getDateRange().toString(),
-            response.toString());
+            tableName, dateRange, response.toString());
         return new Response(
         return new Response(
             Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
             Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
       }
       }
@@ -626,23 +595,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public Response preloadTable(@Nonnull TableParam tableParam) {
+  public Response preloadTable(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .preloadTable(request);
+      response = blockingStub.preloadTable(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Preloaded table `{0}` successfully!", tableName);
         logInfo("Preloaded table `{0}` successfully!", tableName);
@@ -659,23 +624,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public DescribeIndexResponse describeIndex(@Nonnull TableParam tableParam) {
+  public DescribeIndexResponse describeIndex(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new DescribeIndexResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
       return new DescribeIndexResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.IndexParam response;
     io.milvus.grpc.IndexParam response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .describeIndex(request);
+      response = blockingStub.describeIndex(request);
 
 
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getStatus().getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         Index index =
         Index index =
@@ -700,23 +661,19 @@ public class MilvusGrpcClient implements MilvusClient {
   }
   }
 
 
   @Override
   @Override
-  public Response dropIndex(@Nonnull TableParam tableParam) {
+  public Response dropIndex(@Nonnull String tableName) {
 
 
-    if (!connected()) {
+    if (!isConnected()) {
       logWarning("You are not connected to Milvus server");
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
     }
     }
 
 
-    String tableName = tableParam.getTableName();
     io.milvus.grpc.TableName request =
     io.milvus.grpc.TableName request =
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
         io.milvus.grpc.TableName.newBuilder().setTableName(tableName).build();
     io.milvus.grpc.Status response;
     io.milvus.grpc.Status response;
 
 
     try {
     try {
-      response =
-          blockingStub
-              .withDeadlineAfter(tableParam.getTimeout(), TimeUnit.SECONDS)
-              .dropIndex(request);
+      response = blockingStub.dropIndex(request);
 
 
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
       if (response.getErrorCode() == io.milvus.grpc.ErrorCode.SUCCESS) {
         logInfo("Dropped index for table `{0}` successfully!", tableName);
         logInfo("Dropped index for table `{0}` successfully!", tableName);
@@ -747,7 +704,7 @@ public class MilvusGrpcClient implements MilvusClient {
     List<io.milvus.grpc.Range> queryRangeList = new ArrayList<>();
     List<io.milvus.grpc.Range> queryRangeList = new ArrayList<>();
     String datePattern = "yyyy-MM-dd";
     String datePattern = "yyyy-MM-dd";
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
     SimpleDateFormat simpleDateFormat = new SimpleDateFormat(datePattern);
-    for (DateRange queryRange : searchParam.getdateRanges()) {
+    for (DateRange queryRange : searchParam.getDateRanges()) {
       io.milvus.grpc.Range dateRange =
       io.milvus.grpc.Range dateRange =
           io.milvus.grpc.Range.newBuilder()
           io.milvus.grpc.Range.newBuilder()
               .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))
               .setStartValue(simpleDateFormat.format(queryRange.getStartDate()))

+ 14 - 12
src/main/java/io/milvus/client/Response.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 33
src/main/java/io/milvus/client/SearchInFilesParam.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -24,12 +26,10 @@ import java.util.List;
 public class SearchInFilesParam {
 public class SearchInFilesParam {
   private final List<String> fileIds;
   private final List<String> fileIds;
   private final SearchParam searchParam;
   private final SearchParam searchParam;
-  private final long timeout;
 
 
   private SearchInFilesParam(@Nonnull Builder builder) {
   private SearchInFilesParam(@Nonnull Builder builder) {
     this.fileIds = builder.fileIds;
     this.fileIds = builder.fileIds;
     this.searchParam = builder.searchParam;
     this.searchParam = builder.searchParam;
-    this.timeout = builder.timeout;
   }
   }
 
 
   public List<String> getFileIds() {
   public List<String> getFileIds() {
@@ -40,19 +40,12 @@ public class SearchInFilesParam {
     return searchParam;
     return searchParam;
   }
   }
 
 
-  public long getTimeout() {
-    return timeout;
-  }
-
   /** Builder for <code>SearchInFilesParam</code> */
   /** Builder for <code>SearchInFilesParam</code> */
   public static class Builder {
   public static class Builder {
     // Required parameters
     // Required parameters
     private final List<String> fileIds;
     private final List<String> fileIds;
     private final SearchParam searchParam;
     private final SearchParam searchParam;
 
 
-    // Optional parameters - initialized to default values
-    private long timeout = 86400;
-
     /**
     /**
      * @param fileIds a <code>List</code> of file ids to search from
      * @param fileIds a <code>List</code> of file ids to search from
      * @param searchParam a <code>searchParam</code> object
      * @param searchParam a <code>searchParam</code> object
@@ -62,18 +55,6 @@ public class SearchInFilesParam {
       this.searchParam = searchParam;
       this.searchParam = 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 SearchInFilesParam build() {
     public SearchInFilesParam build() {
       return new SearchInFilesParam(this);
       return new SearchInFilesParam(this);
     }
     }

+ 15 - 32
src/main/java/io/milvus/client/SearchParam.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -29,7 +31,6 @@ public class SearchParam {
   private final List<DateRange> dateRanges;
   private final List<DateRange> dateRanges;
   private final long topK;
   private final long topK;
   private final long nProbe;
   private final long nProbe;
-  private final long timeout;
 
 
   private SearchParam(@Nonnull Builder builder) {
   private SearchParam(@Nonnull Builder builder) {
     this.tableName = builder.tableName;
     this.tableName = builder.tableName;
@@ -37,7 +38,6 @@ public class SearchParam {
     this.dateRanges = builder.dateRanges;
     this.dateRanges = builder.dateRanges;
     this.nProbe = builder.nProbe;
     this.nProbe = builder.nProbe;
     this.topK = builder.topK;
     this.topK = builder.topK;
-    this.timeout = builder.timeout;
   }
   }
 
 
   public String getTableName() {
   public String getTableName() {
@@ -48,7 +48,7 @@ public class SearchParam {
     return queryVectors;
     return queryVectors;
   }
   }
 
 
-  public List<DateRange> getdateRanges() {
+  public List<DateRange> getDateRanges() {
     return dateRanges;
     return dateRanges;
   }
   }
 
 
@@ -60,10 +60,6 @@ public class SearchParam {
     return nProbe;
     return nProbe;
   }
   }
 
 
-  public long getTimeout() {
-    return timeout;
-  }
-
   /** Builder for <code>SearchParam</code> */
   /** Builder for <code>SearchParam</code> */
   public static class Builder {
   public static class Builder {
     // Required parameters
     // Required parameters
@@ -74,7 +70,6 @@ public class SearchParam {
     private List<DateRange> dateRanges = new ArrayList<>();
     private List<DateRange> dateRanges = new ArrayList<>();
     private long topK = 1024;
     private long topK = 1024;
     private long nProbe = 20;
     private long nProbe = 20;
-    private long timeout = 86400;
 
 
     /**
     /**
      * @param tableName table to search from
      * @param tableName table to search from
@@ -121,18 +116,6 @@ public class SearchParam {
       return this;
       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() {
     public SearchParam build() {
       return new SearchParam(this);
       return new SearchParam(this);
     }
     }

+ 14 - 12
src/main/java/io/milvus/client/SearchResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 14 - 12
src/main/java/io/milvus/client/ShowTablesResponse.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 0 - 78
src/main/java/io/milvus/client/TableParam.java

@@ -1,78 +0,0 @@
-/*
- * 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>
- */
-public class TableParam {
-  private final String tableName;
-  private final long timeout;
-
-  private TableParam(@Nonnull Builder builder) {
-    this.tableName = builder.tableName;
-    this.timeout = builder.timeout;
-  }
-
-  public String getTableName() {
-    return tableName;
-  }
-
-  public long getTimeout() {
-    return timeout;
-  }
-
-  @Override
-  public String toString() {
-    return "TableParam {" + "tableName = '" + tableName + '\'' + ", timeout = " + timeout + '}';
-  }
-
-  /** Builder for <code>TableParam</code> */
-  public static class Builder {
-    // Required parameters
-    private final String tableName;
-
-    // Optional parameters - initialized to default values
-    private long timeout = 86400;
-
-    /** @param tableName table name */
-    public Builder(@Nonnull String tableName) {
-      this.tableName = 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 TableParam build() {
-      return new TableParam(this);
-    }
-  }
-}

+ 14 - 12
src/main/java/io/milvus/client/TableSchema.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;

+ 0 - 77
src/main/java/io/milvus/client/TableSchemaParam.java

@@ -1,77 +0,0 @@
-/*
- * 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> */
-public class TableSchemaParam {
-  private final TableSchema tableSchema;
-  private final long timeout;
-
-  private TableSchemaParam(@Nonnull Builder builder) {
-    this.tableSchema = builder.tableSchema;
-    this.timeout = builder.timeout;
-  }
-
-  public TableSchema getTableSchema() {
-    return tableSchema;
-  }
-
-  public long getTimeout() {
-    return timeout;
-  }
-
-  @Override
-  public String toString() {
-    return "CreateTableParam {" + tableSchema + ", timeout = " + timeout + '}';
-  }
-
-  /** Builder for <code>TableSchemaParam</code> */
-  public static class Builder {
-    // Required parameters
-    private final TableSchema tableSchema;
-
-    // Optional parameters - initialized to default values
-    private long timeout = 86400;
-
-    /**
-     * @param tableSchema a <code>TableSchema</code> object
-     * @see TableSchema
-     */
-    public Builder(@Nonnull TableSchema tableSchema) {
-      this.tableSchema = tableSchema;
-    }
-
-    /**
-     * 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 TableSchemaParam build() {
-      return new TableSchemaParam(this);
-    }
-  }
-}

+ 91 - 94
src/test/java/io/milvus/client/MilvusGrpcClientTest.java

@@ -1,18 +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
+ * 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
+ *   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.
+ * 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;
 package io.milvus.client;
@@ -22,20 +24,42 @@ import org.apache.commons.text.RandomStringGenerator;
 import java.util.*;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
+import java.util.stream.DoubleStream;
 
 
 import static org.junit.jupiter.api.Assertions.*;
 import static org.junit.jupiter.api.Assertions.*;
 
 
-class MilvusGrpcClientTest {
+class MilvusClientTest {
 
 
-  private MilvusGrpcClient client;
+  private MilvusClient client;
 
 
   private RandomStringGenerator generator;
   private RandomStringGenerator generator;
 
 
   private String randomTableName;
   private String randomTableName;
   private long size;
   private long size;
   private long dimension;
   private long dimension;
-  private TableParam tableParam;
-  private TableSchema tableSchema;
+
+  // Helper function that generates random vectors
+  static List<List<Float>> generateVectors(long vectorCount, long dimension) {
+    SplittableRandom splittableRandom = new SplittableRandom();
+    List<List<Float>> vectors = new ArrayList<>();
+    for (int i = 0; i < vectorCount; ++i) {
+      splittableRandom = splittableRandom.split();
+      DoubleStream doubleStream = splittableRandom.doubles(dimension);
+      List<Float> vector =
+          doubleStream.boxed().map(Double::floatValue).collect(Collectors.toList());
+      vectors.add(vector);
+    }
+    return vectors;
+  }
+
+  // Helper function that normalizes a vector if you are using IP (Inner product) as your metric
+  // type
+  static List<Float> normalizeVector(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.BeforeEach
   @org.junit.jupiter.api.BeforeEach
   void setUp() throws Exception {
   void setUp() throws Exception {
@@ -47,52 +71,62 @@ class MilvusGrpcClientTest {
 
 
     generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
     generator = new RandomStringGenerator.Builder().withinRange('a', 'z').build();
     randomTableName = generator.generate(10);
     randomTableName = generator.generate(10);
-    size = 100;
+    size = 100000;
     dimension = 128;
     dimension = 128;
-    tableParam = new TableParam.Builder(randomTableName).build();
-    tableSchema =
+    TableSchema tableSchema =
         new TableSchema.Builder(randomTableName, dimension)
         new TableSchema.Builder(randomTableName, dimension)
             .withIndexFileSize(1024)
             .withIndexFileSize(1024)
             .withMetricType(MetricType.IP)
             .withMetricType(MetricType.IP)
             .build();
             .build();
-    TableSchemaParam tableSchemaParam = new TableSchemaParam.Builder(tableSchema).build();
 
 
-    assertTrue(client.createTable(tableSchemaParam).ok());
+    assertTrue(client.createTable(tableSchema).ok());
   }
   }
 
 
   @org.junit.jupiter.api.AfterEach
   @org.junit.jupiter.api.AfterEach
   void tearDown() throws InterruptedException {
   void tearDown() throws InterruptedException {
-    assertTrue(client.dropTable(tableParam).ok());
+    assertTrue(client.dropTable(randomTableName).ok());
     client.disconnect();
     client.disconnect();
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
-  void connected() {
-    assertTrue(client.connected());
+  void connectInvalidPort() {
+    MilvusClient client = new MilvusGrpcClient();
+    ConnectParam connectParam =
+        new ConnectParam.Builder().withHost("localhost").withPort("66666").build();
+    assertThrows(ConnectFailedException.class, () -> client.connect(connectParam));
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
-  void createTable() {
+  void connectUnreachableHost() {
+    MilvusClient client = new MilvusGrpcClient();
+    ConnectParam connectParam = new ConnectParam.Builder().withHost("250.250.250.250").build();
+    assertThrows(ConnectFailedException.class, () -> client.connect(connectParam));
+  }
+
+  @org.junit.jupiter.api.Test
+  void isConnected() {
+    assertTrue(client.isConnected());
+  }
+
+  @org.junit.jupiter.api.Test
+  void createInvalidTable() {
     String invalidTableName = "╯°□°)╯";
     String invalidTableName = "╯°□°)╯";
     TableSchema invalidTableSchema = new TableSchema.Builder(invalidTableName, dimension).build();
     TableSchema invalidTableSchema = new TableSchema.Builder(invalidTableName, dimension).build();
-    TableSchemaParam invalidTableSchemaParam =
-        new TableSchemaParam.Builder(invalidTableSchema).withTimeout(20).build();
-    Response createTableResponse = client.createTable(invalidTableSchemaParam);
+    Response createTableResponse = client.createTable(invalidTableSchema);
     assertFalse(createTableResponse.ok());
     assertFalse(createTableResponse.ok());
     assertEquals(Response.Status.ILLEGAL_TABLE_NAME, createTableResponse.getStatus());
     assertEquals(Response.Status.ILLEGAL_TABLE_NAME, createTableResponse.getStatus());
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void hasTable() {
   void hasTable() {
-    HasTableResponse hasTableResponse = client.hasTable(tableParam);
+    HasTableResponse hasTableResponse = client.hasTable(randomTableName);
     assertTrue(hasTableResponse.getResponse().ok());
     assertTrue(hasTableResponse.getResponse().ok());
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void dropTable() {
   void dropTable() {
     String nonExistingTableName = generator.generate(10);
     String nonExistingTableName = generator.generate(10);
-    TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
-    Response dropTableResponse = client.dropTable(tableParam);
+    Response dropTableResponse = client.dropTable(nonExistingTableName);
     assertFalse(dropTableResponse.ok());
     assertFalse(dropTableResponse.ok());
     assertEquals(Response.Status.TABLE_NOT_EXISTS, dropTableResponse.getStatus());
     assertEquals(Response.Status.TABLE_NOT_EXISTS, dropTableResponse.getStatus());
   }
   }
@@ -108,54 +142,28 @@ class MilvusGrpcClientTest {
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void insert() {
   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);
-    }
+    List<List<Float>> vectors = generateVectors(size, dimension);
     InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
     InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
     InsertResponse insertResponse = client.insert(insertParam);
     InsertResponse insertResponse = client.insert(insertParam);
     assertTrue(insertResponse.getResponse().ok());
     assertTrue(insertResponse.getResponse().ok());
     assertEquals(size, insertResponse.getVectorIds().size());
     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
   @org.junit.jupiter.api.Test
   void search() throws InterruptedException {
   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);
-      }
-    }
+    List<List<Float>> vectors = generateVectors(size, dimension);
+    vectors = vectors.stream().map(MilvusClientTest::normalizeVector).collect(Collectors.toList());
     InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
     InsertParam insertParam = new InsertParam.Builder(randomTableName, vectors).build();
     InsertResponse insertResponse = client.insert(insertParam);
     InsertResponse insertResponse = client.insert(insertParam);
     assertTrue(insertResponse.getResponse().ok());
     assertTrue(insertResponse.getResponse().ok());
-    assertEquals(size, insertResponse.getVectorIds().size());
+    List<Long> vectorIds = insertResponse.getVectorIds();
+    assertEquals(size, vectorIds.size());
 
 
     TimeUnit.SECONDS.sleep(1);
     TimeUnit.SECONDS.sleep(1);
 
 
+    final int searchSize = 5;
+    List<List<Float>> vectorsToSearch = vectors.subList(0, searchSize);
+
     List<DateRange> queryRanges = new ArrayList<>();
     List<DateRange> queryRanges = new ArrayList<>();
     Date today = new Date();
     Date today = new Date();
     Calendar c = Calendar.getInstance();
     Calendar c = Calendar.getInstance();
@@ -166,17 +174,24 @@ class MilvusGrpcClientTest {
     c.add(Calendar.DAY_OF_MONTH, 1);
     c.add(Calendar.DAY_OF_MONTH, 1);
     Date tomorrow = c.getTime();
     Date tomorrow = c.getTime();
     queryRanges.add(new DateRange(yesterday, tomorrow));
     queryRanges.add(new DateRange(yesterday, tomorrow));
-    System.out.println(queryRanges);
+    final long topK = 1000;
     SearchParam searchParam =
     SearchParam searchParam =
         new SearchParam.Builder(randomTableName, vectorsToSearch)
         new SearchParam.Builder(randomTableName, vectorsToSearch)
-            .withTopK(1)
+            .withTopK(topK)
             .withNProbe(20)
             .withNProbe(20)
             .withDateRanges(queryRanges)
             .withDateRanges(queryRanges)
             .build();
             .build();
     SearchResponse searchResponse = client.search(searchParam);
     SearchResponse searchResponse = client.search(searchParam);
     assertTrue(searchResponse.getResponse().ok());
     assertTrue(searchResponse.getResponse().ok());
     System.out.println(searchResponse);
     System.out.println(searchResponse);
-    assertEquals(searchSize, searchResponse.getQueryResultsList().size());
+    List<List<SearchResponse.QueryResult>> queryResultsList = searchResponse.getQueryResultsList();
+    assertEquals(searchSize, queryResultsList.size());
+    final double epsilon = 0.001;
+    for (int i = 0; i < searchSize; i++) {
+      SearchResponse.QueryResult firstQueryResult = queryResultsList.get(i).get(0);
+      assertEquals(vectorIds.get(i), firstQueryResult.getVectorId());
+      assertTrue(Math.abs(1 - firstQueryResult.getDistance()) < epsilon);
+    }
   }
   }
 
 
   //    @org.junit.jupiter.api.Test
   //    @org.junit.jupiter.api.Test
@@ -185,13 +200,12 @@ class MilvusGrpcClientTest {
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void describeTable() {
   void describeTable() {
-    DescribeTableResponse describeTableResponse = client.describeTable(tableParam);
+    DescribeTableResponse describeTableResponse = client.describeTable(randomTableName);
     assertTrue(describeTableResponse.getResponse().ok());
     assertTrue(describeTableResponse.getResponse().ok());
     assertTrue(describeTableResponse.getTableSchema().isPresent());
     assertTrue(describeTableResponse.getTableSchema().isPresent());
 
 
     String nonExistingTableName = generator.generate(10);
     String nonExistingTableName = generator.generate(10);
-    TableParam tableParam = new TableParam.Builder(nonExistingTableName).build();
-    describeTableResponse = client.describeTable(tableParam);
+    describeTableResponse = client.describeTable(nonExistingTableName);
     assertFalse(describeTableResponse.getResponse().ok());
     assertFalse(describeTableResponse.getResponse().ok());
     assertFalse(describeTableResponse.getTableSchema().isPresent());
     assertFalse(describeTableResponse.getTableSchema().isPresent());
   }
   }
@@ -204,13 +218,13 @@ class MilvusGrpcClientTest {
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void serverStatus() {
   void serverStatus() {
-    Response serverStatusResponse = client.serverStatus();
+    Response serverStatusResponse = client.getServerStatus();
     assertTrue(serverStatusResponse.ok());
     assertTrue(serverStatusResponse.ok());
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void serverVersion() {
   void serverVersion() {
-    Response serverVersionResponse = client.serverVersion();
+    Response serverVersionResponse = client.getServerVersion();
     assertTrue(serverVersionResponse.ok());
     assertTrue(serverVersionResponse.ok());
   }
   }
 
 
@@ -219,44 +233,27 @@ class MilvusGrpcClientTest {
     insert();
     insert();
     TimeUnit.SECONDS.sleep(1);
     TimeUnit.SECONDS.sleep(1);
 
 
-    GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(tableParam);
+    GetTableRowCountResponse getTableRowCountResponse = client.getTableRowCount(randomTableName);
     assertTrue(getTableRowCountResponse.getResponse().ok());
     assertTrue(getTableRowCountResponse.getResponse().ok());
     assertEquals(size, getTableRowCountResponse.getTableRowCount());
     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
   @org.junit.jupiter.api.Test
   void preloadTable() {
   void preloadTable() {
-    Response preloadTableResponse = client.preloadTable(tableParam);
+    Response preloadTableResponse = client.preloadTable(randomTableName);
     assertTrue(preloadTableResponse.ok());
     assertTrue(preloadTableResponse.ok());
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void describeIndex() {
   void describeIndex() {
-    DescribeIndexResponse describeIndexResponse = client.describeIndex(tableParam);
+    DescribeIndexResponse describeIndexResponse = client.describeIndex(randomTableName);
     assertTrue(describeIndexResponse.getResponse().ok());
     assertTrue(describeIndexResponse.getResponse().ok());
     assertTrue(describeIndexResponse.getIndex().isPresent());
     assertTrue(describeIndexResponse.getIndex().isPresent());
   }
   }
 
 
   @org.junit.jupiter.api.Test
   @org.junit.jupiter.api.Test
   void dropIndex() {
   void dropIndex() {
-    Response dropIndexResponse = client.dropIndex(tableParam);
+    Response dropIndexResponse = client.dropIndex(randomTableName);
     assertTrue(dropIndexResponse.ok());
     assertTrue(dropIndexResponse.ok());
   }
   }
 }
 }