Description
The "Save Collection To File" endpoint allows you to save a collection to a specified file. Once saved, this collection persisted and can be loaded from the file at a later time. This endpoint allows for server restarts without losing data.
Proto Definition
service BGSearch {
rpc SaveCollectionToFile (SaveCollectionToFileArgs) returns (SaveCollectionResult) {}
}
Input Message
Name
SaveCollectionToFileArgs
Attributes
Attribute | Type | Description |
---|---|---|
collection | string | The name of the collection. |
path | string | The path where you wish to save the file. |
filename | string | The filename where you wish to store the collection, excluding extension. |
Proto
message SaveCollectionToFileArgs {
string collection = 1;
string path = 2;
string filename = 3;
}
Output Message
Name
SaveCollectionResult
Attributes
Attribute | Type | Description |
---|---|---|
full_path | string | The full path including filename and extension. |
Proto
message SaveCollectionResult {
string full_path = 1;
}
Status Code
5: NOT_FOUND
if a collection with the provided name does not exist.3: INVALID_ARGUMENT
if the destination file could not be opened.0: OK
if the collection has been saved successfully.
Code Examples
proto::SaveCollectionToFileArgs request;
proto::SaveCollectionResult response;
request.set_collection("COLLECTION_NAME");
request.set_path("files");
request.set_filename("example_collection_filename");
stub->saveCollectionToFile(&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.SaveCollectionToFileArgs(collection="YOUR_COLLECTION",
path="files",
filename="sample_filename")
stub.saveCollectionToFile(args)