Class Collection
Methods
compact
-
Parameters
-
data: CompactReq
Property Type Description collection_name String The collection name to compact
Returns Promise<CompactionResponse>
Property Description status { error_code: number, reason: string } compactionID compaction ID Example
new milvusClient(MILUVS_ADDRESS).collectionManager.compact({ collection_name: 'my_collection', });
-
createCollection
-
Create a collection in Milvus.
Parameters
-
data: CreateCollectionReq
Property Type Description collection_name String Collection name description String Collection description fields FieldType Field data
Returns Promise<ResStatus>
Property Description error_code Error code number reason Error cause Example
new milvusClient(MILUVS_ADDRESS).collectionManager.createCollection({ collection_name: 'my_collection', fields: [ { name: "vector_01", description: "vector field", data_type: DataType.FloatVect, type_params: { dim: "8" } }, { name: "age", data_type: DataType.Int64, autoID: true, is_primary_key: true, description: "", }, ], });
-
describeCollection
-
Show the details of a collection, e.g. name, schema.
Parameters
-
data: DescribeCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<DescribeCollectionResponse>
Property Description status { error_code: number, reason: string } schema Information of all fields in this collection collectionID Collection ID Example
new milvusClient(MILUVS_ADDRESS).collectionManager.describeCollection({ collection_name: 'my_collection', });
-
dropCollection
-
Drop a collection. Note that this drops all data in the collection.
Parameters
-
data: DropCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<ResStatus>
Property Description error_code Error code number reason Error cause Example
new milvusClient(MILUVS_ADDRESS).collectionManager.dropCollection({ collection_name: 'my_collection', });
-
getCollectionStatistics
-
Show the statistics information of a collection.
Parameters
-
data: GetCollectionStatisticsReq
Property Type Description collection_name String Collection name
Returns Promise<StatisticsResponse>
Property Description status { error_code: number, reason: string } stats [{key: string, value: string}] data Transform stats to { row_count: 0 } Example
new milvusClient(MILUVS_ADDRESS).collectionManager.getCollectionStatistics({ collection_name: 'my_collection', });
-
getCompactionState
-
Get compaction states of a targeted compaction id
Parameters
-
data: GetCompactionStateReq
Property Type Description compactionID number or string the id returned by compact
Returns Promise<GetCompactionStateResponse>
Property Description status { error_code: number, reason: string } state the state of the compaction Example
new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionState({ compactionID: compactionID, });
-
getCompactionStateWithPlans
-
Get compaction states of a targeted compaction id
Parameters
-
data: GetCompactionPlansReq
Property Type Description compactionID number or string the id returned by compact
Returns Promise<GetCompactionPlansResponse>
Property Description status { error_code: number, reason: string } state the state of the compaction Example
new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionStateWithPlans({ compactionID: compactionID, });
-
hasCollection
-
Check if a collection exists.
Parameters
-
data: HasCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<BoolResponse>
Property Description status { error_code: number, reason: string } value true
orfalse
Example
new milvusClient(MILUVS_ADDRESS).collectionManager.hasCollection({ collection_name: 'my_collection', });
-
loadCollection
-
Load collection data into query nodes, then you can do vector search on this collection. It's async function, but we can use showCollections to check loading status.
Parameters
-
data: LoadCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<ResStatus>
Property Description error_code Error code number reason Error cause Example
new milvusClient(MILUVS_ADDRESS).collectionManager.loadCollection({ collection_name: 'my_collection', });
-
loadCollectionSync
-
Same function with loadCollection, but it's sync function. Help to ensure this collection is loaded.
Parameters
-
data: LoadCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<ResStatus>
Property Description error_code Error code number reason Error cause Example
new milvusClient(MILUVS_ADDRESS).collectionManager.loadCollectionSync({ collection_name: 'my_collection', });
-
releaseCollection
-
Release a collection from cache to reduce cache usage. Note that you cannot search while the corresponding collection is unloaded.
Parameters
-
data: ReleaseLoadCollectionReq
Property Type Description collection_name String Collection name
Returns Promise<ResStatus>
Property Description error_code Error code number reason Error cause Example
new milvusClient(MILUVS_ADDRESS).collectionManager.releaseCollection({ collection_name: 'my_collection', });
-
showCollections
-
List all collections or get collection loading status.
Parameters
-
Optional data: ShowCollectionsReq
Property Type Description type(optional) enum All -> 0, Loaded -> 1 collection_names(optional) String[] If type = Loaded
, Milvus will returncollection_names inMemory_percentages
Returns Promise<ShowCollectionsResponse>
Property Description status { error_code: number, reason: string } data Contains collection name, ID , timestamp (UTC created time), and loadedPercentage (100 means loaded) Example
new milvusClient(MILUVS_ADDRESS).collectionManager.showCollections();
-
Do compaction for the collection.