API Reference

Description

The "Create Collection" endpoint allows you to create a new collection that will store geometries, provided a collection name.

Proto Definition


service BGSearch {
    rpc CreateCollection  (CreateCollectionArgs)  returns (google.protobuf.Empty) {}
}

Input Message

Name: CreateCollectionArgs

AttributeTypeDescription
namestringThe name of the collection.
Index_typeIndexTypeThe type of index used to store the geometries in memory.
id_typeIDTypeControls the assignment of unique identifiers to geometries stored in the collection.
message CreateCollectionArgs {
  string name = 1; 
  IndexType index_type = 2; 
  IDType id_type = 3; 
}

Output Message

Name: google.protobuf.Empty

Status Code

  • 6: ALREADY_EXISTS if a collection with the provided name already exists.
  • 0: OK if the collection is created successfully.

Code Examples

proto::EmptyResult result;
proto::CreateCollectionArgs request;
auto context = grpc::ClientContext>();

request.set_name(name);
auto status = stub->createCollection(&context, request, &result);
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.CreateCollectionArgs(name="your_collection_name")

try:
  stub.createCollection(args)
except Exception as e:
  print(e)