Cosmos DB icon

Cosmos DB

Cosmos DB Node - Upsert documents to Azure Cosmos DB

Container → Create

AI-generated

Summary

Create a new container within an Azure Cosmos DB database, with optional configurations for vector embedding and full-text search policies.

Inputs

  • Database Name or ID (required) — The name or ID of the Azure Cosmos DB database where the container will be created.
  • Container Name (required) — Name for the new container. Must be 1–255 characters long and contain only letters, numbers, hyphens, and underscores.
  • Partition Key Path (required) — The partition key path for the container (e.g. '/category'). Automatically formatted to start with a forward slash.
  • Add Vector Policy — Whether to enable vector search indexing and policy settings on the container.
  • Vector Path — The JSON path where vector embeddings are stored (e.g. '/vector'). Required if vector policy is enabled.
  • Vector Data Type — The vector embedding data type ('float32', 'float16', or 'int8'). Used when vector policy is enabled.
  • Distance Function — Distance metric for vector search ('cosine', 'euclidean', or 'dotProduct'). Used when vector policy is enabled.
  • Dimensions — The number of dimensions in vector embeddings (between 1 and 65535). Required if vector policy is enabled.
  • Index Type — Vector index type ('diskANN' or 'quantizedFlat'). Used when vector policy is enabled.
  • Add Full Text Search Policy — Whether to enable full-text search policy on the container.
  • Full Text Path — The JSON path for the text field enabled for full-text search (e.g. '/text'). Required if full-text policy is enabled.

Output shape

a single record

Returns the created Azure Cosmos DB container object, including metadata such as ID, partition key structure, indexing policy, and any configured vector or full-text policies.

Examples

Example 1: Create a standard Cosmos DB container

Database Name or ID = 'my-database', Container Name = 'users', Partition Key Path = '/userId'

Example 2: Create a container with vector search policy for AI embeddings

Database Name or ID = 'ai-db', Container Name = 'documents', Partition Key Path = '/category', Add Vector Policy = true, Vector Path = '/vector', Dimensions = 1536, Distance Function = 'cosine'

Discussion