Skip to main content
This page shows you how to create a collection with various configurations.

Parameters

ParameterTypeRequiredDescription
collectionNamestringCollection name must be unique within a project and the supported maximum length is 52
indexConfigsobjectField configuration for indexing. Required when creating from scratch
sourceProjectNamestringSource project name for PITR or branching operations
sourceCollectionNamestringSource collection name for PITR or branching operations
sourceDatetimestringISO 8601 formatted datetime for PITR (e.g., “2024-01-15T10:30:00Z”)
sourceProjectApiKeystringAPI key for the source project
partitionConfigobjectPartition configuration

Create a collection from scratch

The simplest way to create a collection is to provide the collection name and the field index configurations.
from lambdadb import LambdaDB, models

with LambdaDB(
    project_api_key="YOUR_API_KEY",
    base_url="YOUR_BASE_URL",
    project_name="YOUR_PROJECT_NAME",
) as client:
    basic_config = {
        "url": {"type": models.Type.KEYWORD},
        "author": {"type": models.Type.KEYWORD},
        "content": {
            "type": models.TypeText.TEXT,
            "analyzers": [models.Analyzer.JAPANESE, models.Analyzer.KOREAN, models.Analyzer.ENGLISH],
        },
    }
    client.collections.create(collection_name="example-collection", index_configs=basic_config)

Create a partitioned collection

LambdaDB supports a hash-based partitioning for a specified field.
from lambdadb import LambdaDB, models

with LambdaDB(project_api_key="YOUR_API_KEY", base_url="YOUR_BASE_URL", project_name="YOUR_PROJECT_NAME") as client:
    basic_config = {
        "url": {"type": models.Type.KEYWORD},
        "author": {"type": models.Type.KEYWORD},
        "content": {"type": models.TypeText.TEXT, "analyzers": [models.Analyzer.JAPANESE, models.Analyzer.KOREAN, models.Analyzer.ENGLISH]},
    }
    client.collections.create(
        collection_name="example-collection",
        index_configs=basic_config,
        partition_config={"field_name": "url", "data_type": "keyword", "num_partitions": 4},
    )
Currently, only keyword type is supported for partitioning.

Point-in-time recovery (PITR)

LambdaDB automatically maintains continuous backups at the collection level with a default retention period of 30 days. You can create a collection from a specific point in time using PITR functionality.
from lambdadb import LambdaDB

with LambdaDB(project_api_key="YOUR_TARGET_API_KEY", base_url="YOUR_BASE_URL", project_name="YOUR_PROJECT_NAME") as client:
    restored_collection = client.collections.create(
        collection_name="restored-collection",
        source_project_name="source-project-name",
        source_project_api_key="YOUR_SOURCE_API_KEY",
        source_collection_name="source-collection-name",
        source_datetime="2024-01-15T10:30:00Z",
    )
PITR allows you to restore collections to any point within the configured retention period. The sourceDatetime parameter must be in ISO 8601 format (UTC timezone). If sourceDatetime is not specified, the collection will be restored from the most recent data available.

Fork a collection with additional index configs

You can fork a collection based on an existing collection and extend it with additional indexConfigs. The original collection’s configuration will be preserved, and you can only add new fields.
from lambdadb import LambdaDB, models

with LambdaDB(project_api_key="YOUR_TARGET_API_KEY", base_url="YOUR_BASE_URL", project_name="YOUR_PROJECT_NAME") as client:
    forked = client.collections.create(
        collection_name="forked-collection",
        source_project_name="source-project-name",
        source_project_api_key="YOUR_SOURCE_API_KEY",
        source_collection_name="example-source-collection-name",
        source_datetime="2025-08-08T10:00:00Z",
        index_configs={
            "newText": {"type": models.TypeText.TEXT, "analyzers": [models.Analyzer.JAPANESE, models.Analyzer.KOREAN, models.Analyzer.ENGLISH]},
        },
    )
When forking a collection, specifying indexConfigs is optional. You can pass additional indexConfigs to extend the original collection’s configuration, but deleting or modifying the original collection’s indexConfigs is not allowed.

Collection limits

MetricLimit
Max number of collectionsunlimited
Max forked childs per collection30