Description
The "Swap Collections" endpoint enables you to perform an atomic swap operation between two collections. In this operation, the contents of "Collection 1" are exchanged with the contents of "Collection 2," and vice versa, ensuring a seamless transfer of data between the two collections.
Proto Definition
service BGSearch {
rpc SwapCollections (SwapCollectionsArgs) returns (google.protobuf.Empty) {}
}
Input Message
Name: SwapCollectionsArgs
Attribute | Type | Description |
---|---|---|
collection1 | string | The name of the first collection. |
collection2 | string | The name of the second collection. |
message SwapCollectionsArgs {
string collection1 = 1;
string collection2 = 2;
}
Output Message
Name: google.protobuf.Empty
Status Code
5: NOT_FOUND
if either collection with the provided names does not exist.0: OK
if the collections provided exist and they have been swapped.
Code Examples
proto::SwapCollectionsArgs request;
proto::EmptyResult response;
request.set_collection1("COLLECTION 1");
request.set_allocated_collection2("COLLECTION_2");
stub->swapCollections(&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.SwapCollectionsArgs(collection1="COLLECTION 1", collection2="COLLECTION 2")
stub.swapCollections(args)