create_collection

Create a new collection from a full CollectionSpec.

Example

up:
  - op: create_collection
    name: products
    spec:
      vectors:
        "":                          # "" is the unnamed/default vector
          size: 768
          distance: Cosine
        image:                       # multiple named vectors
          size: 512
          distance: Dot
          on_disk: true
      sparse_vectors:
        keywords:
          on_disk: false
      hnsw_config:
        m: 16
        ef_construct: 128
      optimizers_config:
        default_segment_number: 2
      shard_number: 2
      replication_factor: 2
      on_disk_payload: true

Fields

FieldTypeRequiredDescription
namestringyesCollection name.
specCollectionSpecyesFull collection specification.

spec fields

FieldTypeDescription
vectorsmap<name, VectorSpec>Named dense vectors. Use "" as the key for the unnamed/default vector.
sparse_vectorsmap<name, SparseVectorSpec>Named sparse vectors.
hnsw_configHnswConfigSpecCollection-level HNSW defaults.
quantization_configQuantizationSpecCollection-level quantization defaults.
optimizers_configOptimizersConfigSpecOptimizer thresholds.
shard_numberuintNumber of shards (immutable on single-node).
replication_factoruintReplication factor.
write_consistency_factoruintWrite consistency factor.
on_disk_payloadboolStore the whole collection payload on disk.

Reversibility

Auto-reversible → delete_collection. Dropping the new collection destroys whatever was written into it in the interim, so the downgrade is destructive but unambiguous.