Creating a Collection

The Hyperspace database stores data within Collections, which are distinct segments within the database.

Hyperspace collections act like data containers, housing a large amount of data to be stored together and then accessed.

To enable the usage of the commands described below, you must first create a local Hyperspace instance to ensure the availability of necessary resources and functionalities.

Copy the following code snippet to create a collection –

collection_name = "new_collection"
hyperspace_client.create_collection('schema.json', collection_name)

Where –

  • 'schema.json' – Specifies the path to the configuration file (for example, '\schema.json') that you created locally on your machine, as described in Creating a Database Schema Configuration File.

  • collection_name – Specifies the name of the collection to be created in the Hyperspace database. You can specify any name as long as it is unique to your Hyperspace Collection.


The following response should be received –

{'status': 'OK', 'code': 200, 'message': 'Collection was successfully created'}

Alternatively, you can also define the config schema as a python dictionary .

Example -

config = {
  "configuration": {
    "budget": {
      "type": "integer"
    "genres": {
      "struct_type": "list",
      "type": "keyword"
    "id": {
      "type": "keyword",
      "id": True
    "popularity": {
      "type": "float"
    "rating": {
      "type": "float"
    "release_date_unix_time": {
      "type": "date"
     "embedded_overview": {
            "type": "dense_vector",
            "dim": 384,
            "index_type": "brute_force",
            "metric": "IP"

collection_name = 'new_collrction"

hyperspace_client.create_collection(config, collection_name)

Collections (sometimes referred to as "indexes") are a fundamental concept in databases that may organize data as Collections of documents. Collection's documents have a general predefined structure, but each document within a Collection can have its own unique set of fields and data out of the schema. Serving as containers for related documents and records, Collections facilitate logical grouping, making it simpler to organize, manage, and efficiently query, index, and retrieve related data.

Last updated