Răsfoiți Sursa

Update interface and refactor code

Signed-off-by: sahuang <xiaohai.xu@zilliz.com>
sahuang 5 ani în urmă
părinte
comite
52015ccccc

+ 19 - 20
README.md

@@ -2,7 +2,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/)
 
-Java SDK for [Milvus](https://github.com/milvus-io/milvus). To contribute code to this project, please read our [contribution guidelines](https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md) first.
+Java SDK for [Milvus](https://github.com/milvus-io/milvus). To contribute to this project, please read our [contribution guidelines](https://github.com/milvus-io/milvus/blob/master/CONTRIBUTING.md) first.
 
 ## Getting started
 
@@ -53,29 +53,28 @@ Please refer to [examples](https://github.com/milvus-io/milvus-sdk-java/tree/mas
 
 - [Javadoc](https://milvus-io.github.io/milvus-sdk-java/javadoc/index.html)
 
-### Additional information
+### Troubleshooting
 
-- The Java source code is formatted using [google-java-format](https://github.com/google/google-java-format).
-- If you receive the following error when running your application:
+- If you encounter the following error when running your application:
     ```
     Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
     ```
-  This is because SLF4J jar file needs to be added into your application's classpath.
+  This is because SLF4J jar files need to be added into your application's classpath. SLF4J is required by Java SDK for logging purpose.
   
   To fix this issue, you can use **Apache Maven** or **Gradle**/**Grails** to download the required jar files.
                                                                                                          
-    - Apache Maven
- 
-        ```xml
-         <dependency>
-             <groupId>org.slf4j</groupId>
-             <artifactId>slf4j-api</artifactId>
-             <version>1.7.30</version>
-         </dependency>
-        ```
- 
-    - Gradle/Grails
- 
-         ```gradle
-         compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
-         ```
+- Apache Maven
+
+    ```xml
+     <dependency>
+         <groupId>org.slf4j</groupId>
+         <artifactId>slf4j-api</artifactId>
+         <version>1.7.30</version>
+     </dependency>
+    ```
+
+- Gradle/Grails
+
+     ```gradle
+     compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.30'
+     ```

+ 17 - 37
examples/src/main/java/MilvusClientExample.java

@@ -97,9 +97,9 @@ public class MilvusClientExample {
     // Check whether the collection exists
     HasCollectionResponse hasCollectionResponse = client.hasCollection(collectionName);
 
-    // Describe the collection
-    DescribeCollectionResponse describeCollectionResponse =
-        client.describeCollection(collectionName);
+    // Get collection info
+    GetCollectionInfoResponse getCollectionInfoResponse =
+        client.getCollectionInfo(collectionName);
 
     // Insert randomly generated vectors to collection
     final int vectorCount = 100000;
@@ -116,9 +116,9 @@ public class MilvusClientExample {
     // Flush data in collection
     Response flushResponse = client.flush(collectionName);
 
-    // Get current row count of collection
-    GetCollectionRowCountResponse getCollectionRowCountResponse =
-        client.getCollectionRowCount(collectionName);
+    // Get current entity count of collection
+    CountEntitiesResponse ountEntitiesResponse =
+        client.countEntities(collectionName);
 
     // Create index for the collection
     // We choose IVF_SQ8 as our index type here. Refer to IndexType javadoc for a
@@ -134,15 +134,16 @@ public class MilvusClientExample {
             .build();
     Response createIndexResponse = client.createIndex(index);
 
-    // Describe the index for your collection
-    DescribeIndexResponse describeIndexResponse = client.describeIndex(collectionName);
+    // Get index info for your collection
+    GetIndexInfoResponse getIndexInfoResponse = client.getIndexInfo(collectionName);
+    System.out.format("Index Info: %s\n", getIndexInfoResponse.getIndex().toString());
 
     // Get collection info
-    Response showCollectionInfoResponse = client.showCollectionInfo(collectionName);
-    if (showCollectionInfoResponse.ok()) {
+    Response getCollectionStatsResponse = client.getCollectionStats(collectionName);
+    if (getCollectionStatsResponse.ok()) {
       // Collection info is sent back with JSON type string
-      String jsonString = showCollectionInfoResponse.getMessage();
-      System.out.println(jsonString);
+      String jsonString = getCollectionStatsResponse.getMessage();
+      System.out.format("Collection Stats: %s\n", jsonString);
     }
 
     // Check whether a partition exists in collection
@@ -187,27 +188,6 @@ public class MilvusClientExample {
     List<List<Long>> resultIds = searchResponse.getResultIdsList();
     List<List<Float>> resultDistances = searchResponse.getResultDistancesList();
 
-    // SearchByIds
-    // Searching the first 5 vectors of the vectors we just inserted by ID
-    SearchByIdsParam searchByIdsParam =
-            new SearchByIdsParam.Builder(collectionName)
-                    .withIDs(vectorIds.subList(0, searchBatchSize))
-                    .withTopK(topK)
-                    .withParamsInJson(searchParamsJson.toString())
-                    .build();
-    SearchResponse searchByIDResponse = client.searchByIds(searchByIdsParam);
-    if (searchByIDResponse.ok()) {
-      List<List<SearchResponse.QueryResult>> queryResultsList = searchResponse.getQueryResultsList();
-      final double epsilon = 0.001;
-      for (int i = 0; i < searchBatchSize; i++) {
-        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!");
-        }
-      }
-    }
-
     // You can send search request asynchronously, which returns a ListenableFuture object
     ListenableFuture<SearchResponse> searchResponseFuture = client.searchAsync(searchParam);
     try {
@@ -220,16 +200,16 @@ public class MilvusClientExample {
 
     // Delete the first 5 of vectors you just searched
     Response deleteByIdsResponse =
-        client.deleteByIds(collectionName, vectorIds.subList(0, searchBatchSize));
+        client.deleteEntityByID(collectionName, vectorIds.subList(0, searchBatchSize));
 
     // Flush again, so deletions to data become visible
     flushResponse = client.flush(collectionName);
 
     // Try to get the corresponding vector of the first id you just deleted.
-    GetVectorsByIdsResponse getVectorsByIdsResponse =
-        client.getVectorsByIds(collectionName, vectorIds.subList(0, searchBatchSize));
+    GetEntityByIDResponse getEntityByIDResponse =
+        client.getEntityByID(collectionName, vectorIds.subList(0, searchBatchSize));
     // Obviously you won't get anything
-    if (!getVectorsByIdsResponse.getFloatVectors().get(0).isEmpty()) {
+    if (!getEntityByIDResponse.getFloatVectors().get(0).isEmpty()) {
       throw new AssertionError("This can never happen!");
     }
 

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

@@ -1,78 +0,0 @@
-package io.milvus.client;
-
-import java.util.List;
-
-/** Represents information about a collection */
-public class CollectionInfo {
-  private final long rowCount;
-  private final List<PartitionInfo> partitionInfos;
-
-  CollectionInfo(long rowCount, List<PartitionInfo> partitionInfos) {
-    this.rowCount = rowCount;
-    this.partitionInfos = partitionInfos;
-  }
-
-  public long getRowCount() {
-    return rowCount;
-  }
-
-  public List<PartitionInfo> getPartitionInfos() {
-    return partitionInfos;
-  }
-
-  /** Represents information about a single partition in a collection */
-  public static class PartitionInfo {
-    private final String tag;
-    private final long rowCount;
-    private final List<SegmentInfo> segmentInfos;
-
-    PartitionInfo(String tag, long rowCount, List<SegmentInfo> segmentInfos) {
-      this.tag = tag;
-      this.rowCount = rowCount;
-      this.segmentInfos = segmentInfos;
-    }
-
-    public String getTag() {
-      return tag;
-    }
-
-    public long getRowCount() {
-      return rowCount;
-    }
-
-    public List<SegmentInfo> getSegmentInfos() {
-      return segmentInfos;
-    }
-
-    /** Represents information about a single segment in a partition */
-    public static class SegmentInfo {
-      private final String segmentName;
-      private final long rowCount;
-      private final String indexName;
-      private final long dataSize;
-
-      SegmentInfo(String segmentName, long rowCount, String indexName, long dataSize) {
-        this.segmentName = segmentName;
-        this.rowCount = rowCount;
-        this.indexName = indexName;
-        this.dataSize = dataSize;
-      }
-
-      public String getSegmentName() {
-        return segmentName;
-      }
-
-      public long getRowCount() {
-        return rowCount;
-      }
-
-      public String getIndexName() {
-        return indexName;
-      }
-
-      public long getDataSize() {
-        return dataSize;
-      }
-    }
-  }
-}

+ 10 - 10
src/main/java/io/milvus/client/GetCollectionRowCountResponse.java → src/main/java/io/milvus/client/CountEntitiesResponse.java

@@ -20,20 +20,20 @@
 package io.milvus.client;
 
 /**
- * Contains the returned <code>response</code> and <code>collectionRowCount</code> for <code>
- * getCollectionRowCount</code>
+ * Contains the returned <code>response</code> and <code>collectionEntityCount</code> for <code>
+ * countEntities</code>
  */
-public class GetCollectionRowCountResponse {
+public class CountEntitiesResponse {
   private final Response response;
-  private final long collectionRowCount;
+  private final long collectionEntityCount;
 
-  GetCollectionRowCountResponse(Response response, long collectionRowCount) {
+  CountEntitiesResponse(Response response, long collectionEntityCount) {
     this.response = response;
-    this.collectionRowCount = collectionRowCount;
+    this.collectionEntityCount = collectionEntityCount;
   }
 
-  public long getCollectionRowCount() {
-    return collectionRowCount;
+  public long getCollectionEntityCount() {
+    return collectionEntityCount;
   }
 
   public Response getResponse() {
@@ -48,7 +48,7 @@ public class GetCollectionRowCountResponse {
   @Override
   public String toString() {
     return String.format(
-        "CountCollectionResponse {%s, collection row count = %d}",
-        response.toString(), collectionRowCount);
+        "CountCollectionResponse {%s, collection entity count = %d}",
+        response.toString(), collectionEntityCount);
   }
 }

+ 4 - 4
src/main/java/io/milvus/client/DescribeCollectionResponse.java → src/main/java/io/milvus/client/GetCollectionInfoResponse.java

@@ -24,14 +24,14 @@ import java.util.Optional;
 
 /**
  * Contains the returned <code>response</code> and <code>collectionMapping</code> for <code>
- * describeCollection
+ * getCollectionInfo
  * </code>
  */
-public class DescribeCollectionResponse {
+public class GetCollectionInfoResponse {
   private final Response response;
   private final CollectionMapping collectionMapping;
 
-  DescribeCollectionResponse(Response response, @Nullable CollectionMapping collectionMapping) {
+  GetCollectionInfoResponse(Response response, @Nullable CollectionMapping collectionMapping) {
     this.response = response;
     this.collectionMapping = collectionMapping;
   }
@@ -57,7 +57,7 @@ public class DescribeCollectionResponse {
   @Override
   public String toString() {
     return String.format(
-        "DescribeCollectionResponse {%s, %s}",
+        "GetCollectionInfoResponse {%s, %s}",
         response.toString(),
         collectionMapping == null ? "Collection mapping = None" : collectionMapping.toString());
   }

+ 3 - 3
src/main/java/io/milvus/client/GetVectorsByIdsResponse.java → src/main/java/io/milvus/client/GetEntityByIDResponse.java

@@ -5,15 +5,15 @@ import java.util.List;
 
 /**
  * Contains the returned <code>response</code> and either a <code>List</code> of <code>floatVectors</code> or <code>
- * binaryVectors</code> for <code>getVectorsByIds</code>. If the id does not exist, both float and binary
+ * binaryVectors</code> for <code>getEntityByID</code>. If the id does not exist, both float and binary
  * vectors corresponding to the id will be empty.
  */
-public class GetVectorsByIdsResponse {
+public class GetEntityByIDResponse {
   private final Response response;
   private final List<List<Float>> floatVectors;
   private final List<ByteBuffer> binaryVectors;
 
-  GetVectorsByIdsResponse(Response response, List<List<Float>> floatVectors, List<ByteBuffer> binaryVectors) {
+  GetEntityByIDResponse(Response response, List<List<Float>> floatVectors, List<ByteBuffer> binaryVectors) {
     this.response = response;
     this.floatVectors = floatVectors;
     this.binaryVectors = binaryVectors;

+ 4 - 4
src/main/java/io/milvus/client/DescribeIndexResponse.java → src/main/java/io/milvus/client/GetIndexInfoResponse.java

@@ -23,13 +23,13 @@ import javax.annotation.Nullable;
 import java.util.Optional;
 
 /**
- * Contains the returned <code>response</code> and <code>index</code> for <code>describeIndex</code>
+ * Contains the returned <code>response</code> and <code>index</code> for <code>getIndexInfo</code>
  */
-public class DescribeIndexResponse {
+public class GetIndexInfoResponse {
   private final Response response;
   private final Index index;
 
-  DescribeIndexResponse(Response response, @Nullable Index index) {
+  GetIndexInfoResponse(Response response, @Nullable Index index) {
     this.response = response;
     this.index = index;
   }
@@ -55,7 +55,7 @@ public class DescribeIndexResponse {
   @Override
   public String toString() {
     return String.format(
-        "DescribeIndexResponse {%s, %s}",
+        "GetIndexInfoResponse {%s, %s}",
         response.toString(), index == null ? "Index = Null" : index.toString());
   }
 }

+ 4 - 4
src/main/java/io/milvus/client/ShowCollectionsResponse.java → src/main/java/io/milvus/client/ListCollectionsResponse.java

@@ -23,14 +23,14 @@ import java.util.List;
 
 /**
  * Contains the returned <code>response</code> and <code>collectionNames</code> for <code>
- * showCollections
+ * listCollections
  * </code>
  */
-public class ShowCollectionsResponse {
+public class ListCollectionsResponse {
   private final Response response;
   private final List<String> collectionNames;
 
-  ShowCollectionsResponse(Response response, List<String> collectionNames) {
+  ListCollectionsResponse(Response response, List<String> collectionNames) {
     this.response = response;
     this.collectionNames = collectionNames;
   }
@@ -51,7 +51,7 @@ public class ShowCollectionsResponse {
   @Override
   public String toString() {
     return String.format(
-        "ShowCollectionsResponse {%s, collection names = %s}",
+        "ListCollectionsResponse {%s, collection names = %s}",
         response, collectionNames.toString());
   }
 }

+ 3 - 3
src/main/java/io/milvus/client/GetVectorIdsResponse.java → src/main/java/io/milvus/client/ListIDInSegmentResponse.java

@@ -4,13 +4,13 @@ import java.util.List;
 
 /**
  * Contains the returned <code>response</code> and a <code>List</code> of ids present in a segment
- * for <code>getVectorIds</code>.
+ * for <code>listIDInSegment</code>.
  */
-public class GetVectorIdsResponse {
+public class ListIDInSegmentResponse {
   private final Response response;
   private final List<Long> ids;
 
-  GetVectorIdsResponse(Response response, List<Long> ids) {
+  ListIDInSegmentResponse(Response response, List<Long> ids) {
     this.response = response;
     this.ids = ids;
   }

+ 3 - 3
src/main/java/io/milvus/client/ShowPartitionsResponse.java → src/main/java/io/milvus/client/ListPartitionsResponse.java

@@ -23,14 +23,14 @@ import java.util.List;
 
 /**
  * Contains the returned <code>response</code> and <code>partitionList</code> for <code>
- * showPartitions
+ * listPartitions
  * </code>
  */
-public class ShowPartitionsResponse {
+public class ListPartitionsResponse {
   private final Response response;
   private final List<String> partitionList;
 
-  ShowPartitionsResponse(Response response, List<String> partitionList) {
+  ListPartitionsResponse(Response response, List<String> partitionList) {
     this.response = response;
     this.partitionList = partitionList;
   }

+ 31 - 90
src/main/java/io/milvus/client/MilvusClient.java

@@ -177,14 +177,14 @@ public interface MilvusClient {
   HasPartitionResponse hasPartition(String collectionName, String tag);
 
   /**
-   * Shows current partitions of a collection
+   * Lists current partitions of a collection
    *
    * @param collectionName collection name
-   * @return <code>ShowPartitionsResponse</code>
-   * @see ShowPartitionsResponse
+   * @return <code>ListPartitionsResponse</code>
+   * @see ListPartitionsResponse
    * @see Response
    */
-  ShowPartitionsResponse showPartitions(String collectionName);
+  ListPartitionsResponse listPartitions(String collectionName);
 
   /**
    * Drops partition specified by <code>collectionName</code> and <code>tag</code>
@@ -264,30 +264,6 @@ public interface MilvusClient {
    */
   SearchResponse search(SearchParam searchParam);
 
-  /**
-   * Searches vectors specified by <code>searchByIdsParam</code>
-   *
-   * @param searchByIdsParam the <code>SearchByIdsParam</code> object
-   *     <pre>
-   * example usage:
-   * <code>
-   * SearchByIdsParam searchByIdsParam = new SearchByIdsParam.Builder(collectionName)
-   *                                          .withIDs(ids)
-   *                                          .withTopK(topK)
-   *                                          .withPartitionTags(partitionTagsList)
-   *                                          .withParamsInJson("{\"nprobe\": 20}")
-   *                                          .build();
-   * </code>
-   * </pre>
-   *
-   * @return <code>SearchResponse</code>
-   * @see SearchByIdsParam
-   * @see SearchResponse
-   * @see SearchResponse.QueryResult
-   * @see Response
-   */
-  SearchResponse searchByIds(SearchByIdsParam searchByIdsParam);
-
   /**
    * Searches vectors specified by <code>searchParam</code> asynchronously
    *
@@ -314,58 +290,33 @@ public interface MilvusClient {
   ListenableFuture<SearchResponse> searchAsync(SearchParam searchParam);
 
   /**
-   * Searches vectors in specific files
-   *
-   * @param fileIds list of file ids to search from
-   * @param searchParam the <code>SearchParam</code> object
-   *     <pre>
-   * example usage:
-   * <code>
-   * SearchParam searchParam = new SearchParam.Builder(collectionName)
-   *                                          .withFloatVectors(floatVectors)
-   *                                          .withTopK(topK)
-   *                                          .withPartitionTags(partitionTagsList)
-   *                                          .withParamsInJson("{\"nprobe\": 20}")
-   *                                          .build();
-   * </code>
-   * </pre>
-   *
-   * @return <code>SearchResponse</code>
-   * @see SearchParam
-   * @see SearchResponse
-   * @see SearchResponse.QueryResult
-   * @see Response
-   */
-  SearchResponse searchInFiles(List<String> fileIds, SearchParam searchParam);
-
-  /**
-   * Describes the collection
+   * Gets collection info
    *
    * @param collectionName collection to describe
-   * @see DescribeCollectionResponse
+   * @see GetCollectionInfoResponse
    * @see CollectionMapping
    * @see Response
    */
-  DescribeCollectionResponse describeCollection(String collectionName);
+  GetCollectionInfoResponse getCollectionInfo(String collectionName);
 
   /**
-   * Shows current collections
+   * Lists current collections
    *
-   * @return <code>ShowCollectionsResponse</code>
-   * @see ShowCollectionsResponse
+   * @return <code>ListCollectionsResponse</code>
+   * @see ListCollectionsResponse
    * @see Response
    */
-  ShowCollectionsResponse showCollections();
+  ListCollectionsResponse listCollections();
 
   /**
-   * Gets current row count of a collection
+   * Gets current entity count of a collection
    *
-   * @param collectionName collection to get row count
-   * @return <code>GetCollectionRowCountResponse</code>
-   * @see GetCollectionRowCountResponse
+   * @param collectionName collection to count entities
+   * @return <code>CountEntitiesResponse</code>
+   * @see CountEntitiesResponse
    * @see Response
    */
-  GetCollectionRowCountResponse getCollectionRowCount(String collectionName);
+  CountEntitiesResponse countEntities(String collectionName);
 
   /**
    * Get server status
@@ -394,21 +345,21 @@ public interface MilvusClient {
   /**
    * Pre-loads collection to memory
    *
-   * @param collectionName collection to preload
+   * @param collectionName collection to load
    * @return <code>Response</code>
    * @see Response
    */
-  Response preloadCollection(String collectionName);
+  Response loadCollection(String collectionName);
 
   /**
-   * Describes collection index
+   * Gets collection index information
    *
-   * @param collectionName collection to describe index of
-   * @see DescribeIndexResponse
+   * @param collectionName collection to get info from
+   * @see GetIndexInfoResponse
    * @see Index
    * @see Response
    */
-  DescribeIndexResponse describeIndex(String collectionName);
+  GetIndexInfoResponse getIndexInfo(String collectionName);
 
   /**
    * Drops collection index
@@ -429,29 +380,29 @@ public interface MilvusClient {
    * @return <code>Response</code>
    * @see Response
    */
-  Response showCollectionInfo(String collectionName);
+  Response getCollectionStats(String collectionName);
 
   /**
    * Gets vectors data by id array
    *
    * @param collectionName collection to get vectors from
    * @param ids a <code>List</code> of vector ids
-   * @return <code>GetVectorsByIdsResponse</code>
-   * @see GetVectorsByIdsResponse
+   * @return <code>GetEntityByIDResponse</code>
+   * @see GetEntityByIDResponse
    * @see Response
    */
-  GetVectorsByIdsResponse getVectorsByIds(String collectionName, List<Long> ids);
+  GetEntityByIDResponse getEntityByID(String collectionName, List<Long> ids);
 
   /**
    * Gets all vector ids in a segment
    *
    * @param collectionName collection to get vector ids from
-   * @param segmentName segment name
-   * @return <code>GetVectorIdsResponse</code>
-   * @see GetVectorIdsResponse
+   * @param segmentName segment name in the collection
+   * @return <code>ListIDInSegmentResponse</code>
+   * @see ListIDInSegmentResponse
    * @see Response
    */
-  GetVectorIdsResponse getVectorIds(String collectionName, String segmentName);
+  ListIDInSegmentResponse listIDInSegment(String collectionName, String segmentName);
 
   /**
    * Deletes data in a collection by a list of ids
@@ -461,17 +412,7 @@ public interface MilvusClient {
    * @return <code>Response</code>
    * @see Response
    */
-  Response deleteByIds(String collectionName, List<Long> ids);
-
-  /**
-   * Deletes data in a collection by a single id
-   *
-   * @param collectionName collection to delete id from
-   * @param id vector id to delete
-   * @return <code>Response</code>
-   * @see Response
-   */
-  Response deleteById(String collectionName, Long id);
+  Response deleteEntityByID(String collectionName, List<Long> ids);
 
   /**
    * Flushes data in a list collections. Newly inserted or modifications on data will be visible

+ 66 - 202
src/main/java/io/milvus/client/MilvusGrpcClient.java

@@ -44,10 +44,6 @@ import org.slf4j.LoggerFactory;
 public class MilvusGrpcClient implements MilvusClient {
 
   private static final Logger logger = LoggerFactory.getLogger(MilvusGrpcClient.class);
-  private static final String ANSI_RESET = "\u001B[0m";
-  private static final String ANSI_YELLOW = "\u001B[33m";
-  private static final String ANSI_PURPLE = "\u001B[35m";
-  private static final String ANSI_BRIGHT_PURPLE = "\u001B[95m";
   private final String extraParamKey = "params";
   private ManagedChannel channel = null;
   private MilvusServiceGrpc.MilvusServiceBlockingStub blockingStub = null;
@@ -389,11 +385,11 @@ public class MilvusGrpcClient implements MilvusClient {
   }
 
   @Override
-  public ShowPartitionsResponse showPartitions(String collectionName) {
+  public ListPartitionsResponse listPartitions(String collectionName) {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new ShowPartitionsResponse(
+      return new ListPartitionsResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
@@ -407,19 +403,19 @@ public class MilvusGrpcClient implements MilvusClient {
         logInfo(
             "Current partitions of collection {}: {}",
             collectionName, response.getPartitionTagArrayList());
-        return new ShowPartitionsResponse(
+        return new ListPartitionsResponse(
             new Response(Response.Status.SUCCESS), response.getPartitionTagArrayList());
       } else {
-        logError("Show partitions failed:\n{}", response.toString());
-        return new ShowPartitionsResponse(
+        logError("List partitions failed:\n{}", response.toString());
+        return new ListPartitionsResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             new ArrayList<>());
       }
     } catch (StatusRuntimeException e) {
-      logError("showPartitions RPC failed:\n{}", e.getStatus().toString());
-      return new ShowPartitionsResponse(
+      logError("listPartitions RPC failed:\n{}", e.getStatus().toString());
+      return new ListPartitionsResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
     }
   }
@@ -620,62 +616,6 @@ public class MilvusGrpcClient implements MilvusClient {
     }
   }
 
-  @Override
-  public SearchResponse searchByIds(@Nonnull SearchByIdsParam searchByIdsParam) {
-
-    if (!channelIsReadyOrIdle()) {
-      logWarning("You are not connected to Milvus server");
-      SearchResponse searchResponse = new SearchResponse();
-      searchResponse.setResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED));
-      return searchResponse;
-    }
-
-    List<Long> idList = searchByIdsParam.getIds();
-
-    KeyValuePair extraParam =
-            KeyValuePair.newBuilder()
-                    .setKey(extraParamKey)
-                    .setValue(searchByIdsParam.getParamsInJson())
-                    .build();
-
-    io.milvus.grpc.SearchByIDParam request =
-            io.milvus.grpc.SearchByIDParam.newBuilder()
-                    .setCollectionName(searchByIdsParam.getCollectionName())
-                    .addAllIdArray(idList)
-                    .addAllPartitionTagArray(searchByIdsParam.getPartitionTags())
-                    .setTopk(searchByIdsParam.getTopK())
-                    .addExtraParams(extraParam)
-                    .build();
-
-    TopKQueryResult response;
-
-    try {
-      response = blockingStub.searchByID(request);
-
-      if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
-        SearchResponse searchResponse = buildSearchResponse(response);
-        searchResponse.setResponse(new Response(Response.Status.SUCCESS));
-        logInfo(
-                "Search by ids completed successfully! Returned results for {} queries",
-                searchResponse.getNumQueries());
-        return searchResponse;
-      } else {
-        logError("Search by ids failed:\n{}", response.getStatus().toString());
-        SearchResponse searchResponse = new SearchResponse();
-        searchResponse.setResponse(
-                new Response(
-                        Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                        response.getStatus().getReason()));
-        return searchResponse;
-      }
-    } catch (StatusRuntimeException e) {
-      logError("search by ids RPC failed:\n{}", e.getStatus().toString());
-      SearchResponse searchResponse = new SearchResponse();
-      searchResponse.setResponse(new Response(Response.Status.RPC_ERROR, e.toString()));
-      return searchResponse;
-    }
-  }
-
   @Override
   public ListenableFuture<SearchResponse> searchAsync(@Nonnull SearchParam searchParam) {
 
@@ -749,76 +689,11 @@ public class MilvusGrpcClient implements MilvusClient {
   }
 
   @Override
-  public SearchResponse searchInFiles(
-      @Nonnull List<String> fileIds, @Nonnull SearchParam searchParam) {
+  public GetCollectionInfoResponse getCollectionInfo(@Nonnull String collectionName) {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      SearchResponse searchResponse = new SearchResponse();
-      searchResponse.setResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED));
-      return searchResponse;
-    }
-
-    List<RowRecord> rowRecordList =
-        buildRowRecordList(searchParam.getFloatVectors(), searchParam.getBinaryVectors());
-
-    KeyValuePair extraParam =
-        KeyValuePair.newBuilder()
-            .setKey(extraParamKey)
-            .setValue(searchParam.getParamsInJson())
-            .build();
-
-    io.milvus.grpc.SearchParam constructSearchParam =
-        io.milvus.grpc.SearchParam.newBuilder()
-            .setCollectionName(searchParam.getCollectionName())
-            .addAllQueryRecordArray(rowRecordList)
-            .addAllPartitionTagArray(searchParam.getPartitionTags())
-            .setTopk(searchParam.getTopK())
-            .addExtraParams(extraParam)
-            .build();
-
-    SearchInFilesParam request =
-        SearchInFilesParam.newBuilder()
-            .addAllFileIdArray(fileIds)
-            .setSearchParam(constructSearchParam)
-            .build();
-
-    TopKQueryResult response;
-
-    try {
-      response = blockingStub.searchInFiles(request);
-
-      if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
-        SearchResponse searchResponse = buildSearchResponse(response);
-        searchResponse.setResponse(new Response(Response.Status.SUCCESS));
-        logInfo(
-            "Search in files completed successfully! Returned results for {} queries",
-            searchResponse.getNumQueries());
-        return searchResponse;
-      } else {
-        logError("Search in files failed: {}", response.getStatus().toString());
-
-        SearchResponse searchResponse = new SearchResponse();
-        searchResponse.setResponse(
-            new Response(
-                Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
-                response.getStatus().getReason()));
-        return searchResponse;
-      }
-    } catch (StatusRuntimeException e) {
-      logError("searchInFiles RPC failed:\n{}", e.getStatus().toString());
-      SearchResponse searchResponse = new SearchResponse();
-      searchResponse.setResponse(new Response(Response.Status.RPC_ERROR, e.toString()));
-      return searchResponse;
-    }
-  }
-
-  @Override
-  public DescribeCollectionResponse describeCollection(@Nonnull String collectionName) {
-
-    if (!channelIsReadyOrIdle()) {
-      logWarning("You are not connected to Milvus server");
-      return new DescribeCollectionResponse(
+      return new GetCollectionInfoResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
     }
 
@@ -834,32 +709,32 @@ public class MilvusGrpcClient implements MilvusClient {
                 .withIndexFileSize(response.getIndexFileSize())
                 .withMetricType(MetricType.valueOf(response.getMetricType()))
                 .build();
-        logInfo("Describe Collection `{}` returned:\n{}", collectionName, collectionMapping);
-        return new DescribeCollectionResponse(
+        logInfo("Get Collection Info `{}` returned:\n{}", collectionName, collectionMapping);
+        return new GetCollectionInfoResponse(
             new Response(Response.Status.SUCCESS), collectionMapping);
       } else {
         logError(
-            "Describe Collection `{}` failed:\n{}",
+            "Get Collection Info `{}` failed:\n{}",
             collectionName, response.getStatus().toString());
-        return new DescribeCollectionResponse(
+        return new GetCollectionInfoResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             null);
       }
     } catch (StatusRuntimeException e) {
-      logError("describeCollection RPC failed:\n{}", e.getStatus().toString());
-      return new DescribeCollectionResponse(
+      logError("getCollectionInfo RPC failed:\n{}", e.getStatus().toString());
+      return new GetCollectionInfoResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), null);
     }
   }
 
   @Override
-  public ShowCollectionsResponse showCollections() {
+  public ListCollectionsResponse listCollections() {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new ShowCollectionsResponse(
+      return new ListCollectionsResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
@@ -872,28 +747,28 @@ public class MilvusGrpcClient implements MilvusClient {
       if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
         List<String> collectionNames = response.getCollectionNamesList();
         logInfo("Current collections: {}", collectionNames.toString());
-        return new ShowCollectionsResponse(new Response(Response.Status.SUCCESS), collectionNames);
+        return new ListCollectionsResponse(new Response(Response.Status.SUCCESS), collectionNames);
       } else {
-        logError("Show collections failed:\n{}", response.getStatus().toString());
-        return new ShowCollectionsResponse(
+        logError("List collections failed:\n{}", response.getStatus().toString());
+        return new ListCollectionsResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             new ArrayList<>());
       }
     } catch (StatusRuntimeException e) {
-      logError("showCollections RPC failed:\n{}", e.getStatus().toString());
-      return new ShowCollectionsResponse(
+      logError("listCollections RPC failed:\n{}", e.getStatus().toString());
+      return new ListCollectionsResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
     }
   }
 
   @Override
-  public GetCollectionRowCountResponse getCollectionRowCount(@Nonnull String collectionName) {
+  public CountEntitiesResponse countEntities(@Nonnull String collectionName) {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new GetCollectionRowCountResponse(
+      return new CountEntitiesResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), 0);
     }
 
@@ -905,22 +780,22 @@ public class MilvusGrpcClient implements MilvusClient {
 
       if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
         long collectionRowCount = response.getCollectionRowCount();
-        logInfo("Collection `{}` has {} rows", collectionName, collectionRowCount);
-        return new GetCollectionRowCountResponse(
+        logInfo("Collection `{}` has {} entities", collectionName, collectionRowCount);
+        return new CountEntitiesResponse(
             new Response(Response.Status.SUCCESS), collectionRowCount);
       } else {
         logError(
-            "Get collection `{}` row count failed:\n{}",
+            "Get collection `{}` entity count failed:\n{}",
             collectionName, response.getStatus().toString());
-        return new GetCollectionRowCountResponse(
+        return new CountEntitiesResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             0);
       }
     } catch (StatusRuntimeException e) {
-      logError("countCollection RPC failed:\n{}", e.getStatus().toString());
-      return new GetCollectionRowCountResponse(
+      logError("countEntities RPC failed:\n{}", e.getStatus().toString());
+      return new CountEntitiesResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), 0);
     }
   }
@@ -964,7 +839,7 @@ public class MilvusGrpcClient implements MilvusClient {
   }
 
   @Override
-  public Response preloadCollection(@Nonnull String collectionName) {
+  public Response loadCollection(@Nonnull String collectionName) {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
@@ -978,25 +853,25 @@ public class MilvusGrpcClient implements MilvusClient {
       response = blockingStub.preloadCollection(request);
 
       if (response.getErrorCode() == ErrorCode.SUCCESS) {
-        logInfo("Preloaded collection `{}` successfully!", collectionName);
+        logInfo("Loaded collection `{}` successfully!", collectionName);
         return new Response(Response.Status.SUCCESS);
       } else {
-        logError("Preload collection `{}` failed:\n{}", collectionName, response.toString());
+        logError("Load collection `{}` failed:\n{}", collectionName, response.toString());
         return new Response(
             Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
       }
     } catch (StatusRuntimeException e) {
-      logError("preloadCollection RPC failed:\n{}", e.getStatus().toString());
+      logError("loadCollection RPC failed:\n{}", e.getStatus().toString());
       return new Response(Response.Status.RPC_ERROR, e.toString());
     }
   }
 
   @Override
-  public DescribeIndexResponse describeIndex(@Nonnull String collectionName) {
+  public GetIndexInfoResponse getIndexInfo(@Nonnull String collectionName) {
 
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new DescribeIndexResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
+      return new GetIndexInfoResponse(new Response(Response.Status.CLIENT_NOT_CONNECTED), null);
     }
 
     CollectionName request = CollectionName.newBuilder().setCollectionName(collectionName).build();
@@ -1017,21 +892,21 @@ public class MilvusGrpcClient implements MilvusClient {
                 .withParamsInJson(extraParam)
                 .build();
         logInfo(
-            "Describe index for collection `{}` returned:\n{}", collectionName, index.toString());
-        return new DescribeIndexResponse(new Response(Response.Status.SUCCESS), index);
+            "Get index info for collection `{}` returned:\n{}", collectionName, index.toString());
+        return new GetIndexInfoResponse(new Response(Response.Status.SUCCESS), index);
       } else {
         logError(
-            "Describe index for collection `{}` failed:\n{}",
+            "Get index info for collection `{}` failed:\n{}",
             collectionName, response.getStatus().toString());
-        return new DescribeIndexResponse(
+        return new GetIndexInfoResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             null);
       }
     } catch (StatusRuntimeException e) {
-      logError("describeIndex RPC failed:\n{}", e.getStatus().toString());
-      return new DescribeIndexResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
+      logError("getIndexInfo RPC failed:\n{}", e.getStatus().toString());
+      return new GetIndexInfoResponse(new Response(Response.Status.RPC_ERROR, e.toString()), null);
     }
   }
 
@@ -1065,7 +940,7 @@ public class MilvusGrpcClient implements MilvusClient {
   }
 
   @Override
-  public Response showCollectionInfo(String collectionName) {
+  public Response getCollectionStats(String collectionName) {
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
@@ -1078,27 +953,27 @@ public class MilvusGrpcClient implements MilvusClient {
       response = blockingStub.showCollectionInfo(request);
 
       if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
-        logInfo("ShowCollectionInfo for `{}` returned successfully!", collectionName);
+        logInfo("getCollectionStats for `{}` returned successfully!", collectionName);
         return new Response(Response.Status.SUCCESS, response.getJsonInfo());
       } else {
         logError(
-            "ShowCollectionInfo for `{}` failed:\n{}",
+            "getCollectionStats for `{}` failed:\n{}",
             collectionName, response.getStatus().toString());
         return new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason());
       }
     } catch (StatusRuntimeException e) {
-      logError("showCollectionInfo RPC failed:\n{}", e.getStatus().toString());
+      logError("getCollectionStats RPC failed:\n{}", e.getStatus().toString());
       return new Response(Response.Status.RPC_ERROR, e.toString());
     }
   }
 
   @Override
-  public GetVectorsByIdsResponse getVectorsByIds(String collectionName, List<Long> ids) {
+  public GetEntityByIDResponse getEntityByID(String collectionName, List<Long> ids) {
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new GetVectorsByIdsResponse(
+      return new GetEntityByIDResponse(
               new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>(), null);
     }
 
@@ -1112,7 +987,7 @@ public class MilvusGrpcClient implements MilvusClient {
       if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
 
         logInfo(
-            "getVectorsByIds in collection `{}` returned successfully!", collectionName);
+            "getEntityByID in collection `{}` returned successfully!", collectionName);
 
         List<List<Float>> floatVectors = new ArrayList<>();
         List<ByteBuffer> binaryVectors = new ArrayList<>();
@@ -1120,14 +995,14 @@ public class MilvusGrpcClient implements MilvusClient {
           floatVectors.add(response.getVectorsData(i).getFloatDataList());
           binaryVectors.add(response.getVectorsData(i).getBinaryData().asReadOnlyByteBuffer());
         }
-        return new GetVectorsByIdsResponse(
+        return new GetEntityByIDResponse(
                 new Response(Response.Status.SUCCESS), floatVectors, binaryVectors);
 
       } else {
         logError(
-            "getVectorsByIds in collection `{}` failed:\n{}",
+            "getEntityByID in collection `{}` failed:\n{}",
             collectionName, response.getStatus().toString());
-        return new GetVectorsByIdsResponse(
+        return new GetEntityByIDResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
@@ -1135,17 +1010,17 @@ public class MilvusGrpcClient implements MilvusClient {
             null);
       }
     } catch (StatusRuntimeException e) {
-      logError("getVectorsByIds RPC failed:\n{}", e.getStatus().toString());
-      return new GetVectorsByIdsResponse(
+      logError("getEntityByID RPC failed:\n{}", e.getStatus().toString());
+      return new GetEntityByIDResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>(), null);
     }
   }
 
   @Override
-  public GetVectorIdsResponse getVectorIds(String collectionName, String segmentName) {
+  public ListIDInSegmentResponse listIDInSegment(String collectionName, String segmentName) {
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
-      return new GetVectorIdsResponse(
+      return new ListIDInSegmentResponse(
           new Response(Response.Status.CLIENT_NOT_CONNECTED), new ArrayList<>());
     }
 
@@ -1162,29 +1037,29 @@ public class MilvusGrpcClient implements MilvusClient {
       if (response.getStatus().getErrorCode() == ErrorCode.SUCCESS) {
 
         logInfo(
-            "getVectorIds in collection `{}`, segment `{}` returned successfully!",
+            "listIDInSegment in collection `{}`, segment `{}` returned successfully!",
             collectionName, segmentName);
-        return new GetVectorIdsResponse(
+        return new ListIDInSegmentResponse(
             new Response(Response.Status.SUCCESS), response.getVectorIdArrayList());
       } else {
         logError(
-            "getVectorIds in collection `{}`, segment `{}` failed:\n{}",
+            "listIDInSegment in collection `{}`, segment `{}` failed:\n{}",
             collectionName, segmentName, response.getStatus().toString());
-        return new GetVectorIdsResponse(
+        return new ListIDInSegmentResponse(
             new Response(
                 Response.Status.valueOf(response.getStatus().getErrorCodeValue()),
                 response.getStatus().getReason()),
             new ArrayList<>());
       }
     } catch (StatusRuntimeException e) {
-      logError("getVectorIds RPC failed:\n{}", e.getStatus().toString());
-      return new GetVectorIdsResponse(
+      logError("listIDInSegment RPC failed:\n{}", e.getStatus().toString());
+      return new ListIDInSegmentResponse(
           new Response(Response.Status.RPC_ERROR, e.toString()), new ArrayList<>());
     }
   }
 
   @Override
-  public Response deleteByIds(String collectionName, List<Long> ids) {
+  public Response deleteEntityByID(String collectionName, List<Long> ids) {
     if (!channelIsReadyOrIdle()) {
       logWarning("You are not connected to Milvus server");
       return new Response(Response.Status.CLIENT_NOT_CONNECTED);
@@ -1198,31 +1073,20 @@ public class MilvusGrpcClient implements MilvusClient {
       response = blockingStub.deleteByID(request);
 
       if (response.getErrorCode() == ErrorCode.SUCCESS) {
-        logInfo("deleteByIds in collection `{}` completed successfully!", collectionName);
+        logInfo("deleteEntityByID in collection `{}` completed successfully!", collectionName);
         return new Response(Response.Status.SUCCESS);
       } else {
         logError(
-            "deleteByIds in collection `{}` failed:\n{}", collectionName, response.toString());
+            "deleteEntityByID in collection `{}` failed:\n{}", collectionName, response.toString());
         return new Response(
             Response.Status.valueOf(response.getErrorCodeValue()), response.getReason());
       }
     } catch (StatusRuntimeException e) {
-      logError("deleteByIds RPC failed:\n{}", e.getStatus().toString());
+      logError("deleteEntityByID RPC failed:\n{}", e.getStatus().toString());
       return new Response(Response.Status.RPC_ERROR, e.toString());
     }
   }
 
-  @Override
-  public Response deleteById(String collectionName, Long id) {
-    List<Long> list =
-        new ArrayList<Long>() {
-          {
-            add(id);
-          }
-        };
-    return deleteByIds(collectionName, list);
-  }
-
   @Override
   public Response flush(List<String> collectionNames) {
     if (!channelIsReadyOrIdle()) {

+ 0 - 145
src/main/java/io/milvus/client/SearchByIdsParam.java

@@ -1,145 +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;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Contains parameters for <code>searchByIds</code> */
-public class SearchByIdsParam {
-
-    private final String collectionName;
-    private final List<String> partitionTags;
-    private final List<Long> ids;
-    private final long topK;
-    private final String paramsInJson;
-
-    private SearchByIdsParam(@Nonnull Builder builder) {
-        this.collectionName = builder.collectionName;
-        this.partitionTags = builder.partitionTags;
-        this.ids = builder.ids;
-        this.topK = builder.topK;
-        this.paramsInJson = builder.paramsInJson;
-    }
-
-    public String getCollectionName() {
-        return collectionName;
-    }
-
-    public List<String> getPartitionTags() {
-        return partitionTags;
-    }
-
-    public List<Long> getIds() {
-        return ids;
-    }
-
-    public long getTopK() {
-        return topK;
-    }
-
-    public String getParamsInJson() {
-        return paramsInJson;
-    }
-
-    /** Builder for <code>SearchByIdsParam</code> */
-    public static class Builder {
-        // Required parameters
-        private final String collectionName;
-
-        // Optional parameters - initialized to default values
-        private List<String> partitionTags = new ArrayList<>();
-        private List<Long> ids = new ArrayList<>();
-        private long topK = 1024;
-        private String paramsInJson;
-
-        /** @param collectionName collection to search from */
-        public Builder(@Nonnull String collectionName) {
-            this.collectionName = collectionName;
-        }
-
-        /**
-         * Search vectors IDs. Default to an empty <code>List</code>
-         *
-         * @param ids IDs of vectors
-         * @return <code>Builder</code>
-         */
-        public Builder withIDs(@Nonnull List<Long> ids) {
-            this.ids = ids;
-            return this;
-        }
-
-        /**
-         * Optional. Search vectors with corresponding <code>partitionTags</code>. Default to an empty
-         * <code>List</code>
-         *
-         * @param partitionTags a <code>List</code> of partition tags
-         * @return <code>Builder</code>
-         */
-        public Builder withPartitionTags(@Nonnull List<String> partitionTags) {
-            this.partitionTags = partitionTags;
-            return this;
-        }
-
-        /**
-         * Optional. Limits search result to <code>topK</code>. Default to 1024.
-         *
-         * @param topK a topK number
-         * @return <code>Builder</code>
-         */
-        public Builder withTopK(long topK) {
-            this.topK = topK;
-            return this;
-        }
-
-        /**
-         * Optional. Default to empty <code>String</code>. Search parameters are different for different
-         * index types. Refer to <a
-         * href="https://milvus.io/docs/v0.8.0/guides/milvus_operation.md">https://milvus.io/docs/v0.8.0/guides/milvus_operation.md</a>
-         * for more information.
-         *
-         * <pre>
-         *   FLAT/IVFLAT/SQ8/IVFPQ: {"nprobe": 32}
-         *   nprobe range:[1,999999]
-         *
-         *   NSG: {"search_length": 100}
-         *   search_length range:[10, 300]
-         *
-         *   HNSW: {"ef": 64}
-         *   ef range:[topk, 4096]
-         *
-         *   ANNOY: {search_k", 0.05 * totalDataCount}
-         *   search_k range: none
-         * </pre>
-         *
-         * @param paramsInJson extra parameters in JSON format
-         * @return <code>Builder</code>
-         */
-        public SearchByIdsParam.Builder withParamsInJson(@Nonnull String paramsInJson) {
-            this.paramsInJson = paramsInJson;
-            return this;
-        }
-
-        public SearchByIdsParam build() {
-            return new SearchByIdsParam(this);
-        }
-    }
-}

+ 0 - 36
src/main/java/io/milvus/client/ShowCollectionInfoResponse.java

@@ -1,36 +0,0 @@
-package io.milvus.client;
-
-import java.util.Optional;
-
-/**
- * Contains the returned <code>response</code> and <code>collectionInfo</code> for <code>
- * showCollectionInfo</code>
- */
-public class ShowCollectionInfoResponse {
-
-  private final Response response;
-  private final CollectionInfo collectionInfo;
-
-  ShowCollectionInfoResponse(Response response, CollectionInfo collectionInfo) {
-    this.response = response;
-    this.collectionInfo = collectionInfo;
-  }
-
-  public Response getResponse() {
-    return response;
-  }
-
-  /**
-   * @return an <code>Optional</code> object which may or may not contain an <code>CollectionInfo
-   *     </code> object
-   * @see Optional
-   */
-  public Optional<CollectionInfo> getCollectionInfo() {
-    return Optional.ofNullable(collectionInfo);
-  }
-
-  /** @return <code>true</code> if the response status equals SUCCESS */
-  public boolean ok() {
-    return response.ok();
-  }
-}

+ 70 - 130
src/test/java/io/milvus/client/MilvusGrpcClientTest.java

@@ -119,7 +119,7 @@ class MilvusClientTest {
     // Channel should be idle
     assertFalse(client.isConnected());
     // A new RPC would take the channel out of idle mode
-    assertTrue(client.showCollections().ok());
+    assertTrue(client.listCollections().ok());
   }
 
   @org.junit.jupiter.api.Test
@@ -202,9 +202,9 @@ class MilvusClientTest {
     createPartitionResponse = client.createPartition(randomCollectionName, tag2);
     assertTrue(createPartitionResponse.ok());
 
-    ShowPartitionsResponse showPartitionsResponse = client.showPartitions(randomCollectionName);
-    assertTrue(showPartitionsResponse.ok());
-    assertEquals(3, showPartitionsResponse.getPartitionList().size()); // two tags plus _default
+    ListPartitionsResponse listPartitionsResponse = client.listPartitions(randomCollectionName);
+    assertTrue(listPartitionsResponse.ok());
+    assertEquals(3, listPartitionsResponse.getPartitionList().size()); // two tags plus _default
 
     List<List<Float>> vectors1 = generateFloatVectors(size, dimension);
     List<Long> vectorIds1 = LongStream.range(0, size).boxed().collect(Collectors.toList());
@@ -230,7 +230,7 @@ class MilvusClientTest {
     assertTrue(client.flush(randomCollectionName).ok());
 
     assertEquals(
-        size * 2, client.getCollectionRowCount(randomCollectionName).getCollectionRowCount());
+        size * 2, client.countEntities(randomCollectionName).getCollectionEntityCount());
 
     final int searchSize = 1;
     final long topK = 10;
@@ -397,45 +397,6 @@ class MilvusClientTest {
     }
   }
 
-  @org.junit.jupiter.api.Test
-  void searchByIds() {
-    List<List<Float>> vectors = generateFloatVectors(size, dimension);
-    vectors = vectors.stream().map(MilvusClientTest::normalizeVector).collect(Collectors.toList());
-    InsertParam insertParam =
-            new InsertParam.Builder(randomCollectionName).withFloatVectors(vectors).build();
-    InsertResponse insertResponse = client.insert(insertParam);
-    assertTrue(insertResponse.ok());
-    List<Long> vectorIds = insertResponse.getVectorIds();
-    assertEquals(size, vectorIds.size());
-
-    assertTrue(client.flush(randomCollectionName).ok());
-
-    final long topK = 10;
-    final int queryLength = 5;
-    SearchByIdsParam searchByIdsParam =
-            new SearchByIdsParam.Builder(randomCollectionName)
-                    .withIDs(vectorIds.subList(0, queryLength))
-                    .withTopK(topK)
-                    .withParamsInJson("{\"nprobe\": 20}")
-                    .build();
-    SearchResponse searchResponse = client.searchByIds(searchByIdsParam);
-    assertTrue(searchResponse.ok());
-    List<List<Long>> resultIdsList = searchResponse.getResultIdsList();
-    assertEquals(queryLength, resultIdsList.size());
-    List<List<Float>> resultDistancesList = searchResponse.getResultDistancesList();
-    assertEquals(queryLength, resultDistancesList.size());
-    List<List<SearchResponse.QueryResult>> queryResultsList = searchResponse.getQueryResultsList();
-    assertEquals(queryLength, queryResultsList.size());
-    final double epsilon = 0.001;
-    for (int i = 0; i < queryLength; i++) {
-      SearchResponse.QueryResult firstQueryResult = queryResultsList.get(i).get(0);
-      assertEquals(vectorIds.get(i), firstQueryResult.getVectorId());
-      assertEquals(vectorIds.get(i), resultIdsList.get(i).get(0));
-      assertTrue(Math.abs(1 - firstQueryResult.getDistance()) < epsilon);
-      assertTrue(Math.abs(1 - resultDistancesList.get(i).get(0)) < epsilon);
-    }
-  }
-
   @org.junit.jupiter.api.Test
   void searchAsync() throws ExecutionException, InterruptedException {
     List<List<Float>> vectors = generateFloatVectors(size, dimension);
@@ -529,31 +490,27 @@ class MilvusClientTest {
     assertTrue(client.dropCollection(binaryCollectionName).ok());
   }
 
-  //    @org.junit.jupiter.api.Test
-  //    void searchInFiles() {
-  //    }
-
   @org.junit.jupiter.api.Test
-  void describeCollection() {
-    DescribeCollectionResponse describeCollectionResponse =
-        client.describeCollection(randomCollectionName);
-    assertTrue(describeCollectionResponse.ok());
-    assertTrue(describeCollectionResponse.getCollectionMapping().isPresent());
+  void getCollectionInfo() {
+    GetCollectionInfoResponse getCollectionInfoResponse =
+        client.getCollectionInfo(randomCollectionName);
+    assertTrue(getCollectionInfoResponse.ok());
+    assertTrue(getCollectionInfoResponse.getCollectionMapping().isPresent());
     assertEquals(
-        describeCollectionResponse.getCollectionMapping().get().getCollectionName(),
+        getCollectionInfoResponse.getCollectionMapping().get().getCollectionName(),
         randomCollectionName);
 
     String nonExistingCollectionName = generator.generate(10);
-    describeCollectionResponse = client.describeCollection(nonExistingCollectionName);
-    assertFalse(describeCollectionResponse.ok());
-    assertFalse(describeCollectionResponse.getCollectionMapping().isPresent());
+    getCollectionInfoResponse = client.getCollectionInfo(nonExistingCollectionName);
+    assertFalse(getCollectionInfoResponse.ok());
+    assertFalse(getCollectionInfoResponse.getCollectionMapping().isPresent());
   }
 
   @org.junit.jupiter.api.Test
-  void showCollections() {
-    ShowCollectionsResponse showCollectionsResponse = client.showCollections();
-    assertTrue(showCollectionsResponse.ok());
-    assertTrue(showCollectionsResponse.getCollectionNames().contains(randomCollectionName));
+  void listCollections() {
+    ListCollectionsResponse listCollectionsResponse = client.listCollections();
+    assertTrue(listCollectionsResponse.ok());
+    assertTrue(listCollectionsResponse.getCollectionNames().contains(randomCollectionName));
   }
 
   @org.junit.jupiter.api.Test
@@ -569,34 +526,34 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  void getCollectionRowCount() {
+  void countEntities() {
     insert();
     assertTrue(client.flush(randomCollectionName).ok());
 
-    GetCollectionRowCountResponse getCollectionRowCountResponse =
-        client.getCollectionRowCount(randomCollectionName);
-    assertTrue(getCollectionRowCountResponse.ok());
-    assertEquals(size, getCollectionRowCountResponse.getCollectionRowCount());
+    CountEntitiesResponse countEntitiesResponse =
+        client.countEntities(randomCollectionName);
+    assertTrue(countEntitiesResponse.ok());
+    assertEquals(size, countEntitiesResponse.getCollectionEntityCount());
   }
 
   @org.junit.jupiter.api.Test
-  void preloadCollection() {
+  void loadCollection() {
     insert();
     assertTrue(client.flush(randomCollectionName).ok());
 
-    Response preloadCollectionResponse = client.preloadCollection(randomCollectionName);
-    assertTrue(preloadCollectionResponse.ok());
+    Response loadCollectionResponse = client.loadCollection(randomCollectionName);
+    assertTrue(loadCollectionResponse.ok());
   }
 
   @org.junit.jupiter.api.Test
-  void describeIndex() {
+  void getIndexInfo() {
     createIndex();
 
-    DescribeIndexResponse describeIndexResponse = client.describeIndex(randomCollectionName);
-    assertTrue(describeIndexResponse.ok());
-    assertTrue(describeIndexResponse.getIndex().isPresent());
-    assertEquals(describeIndexResponse.getIndex().get().getCollectionName(), randomCollectionName);
-    assertEquals(describeIndexResponse.getIndex().get().getIndexType(), IndexType.IVF_SQ8);
+    GetIndexInfoResponse getIndexInfoResponse = client.getIndexInfo(randomCollectionName);
+    assertTrue(getIndexInfoResponse.ok());
+    assertTrue(getIndexInfoResponse.getIndex().isPresent());
+    assertEquals(getIndexInfoResponse.getIndex().get().getCollectionName(), randomCollectionName);
+    assertEquals(getIndexInfoResponse.getIndex().get().getIndexType(), IndexType.IVF_SQ8);
   }
 
   @org.junit.jupiter.api.Test
@@ -606,16 +563,16 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  void showCollectionInfo() {
+  void getCollectionStats() {
     insert();
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    Response showCollectionInfoResponse =
-        client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
+    Response getCollectionStatsResponse =
+        client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
 
-    String jsonString = showCollectionInfoResponse.getMessage();
+    String jsonString = getCollectionStatsResponse.getMessage();
     JSONObject jsonInfo = new JSONObject(jsonString);
     assertTrue(jsonInfo.getInt("row_count") == size);
 
@@ -631,7 +588,7 @@ class MilvusClientTest {
   }
 
   @org.junit.jupiter.api.Test
-  void getVectorsByIds() {
+  void getEntityByID() {
     List<List<Float>> vectors = generateFloatVectors(size, dimension);
     InsertParam insertParam =
         new InsertParam.Builder(randomCollectionName).withFloatVectors(vectors).build();
@@ -642,13 +599,13 @@ class MilvusClientTest {
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    GetVectorsByIdsResponse getVectorsByIdsResponse =
-        client.getVectorsByIds(randomCollectionName, vectorIds.subList(0, 100));
-    assertTrue(getVectorsByIdsResponse.ok());
-    ByteBuffer bb = getVectorsByIdsResponse.getBinaryVectors().get(0);
+    GetEntityByIDResponse getEntityByIDResponse =
+        client.getEntityByID(randomCollectionName, vectorIds.subList(0, 100));
+    assertTrue(getEntityByIDResponse.ok());
+    ByteBuffer bb = getEntityByIDResponse.getBinaryVectors().get(0);
     assertTrue(bb == null || bb.remaining() == 0);
 
-    assertArrayEquals(getVectorsByIdsResponse.getFloatVectors().get(0).toArray(), vectors.get(0).toArray());
+    assertArrayEquals(getEntityByIDResponse.getFloatVectors().get(0).toArray(), vectors.get(0).toArray());
   }
 
   @org.junit.jupiter.api.Test
@@ -657,25 +614,25 @@ class MilvusClientTest {
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    Response showCollectionInfoResponse =
-        client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
+    Response getCollectionStatsResponse =
+        client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
 
-    JSONObject jsonInfo = new JSONObject(showCollectionInfoResponse.getMessage());
+    JSONObject jsonInfo = new JSONObject(getCollectionStatsResponse.getMessage());
     JSONObject segmentInfo = jsonInfo
                                  .getJSONArray("partitions")
                                  .getJSONObject(0)
                                  .getJSONArray("segments")
                                  .getJSONObject(0);
 
-    GetVectorIdsResponse getVectorIdsResponse =
-        client.getVectorIds(randomCollectionName,segmentInfo.getString("name"));
-    assertTrue(getVectorIdsResponse.ok());
-    assertFalse(getVectorIdsResponse.getIds().isEmpty());
+    ListIDInSegmentResponse listIDInSegmentResponse =
+        client.listIDInSegment(randomCollectionName,segmentInfo.getString("name"));
+    assertTrue(listIDInSegmentResponse.ok());
+    assertFalse(listIDInSegmentResponse.getIds().isEmpty());
   }
 
   @org.junit.jupiter.api.Test
-  void deleteByIds() {
+  void deleteEntityByID() {
     List<List<Float>> vectors = generateFloatVectors(size, dimension);
     InsertParam insertParam =
         new InsertParam.Builder(randomCollectionName).withFloatVectors(vectors).build();
@@ -686,27 +643,10 @@ class MilvusClientTest {
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    assertTrue(client.deleteByIds(randomCollectionName, vectorIds.subList(0, 100)).ok());
+    assertTrue(client.deleteEntityByID(randomCollectionName, vectorIds.subList(0, 100)).ok());
     assertTrue(client.flush(randomCollectionName).ok());
     assertEquals(
-        client.getCollectionRowCount(randomCollectionName).getCollectionRowCount(), size - 100);
-  }
-
-  @org.junit.jupiter.api.Test
-  void deleteById() {
-    List<List<Float>> vectors = generateFloatVectors(1, dimension);
-    InsertParam insertParam =
-        new InsertParam.Builder(randomCollectionName).withFloatVectors(vectors).build();
-    InsertResponse insertResponse = client.insert(insertParam);
-    assertTrue(insertResponse.ok());
-    List<Long> vectorIds = insertResponse.getVectorIds();
-    assertEquals(vectorIds.size(), 1);
-
-    assertTrue(client.flush(randomCollectionName).ok());
-
-    assertTrue(client.deleteById(randomCollectionName, vectorIds.get(0)).ok());
-    assertTrue(client.flush(randomCollectionName).ok());
-    assertEquals(client.getCollectionRowCount(randomCollectionName).getCollectionRowCount(), 0);
+        client.countEntities(randomCollectionName).getCollectionEntityCount(), size - 100);
   }
 
   @org.junit.jupiter.api.Test
@@ -731,11 +671,11 @@ class MilvusClientTest {
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    Response showCollectionInfoResponse =
-        client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
+    Response getCollectionStatsResponse =
+        client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
 
-    JSONObject jsonInfo = new JSONObject(showCollectionInfoResponse.getMessage());
+    JSONObject jsonInfo = new JSONObject(getCollectionStatsResponse.getMessage());
     JSONObject segmentInfo = jsonInfo
             .getJSONArray("partitions")
             .getJSONObject(0)
@@ -744,13 +684,13 @@ class MilvusClientTest {
 
     long previousSegmentSize = segmentInfo.getLong("data_size");
 
-    assertTrue(client.deleteByIds(randomCollectionName, vectorIds.subList(0, (int) size / 2)).ok());
+    assertTrue(client.deleteEntityByID(randomCollectionName, vectorIds.subList(0, (int) size / 2)).ok());
     assertTrue(client.flush(randomCollectionName).ok());
     assertTrue(client.compact(randomCollectionName).ok());
 
-    showCollectionInfoResponse = client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
-    jsonInfo = new JSONObject(showCollectionInfoResponse.getMessage());
+    getCollectionStatsResponse = client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
+    jsonInfo = new JSONObject(getCollectionStatsResponse.getMessage());
     segmentInfo = jsonInfo
             .getJSONArray("partitions")
             .getJSONObject(0)
@@ -773,11 +713,11 @@ class MilvusClientTest {
 
     assertTrue(client.flush(randomCollectionName).ok());
 
-    Response showCollectionInfoResponse =
-            client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
+    Response getCollectionStatsResponse =
+            client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
 
-    JSONObject jsonInfo = new JSONObject(showCollectionInfoResponse.getMessage());
+    JSONObject jsonInfo = new JSONObject(getCollectionStatsResponse.getMessage());
     JSONObject segmentInfo = jsonInfo
             .getJSONArray("partitions")
             .getJSONObject(0)
@@ -786,13 +726,13 @@ class MilvusClientTest {
 
     long previousSegmentSize = segmentInfo.getLong("data_size");
 
-    assertTrue(client.deleteByIds(randomCollectionName, vectorIds.subList(0, (int) size / 2)).ok());
+    assertTrue(client.deleteEntityByID(randomCollectionName, vectorIds.subList(0, (int) size / 2)).ok());
     assertTrue(client.flush(randomCollectionName).ok());
     assertTrue(client.compactAsync(randomCollectionName).get().ok());
 
-    showCollectionInfoResponse = client.showCollectionInfo(randomCollectionName);
-    assertTrue(showCollectionInfoResponse.ok());
-    jsonInfo = new JSONObject(showCollectionInfoResponse.getMessage());
+    getCollectionStatsResponse = client.getCollectionStats(randomCollectionName);
+    assertTrue(getCollectionStatsResponse.ok());
+    jsonInfo = new JSONObject(getCollectionStatsResponse.getMessage());
     segmentInfo = jsonInfo
             .getJSONArray("partitions")
             .getJSONObject(0)