Package io.milvus.client
Interface MilvusClient
-
- All Known Implementing Classes:
MilvusGrpcClient
public interface MilvusClientThe Milvus Client Interface
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringclientVersion
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidclose()Close this MilvusClient.voidclose(long maxWaitSeconds)Close this MilvusClient.Responsecommand(java.lang.String command)Sends a command to serverResponsecompact(java.lang.String collectionName)Compacts the collection, erasing deleted data from disk and rebuild index in background (if the data size after compaction is still larger than indexFileSize).com.google.common.util.concurrent.ListenableFuture<Response>compactAsync(java.lang.String collectionName)Compacts the collection asynchronously, erasing deleted data from disk and rebuild index in background (if the data size after compaction is still larger than indexFileSize).CountEntitiesResponsecountEntities(java.lang.String collectionName)Gets current entity count of a collectionResponsecreateCollection(CollectionMapping collectionMapping)Creates collection specified bycollectionMappingResponsecreateIndex(Index index)Creates index specified byindexcom.google.common.util.concurrent.ListenableFuture<Response>createIndexAsync(Index index)Creates index specified byindexasynchronouslyResponsecreatePartition(java.lang.String collectionName, java.lang.String tag)Creates a partition specified bycollectionNameandtagResponsedeleteEntityByID(java.lang.String collectionName, java.lang.String partitionTag, java.util.List<java.lang.Long> ids)Deletes data in a collection by a list of idsResponsedropCollection(java.lang.String collectionName)Drops collectionResponsedropIndex(java.lang.String collectionName)Drops collection indexResponsedropPartition(java.lang.String collectionName, java.lang.String tag)Drops partition specified bycollectionNameandtagResponseflush(java.lang.String collectionName)Flushes data in a collection.Responseflush(java.util.List<java.lang.String> collectionNames)Flushes data in a list collections.com.google.common.util.concurrent.ListenableFuture<Response>flushAsync(java.lang.String collectionName)Flushes data in a collection asynchronously.com.google.common.util.concurrent.ListenableFuture<Response>flushAsync(java.util.List<java.lang.String> collectionNames)Flushes data in a list collections asynchronously.default java.lang.StringgetClientVersion()GetCollectionInfoResponsegetCollectionInfo(java.lang.String collectionName)Gets collection infoResponsegetCollectionStats(java.lang.String collectionName)Shows collection information.GetEntityByIDResponsegetEntityByID(java.lang.String collectionName, java.lang.String partitionTag, java.util.List<java.lang.Long> ids)Gets vectors data by id arrayGetIndexInfoResponsegetIndexInfo(java.lang.String collectionName)Gets collection index informationResponsegetServerStatus()Get server statusResponsegetServerVersion()Get server versionHasCollectionResponsehasCollection(java.lang.String collectionName)Checks whether the collection existsHasPartitionResponsehasPartition(java.lang.String collectionName, java.lang.String tag)Checks whether the partition existsInsertResponseinsert(InsertParam insertParam)Inserts data specified byinsertParamcom.google.common.util.concurrent.ListenableFuture<InsertResponse>insertAsync(InsertParam insertParam)Inserts data specified byinsertParamasynchronouslyListCollectionsResponselistCollections()Lists current collectionsListIDInSegmentResponselistIDInSegment(java.lang.String collectionName, java.lang.String segmentName)Gets all vector ids in a segmentListPartitionsResponselistPartitions(java.lang.String collectionName)Lists current partitions of a collectionResponseloadCollection(java.lang.String collectionName)Pre-loads collection to memoryResponseloadCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)Pre-loads collection/partitions to memoryResponsereleaseCollection(java.lang.String collectionName)Release collection from memoryResponsereleaseCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)Release collection/partitions from memorySearchResponsesearch(SearchParam searchParam)Searches vectors specified bysearchParamcom.google.common.util.concurrent.ListenableFuture<SearchResponse>searchAsync(SearchParam searchParam)Searches vectors specified bysearchParamasynchronouslyMilvusClientwithTimeout(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
-
-
-
Method Detail
-
getClientVersion
default java.lang.String getClientVersion()
- Returns:
- current Milvus client version
-
close
default void close()
Close this MilvusClient. Wait at most 1 minute for graceful shutdown.
-
close
void close(long maxWaitSeconds)
Close this MilvusClient. Wait at most `maxWaitSeconds` for graceful shutdown.
-
withTimeout
MilvusClient withTimeout(long timeout, java.util.concurrent.TimeUnit timeoutUnit)
-
createCollection
Response createCollection(CollectionMapping collectionMapping)
Creates collection specified bycollectionMapping- Parameters:
collectionMapping- theCollectionMappingobjectexample usage:
CollectionMapping collectionMapping = new CollectionMapping.Builder(collectionName, dimension) .withIndexFileSize(1024) .withMetricType(MetricType.IP) .build();- Returns:
Response- See Also:
CollectionMapping,MetricType,Response
-
hasCollection
HasCollectionResponse hasCollection(java.lang.String collectionName)
Checks whether the collection exists- Parameters:
collectionName- collection to check- Returns:
HasCollectionResponse- See Also:
HasCollectionResponse,Response
-
dropCollection
Response dropCollection(java.lang.String collectionName)
Drops collection- Parameters:
collectionName- collection to drop- Returns:
Response- See Also:
Response
-
createIndexAsync
com.google.common.util.concurrent.ListenableFuture<Response> createIndexAsync(Index index)
Creates index specified byindexasynchronously
-
createPartition
Response createPartition(java.lang.String collectionName, java.lang.String tag)
Creates a partition specified bycollectionNameandtag- Parameters:
collectionName- collection nametag- partition tag- Returns:
Response- See Also:
Response
-
hasPartition
HasPartitionResponse hasPartition(java.lang.String collectionName, java.lang.String tag)
Checks whether the partition exists- Parameters:
collectionName- collection nametag- partition tag- Returns:
HasPartitionResponse- See Also:
Response
-
listPartitions
ListPartitionsResponse listPartitions(java.lang.String collectionName)
Lists current partitions of a collection- Parameters:
collectionName- collection name- Returns:
ListPartitionsResponse- See Also:
ListPartitionsResponse,Response
-
dropPartition
Response dropPartition(java.lang.String collectionName, java.lang.String tag)
Drops partition specified bycollectionNameandtag- Parameters:
collectionName- collection nametag- partition tag- See Also:
Response
-
insert
InsertResponse insert(InsertParam insertParam)
Inserts data specified byinsertParam- Parameters:
insertParam- theInsertParamobjectexample usage:
InsertParam insertParam = new InsertParam.Builder(collectionName) .withFloatVectors(floatVectors) .withVectorIds(vectorIds) .withPartitionTag(tag) .build();- Returns:
InsertResponse- See Also:
InsertParam,InsertResponse,Response
-
insertAsync
com.google.common.util.concurrent.ListenableFuture<InsertResponse> insertAsync(InsertParam insertParam)
Inserts data specified byinsertParamasynchronously- Parameters:
insertParam- theInsertParamobjectexample usage:
InsertParam insertParam = new InsertParam.Builder(collectionName) .withFloatVectors(floatVectors) .withVectorIds(vectorIds) .withPartitionTag(tag) .build();- Returns:
- a
ListenableFutureobject which holds theInsertResponse - See Also:
InsertParam,InsertResponse,Response,ListenableFuture
-
search
SearchResponse search(SearchParam searchParam)
Searches vectors specified bysearchParam- Parameters:
searchParam- theSearchParamobjectexample usage:
SearchParam searchParam = new SearchParam.Builder(collectionName) .withFloatVectors(floatVectors) .withTopK(topK) .withPartitionTags(partitionTagsList) .withParamsInJson("{\"nprobe\": 20}") .build();- Returns:
SearchResponse- See Also:
SearchParam,SearchResponse,SearchResponse.QueryResult,Response
-
searchAsync
com.google.common.util.concurrent.ListenableFuture<SearchResponse> searchAsync(SearchParam searchParam)
Searches vectors specified bysearchParamasynchronously- Parameters:
searchParam- theSearchParamobjectexample usage:
SearchParam searchParam = new SearchParam.Builder(collectionName) .withFloatVectors(floatVectors) .withTopK(topK) .withPartitionTags(partitionTagsList) .withParamsInJson("{\"nprobe\": 20}") .build();- Returns:
- a
ListenableFutureobject which holds theSearchResponse - See Also:
SearchParam,SearchResponse,SearchResponse.QueryResult,Response,ListenableFuture
-
getCollectionInfo
GetCollectionInfoResponse getCollectionInfo(java.lang.String collectionName)
Gets collection info- Parameters:
collectionName- collection to describe- See Also:
GetCollectionInfoResponse,CollectionMapping,Response
-
listCollections
ListCollectionsResponse listCollections()
Lists current collections- Returns:
ListCollectionsResponse- See Also:
ListCollectionsResponse,Response
-
countEntities
CountEntitiesResponse countEntities(java.lang.String collectionName)
Gets current entity count of a collection- Parameters:
collectionName- collection to count entities- Returns:
CountEntitiesResponse- See Also:
CountEntitiesResponse,Response
-
getServerVersion
Response getServerVersion()
Get server version- Returns:
Response- See Also:
Response
-
command
Response command(java.lang.String command)
Sends a command to server- Returns:
Responsecommand's response will be return inmessage- See Also:
Response
-
loadCollection
Response loadCollection(java.lang.String collectionName)
Pre-loads collection to memory- Parameters:
collectionName- collection to load- Returns:
Response- See Also:
Response
-
loadCollection
Response loadCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)
Pre-loads collection/partitions to memory- Parameters:
collectionName- collection to loadpartitionTags- partitions to load- Returns:
Response- See Also:
Response
-
releaseCollection
Response releaseCollection(java.lang.String collectionName)
Release collection from memory- Parameters:
collectionName- collection to release- Returns:
Response- See Also:
Response
-
releaseCollection
Response releaseCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)
Release collection/partitions from memory- Parameters:
collectionName- collection to releasepartitionTags- partitions to release- Returns:
Response- See Also:
Response
-
getIndexInfo
GetIndexInfoResponse getIndexInfo(java.lang.String collectionName)
Gets collection index information- Parameters:
collectionName- collection to get info from- See Also:
GetIndexInfoResponse,Index,Response
-
dropIndex
Response dropIndex(java.lang.String collectionName)
Drops collection index- Parameters:
collectionName- collection to drop index of- Returns:
Response- See Also:
Response
-
getCollectionStats
Response getCollectionStats(java.lang.String collectionName)
Shows collection information. A collection consists of one or multiple partitions (including the default partition), and a partitions consists of one or more segments. Each partition or segment can be uniquely identified by its partition tag or segment name respectively. The result will be returned as JSON string.- Parameters:
collectionName- collection to show info from- Returns:
Response- See Also:
Response
-
getEntityByID
GetEntityByIDResponse getEntityByID(java.lang.String collectionName, java.lang.String partitionTag, java.util.List<java.lang.Long> ids)
Gets vectors data by id array- Parameters:
collectionName- collection to get vectors frompartitionTag- partition to get vectors fromids- aListof vector ids- Returns:
GetEntityByIDResponse- See Also:
GetEntityByIDResponse,Response
-
listIDInSegment
ListIDInSegmentResponse listIDInSegment(java.lang.String collectionName, java.lang.String segmentName)
Gets all vector ids in a segment- Parameters:
collectionName- collection to get vector ids fromsegmentName- segment name in the collection- Returns:
ListIDInSegmentResponse- See Also:
ListIDInSegmentResponse,Response
-
deleteEntityByID
Response deleteEntityByID(java.lang.String collectionName, java.lang.String partitionTag, java.util.List<java.lang.Long> ids)
Deletes data in a collection by a list of ids- Parameters:
collectionName- collection to delete ids frompartitionTag- partition to delete ids fromids- aListof vector ids to delete- Returns:
Response- See Also:
Response
-
flush
Response flush(java.util.List<java.lang.String> collectionNames)
Flushes data in a list collections. Newly inserted or modifications on data will be visible afterflushreturned- Parameters:
collectionNames- aListof collections to flush- Returns:
Response- See Also:
Response
-
flushAsync
com.google.common.util.concurrent.ListenableFuture<Response> flushAsync(java.util.List<java.lang.String> collectionNames)
Flushes data in a list collections asynchronously. Newly inserted or modifications on data will be visible afterflushreturned- Parameters:
collectionNames- aListof collections to flush- Returns:
- a
ListenableFutureobject which holds theResponse - See Also:
Response,ListenableFuture
-
flush
Response flush(java.lang.String collectionName)
Flushes data in a collection. Newly inserted or modifications on data will be visible afterflushreturned- Parameters:
collectionName- name of collection to flush- Returns:
Response- See Also:
Response
-
flushAsync
com.google.common.util.concurrent.ListenableFuture<Response> flushAsync(java.lang.String collectionName)
Flushes data in a collection asynchronously. Newly inserted or modifications on data will be visible afterflushreturned- Parameters:
collectionName- name of collection to flush- Returns:
- a
ListenableFutureobject which holds theResponse - See Also:
Response,ListenableFuture
-
compact
Response compact(java.lang.String collectionName)
Compacts the collection, erasing deleted data from disk and rebuild index in background (if the data size after compaction is still larger than indexFileSize). Data was only soft-deleted until you call compact.- Parameters:
collectionName- name of collection to compact- Returns:
Response- See Also:
Response
-
compactAsync
com.google.common.util.concurrent.ListenableFuture<Response> compactAsync(java.lang.String collectionName)
Compacts the collection asynchronously, erasing deleted data from disk and rebuild index in background (if the data size after compaction is still larger than indexFileSize). Data was only soft-deleted until you call compact.- Parameters:
collectionName- name of collection to compact- Returns:
- a
ListenableFutureobject which holds theResponse - See Also:
Response,ListenableFuture
-
-