Interface MilvusClient

  • All Known Implementing Classes:
    MilvusGrpcClient

    public interface MilvusClient
    The Milvus Client Interface
    • Method Detail

      • getClientVersion

        default String getClientVersion()
        Returns:
        the current Milvus client version
      • connect

        Response connect​(ConnectParam connectParam)
                  throws ConnectFailedException
        Connects to Milvus server
        Parameters:
        connectParam - the ConnectParam object
         example usage:
         
         ConnectParam connectParam = new ConnectParam.Builder()
                                                     .withHost("localhost")
                                                     .withPort("19530")
                                                     .withConnectTimeout(10, TimeUnit.SECONDS)
                                                     .withKeepAliveTime(Long.MAX_VALUE, TimeUnit.NANOSECONDS)
                                                     .withKeepAliveTimeout(20, TimeUnit.SECONDS)
                                                     .keepAliveWithoutCalls(false)
                                                     .withIdleTimeout(24, TimeUnit.HOURS)
                                                     .build();
         
         
        Returns:
        Response
        Throws:
        ConnectFailedException - if client failed to connect
        See Also:
        ConnectParam, Response, ConnectFailedException
      • isConnected

        boolean isConnected()
        Returns:
        true if the client is connected to Milvus server. The channel's connectivity state is READY.
      • createTable

        Response createTable​(TableSchema tableSchema)
        Creates table specified by tableSchemaParam
        Parameters:
        tableSchema - the TableSchema object
         example usage:
         
         TableSchema tableSchema = new TableSchema.Builder(tableName, dimension)
                                                  .withIndexFileSize(1024)
                                                  .withMetricType(MetricType.IP)
                                                  .build();
         
         
        Returns:
        Response
        See Also:
        TableSchema, MetricType, Response
      • dropTable

        Response dropTable​(String tableName)
        Drops table
        Parameters:
        tableName - table to drop
        Returns:
        Response
        See Also:
        Response
      • createIndex

        Response createIndex​(CreateIndexParam createIndexParam)
        Creates index specified by indexParam
        Parameters:
        createIndexParam - the CreateIndexParam object
         example usage:
         
         Index index = new Index.Builder()
                                .withIndexType(IndexType.IVF_SQ8)
                                .withNList(16384)
                                .build();
         CreateIndexParam createIndexParam = new CreateIndexParam.Builder(tableName)
                                                                 .withIndex(index)
                                                                 .build();
         
         
        Returns:
        Response
        See Also:
        Index, CreateIndexParam, IndexType, Response
      • insert

        InsertResponse insert​(InsertParam insertParam)
        Inserts data specified by insertParam
        Parameters:
        insertParam - the InsertParam object
         example usage:
         
         InsertParam insertParam = new InsertParam.Builder(tableName, vectors)
                                                  .withVectorIds(vectorIds)
                                                  .build();
         
         
        Returns:
        InsertResponse
        See Also:
        InsertParam, InsertResponse, Response
      • searchInFiles

        SearchResponse searchInFiles​(SearchInFilesParam searchInFilesParam)
        Searches vectors in specific files specified by searchInFilesParam
        Parameters:
        searchInFilesParam - the SearchInFilesParam object
         example usage:
         
         SearchParam searchParam = new SearchParam.Builder(tableName, vectorsToSearch)
                                                  .withTopK(topK)
                                                  .withNProbe(nProbe)
                                                  .withDateRanges(dateRanges)
                                                  .build();
         SearchInFilesParam searchInFilesParam = new SearchInFilesParam.Builder(fileIds, searchParam)
                                                                       .build();
         
         
        Returns:
        SearchResponse
        See Also:
        SearchInFilesParam, SearchParam, DateRange, SearchResponse, SearchResponse.QueryResult, Response
      • getServerStatus

        Response getServerStatus()
        Prints server status
        Returns:
        Response
        See Also:
        Response
      • getServerVersion

        Response getServerVersion()
        Prints server version
        Returns:
        Response
        See Also:
        Response
      • preloadTable

        Response preloadTable​(String tableName)
        Pre-loads table to memory
        Parameters:
        tableName - table to preload
        Returns:
        Response
        See Also:
        Response
      • dropIndex

        Response dropIndex​(String tableName)
        Drops table index
        Parameters:
        tableName - table to drop index of
        See Also:
        Response