Description
The "Load Collection From File" endpoint allows you to load a collection from a specified file. Once loaded, this collection is instantiated and ready for further operations.
Proto Definition
service BGSearch {
rpc LoadCollectionFromFile (LoadCollectionFromFileArgs) returns (google.protobuf.Empty) {}
}
Input Message
Name
LoadCollectionFromFileArgs
Attributes
Attribute | Type | Description |
---|---|---|
collection | string | The name of the collection. |
location | string | The file location refers to the complete path, including the filename and extension, of the desired file. |
Proto
message LoadCollectionFromFileArgs {
string collection = 1;
string location = 2;
}
Example
{
"collection": "restaurants",
"location": "/restaurants.cereal"
}
Output Message
Name
EmptyResult
Attributes
Attribute | Type | Description |
---|
Example
{}
Status Code
3: INVALID_ARGUMENT
if the source file could not be opened.6: ALREADY_EXISTS
if a collection with the provided name already exists.0: OK
if a collection is loaded successfully.
Code Examples
proto::LoadCollectionFromFileArgs request;
proto::EmptyResult response;
request.set_collection("Collection_name");
request.set_location("files/directory/collection.cereal"); //This location is returned from saveCollectionToFile
stub->loadCollectionFromFile(&context,request,response);
import bgearch_pb2_grpc #Contains the server functions
import bgsearch_pb2 #Contains the types for the messages and arguments in the .proto file
args = bgsearch_pb2.LoadCollectionFromFileArgs(collection="YOUR_COLLECTION",
location="files/directory/collection.cereal")
stub.loadCollectionFromFile(args)