In Weaviate, what is a collection and what does collections.create define?
answer
- Think tables, not a bare vector store
- Named container with typed properties
- Property plus DataType enum
- One vector index per collection definition
- Also pins replication and tenancy
basics
~20 sA collection is Weaviate's typed container for objects of one kind, much like a table. collections.create names it and declares its properties with data types, plus per-collection settings such as the vector index, replication and multi-tenancy.
solid answer
~50 sA Weaviate collection holds objects that share one definition: the same properties, the same vector index, the same replication and tenancy settings. Every object is a UUID plus typed properties plus one or more vectors, so the collection definition tells the server both how to index the payload for filtering and keyword search and how to index the vector for similarity search. With the v4 Python client you call `client.collections.create(name="Article", properties=[Property(name="title", data_type=DataType.TEXT), ...])`. `Property` and the `DataType` enum (`TEXT`, `INT`, `NUMBER`, `BOOL`, `DATE`, `UUID`, `GEO_COORDINATES`, `BLOB`, `OBJECT`, and `_ARRAY` variants) come from `weaviate.classes.config`. The same call also takes the vector index config, inverted-index config, references, replication and multi-tenancy config. Afterwards you work through a handle: `client.collections.get("Article")`, with `collections.exists`, `collections.list_all` and `collections.delete` for lifecycle. This typed schema is the main thing that separates Weaviate from a bare vector index.
code
python · 16 linesimport weaviate
import weaviate.classes.config as wvcc
client = weaviate.connect_to_local()
client.collections.create(
name="Article",
properties=[
wvcc.Property(name="title", data_type=wvcc.DataType.TEXT),
wvcc.Property(name="word_count", data_type=wvcc.DataType.INT),
wvcc.Property(name="published_at", data_type=wvcc.DataType.DATE),
],
)
articles = client.collections.get("Article")
articles.data.insert({"title": "Vector search", "word_count": 1200})
client.close()go deeper
Be able to say plainly that a collection is a named, typed container of objects, and that collections.create declares its properties with data types. Know the create, get, exists and delete calls.
Explain what the data type buys you in the inverted index — range filters on numbers and dates, tokenised matching on text — and that the create call also pins the vector index and tenancy configuration.
Show that you treat the collection as the unit of blast radius: deletion is total, several settings are fixed at creation, and definitions belong in version-controlled setup code rather than being created ad hoc by application paths.
Own the modelling call — how many collections a domain needs, what belongs as a property versus a reference versus a separate collection, and how that shape constrains filtering, tenancy and future re-import cost.
## What a collection is Weaviate's top-level container is a **collection** (the REST schema and older material call it a *class*). A collection holds objects of one kind and every object in it shares one definition: the same property declarations, the same vector index and distance metric, the same inverted-index settings, the same replication factor and the same multi-tenancy setting. That makes it closer to a relational table than to a bare vector index — the schema is a server-side artifact you can read back, not something your application keeps in its head. An object inside a collection is three things at once: a UUID, a set of typed properties (the JSON payload), and one or more vectors. Weaviate stores the properties in an inverted index so they can be filtered and keyword-searched, and the vector in a vector index so it can be searched by similarity. The collection definition is what configures both halves. ## Creating one with the v4 Python client `client.collections.create(...)` is the single entry point. The minimum is a name; in practice you pass `properties=[...]`, each one a `Property(name=..., data_type=...)` from `weaviate.classes.config`. Two naming rules bite newcomers: Weaviate capitalises the first letter of a collection name, so `article` and `Article` are the same collection, and property names must start with a lowercase letter and stay GraphQL-safe. ## Properties and data types The `DataType` enum covers `TEXT`, `INT`, `NUMBER`, `BOOL`, `DATE`, `UUID`, `GEO_COORDINATES`, `BLOB`, `OBJECT` and the corresponding `_ARRAY` variants. The type is not decoration: it decides what the inverted index can do with the value. A `TEXT` property is tokenised and can be BM25-searched; an `INT`, `NUMBER` or `DATE` property supports range comparisons; a `UUID` is stored compactly. Getting `INT` versus `NUMBER` wrong, or storing a timestamp as `TEXT`, quietly costs you range filtering later. `Property` also carries indexing switches — notably `index_filterable` and `index_searchable`, and `tokenization` for text — that let you skip index building for properties you never query on, trading query ability for faster imports and less disk. Vectorisation flags on a property control whether its text feeds the embedding, which is the vectoriser module's concern rather than the schema's. ## What else the definition holds Beyond properties, `collections.create` accepts: the vector index configuration (`Configure.VectorIndex.hnsw()`, `.flat()` or `.dynamic()`) and its distance metric; inverted-index configuration such as BM25 parameters, stopwords and whether timestamps and null states are indexed; `references=[ReferenceProperty(...)]` for links to other collections; `replication_config=Configure.replication(factor=...)`; and `multi_tenancy_config=Configure.multi_tenancy(...)`. All of these are per-collection, which is exactly why the create call carries so much weight — several of these choices cannot be changed afterwards. ## Lifecycle `client.collections.exists("Article")` checks existence, `client.collections.list_all()` enumerates definitions, `client.collections.get("Article")` returns the handle you use for data and queries, and `client.collections.delete("Article")` destroys the definition *and* all of its objects with no undo. On the handle, `collection.config.get()` reads the current definition back, `collection.config.add_property(...)` appends a property, and `collection.config.update(...)` changes the mutable settings. ## Why interviewers start here Because the collection is the unit of configuration, it is also the unit of blast radius. Filtering, hybrid search, tenant isolation, memory footprint and re-import cost are all decided by what you wrote in `collections.create`. A candidate who can describe a collection as "a typed table whose definition also pins the vector index and tenancy model" is set up for every harder Weaviate question that follows.
- How do you read an existing collection's definition back from the server?Take the handle with `client.collections.get("Article")` and call `collection.config.get()`. It returns the full definition — properties and their data types and index flags, the vector index configuration, inverted-index settings, replication and multi-tenancy config. It is the first thing to check when a filter or keyword search behaves unexpectedly, because it shows what the server actually stored rather than what you meant to declare.
- What happens to the objects when you delete a collection?They go with it. `client.collections.delete("Article")` removes the definition and every object, vector and index belonging to it, and there is no undo or soft delete. Recovery means restoring from a backup or re-importing from your source of truth, so in shared environments deletion is worth gating behind a deliberate step rather than leaving it in an idempotent setup script.
- Why does the data type matter if you are only doing vector search?Because pure vector search is rarely the whole query. The data type decides what the inverted index supports: only numeric and date properties give you range comparisons, only text properties are tokenised for keyword matching. If you store a price or a timestamp as text, you can match it exactly but never filter a range without re-importing under a corrected definition.
A collection is a table definition that happens to own an index for meaning as well as indexes for values.
saying these in an interview costs you the question
- Thinks Weaviate is schemaless like a plain vector index
- Says collections are created per object insert batch
- Believes data types are cosmetic and do not affect indexing
- Assumes deleting a collection keeps the objects somewhere
- Confuses a collection with a single vector index shard