Package io.milvus.client
Interface MilvusClient
-
- All Known Implementing Classes:
MilvusGrpcClient
public interface MilvusClient
The Milvus Client Interface
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
clientVersion
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Close this MilvusClient.void
close(long maxWaitSeconds)
Close this MilvusClient.Response
command(java.lang.String command)
Sends a command to serverResponse
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).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).CountEntitiesResponse
countEntities(java.lang.String collectionName)
Gets current entity count of a collectionResponse
createCollection(CollectionMapping collectionMapping)
Creates collection specified bycollectionMapping
Response
createIndex(Index index)
Creates index specified byindex
com.google.common.util.concurrent.ListenableFuture<Response>
createIndexAsync(Index index)
Creates index specified byindex
asynchronouslyResponse
createPartition(java.lang.String collectionName, java.lang.String tag)
Creates a partition specified bycollectionName
andtag
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 idsResponse
dropCollection(java.lang.String collectionName)
Drops collectionResponse
dropIndex(java.lang.String collectionName)
Drops collection indexResponse
dropPartition(java.lang.String collectionName, java.lang.String tag)
Drops partition specified bycollectionName
andtag
Response
flush(java.lang.String collectionName)
Flushes data in a collection.Response
flush(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.String
getClientVersion()
GetCollectionInfoResponse
getCollectionInfo(java.lang.String collectionName)
Gets collection infoResponse
getCollectionStats(java.lang.String collectionName)
Shows collection information.GetEntityByIDResponse
getEntityByID(java.lang.String collectionName, java.lang.String partitionTag, java.util.List<java.lang.Long> ids)
Gets vectors data by id arrayGetIndexInfoResponse
getIndexInfo(java.lang.String collectionName)
Gets collection index informationResponse
getServerStatus()
Get server statusResponse
getServerVersion()
Get server versionHasCollectionResponse
hasCollection(java.lang.String collectionName)
Checks whether the collection existsHasPartitionResponse
hasPartition(java.lang.String collectionName, java.lang.String tag)
Checks whether the partition existsInsertResponse
insert(InsertParam insertParam)
Inserts data specified byinsertParam
com.google.common.util.concurrent.ListenableFuture<InsertResponse>
insertAsync(InsertParam insertParam)
Inserts data specified byinsertParam
asynchronouslyListCollectionsResponse
listCollections()
Lists current collectionsListIDInSegmentResponse
listIDInSegment(java.lang.String collectionName, java.lang.String segmentName)
Gets all vector ids in a segmentListPartitionsResponse
listPartitions(java.lang.String collectionName)
Lists current partitions of a collectionResponse
loadCollection(java.lang.String collectionName)
Pre-loads collection to memoryResponse
loadCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)
Pre-loads collection/partitions to memoryResponse
releaseCollection(java.lang.String collectionName)
Release collection from memoryResponse
releaseCollection(java.lang.String collectionName, java.util.List<java.lang.String> partitionTags)
Release collection/partitions from memorySearchResponse
search(SearchParam searchParam)
Searches vectors specified bysearchParam
com.google.common.util.concurrent.ListenableFuture<SearchResponse>
searchAsync(SearchParam searchParam)
Searches vectors specified bysearchParam
asynchronouslyMilvusClient
withTimeout(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
- theCollectionMapping
objectexample 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 byindex
asynchronously
-
createPartition
Response createPartition(java.lang.String collectionName, java.lang.String tag)
Creates a partition specified bycollectionName
andtag
- 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 bycollectionName
andtag
- Parameters:
collectionName
- collection nametag
- partition tag- See Also:
Response
-
insert
InsertResponse insert(InsertParam insertParam)
Inserts data specified byinsertParam
- Parameters:
insertParam
- theInsertParam
objectexample 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 byinsertParam
asynchronously- Parameters:
insertParam
- theInsertParam
objectexample usage:
InsertParam insertParam = new InsertParam.Builder(collectionName) .withFloatVectors(floatVectors) .withVectorIds(vectorIds) .withPartitionTag(tag) .build();
- Returns:
- a
ListenableFuture
object which holds theInsertResponse
- See Also:
InsertParam
,InsertResponse
,Response
,ListenableFuture
-
search
SearchResponse search(SearchParam searchParam)
Searches vectors specified bysearchParam
- Parameters:
searchParam
- theSearchParam
objectexample 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 bysearchParam
asynchronously- Parameters:
searchParam
- theSearchParam
objectexample usage:
SearchParam searchParam = new SearchParam.Builder(collectionName) .withFloatVectors(floatVectors) .withTopK(topK) .withPartitionTags(partitionTagsList) .withParamsInJson("{\"nprobe\": 20}") .build();
- Returns:
- a
ListenableFuture
object 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:
Response
command'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
- aList
of 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
- aList
of 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 afterflush
returned- Parameters:
collectionNames
- aList
of 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 afterflush
returned- Parameters:
collectionNames
- aList
of collections to flush- Returns:
- a
ListenableFuture
object 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 afterflush
returned- 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 afterflush
returned- Parameters:
collectionName
- name of collection to flush- Returns:
- a
ListenableFuture
object 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
ListenableFuture
object which holds theResponse
- See Also:
Response
,ListenableFuture
-
-