Define a scalar field (e.g. 'tenant_id' of DataType.VARCHAR) as the partition key when creating the collection: set is_partition_key=True on the field schema
Milvus automatically creates an internal set of partitions (default 64) and hashes entity partition key values to assign entities to partitions — you cannot manipulate these partitions directly
Insert entities with the partition key field populated; Milvus computes hash(tenant_id) % num_partitions to determine the target partition
Issue a search with a boolean filter expression on the partition key: expr='tenant_id == "acme"' — Milvus restricts the ANN scan to the matched partitions, improving throughput
For range-style access patterns use expr='tenant_id in ["acme", "beta"]' to target multiple partition key values in one request
Tune the number of internal partitions at collection creation via the num_partitions parameter if you have a very large number of tenants
Known gotchas
Once a field is designated as the partition key you cannot create manual partitions or call partition management APIs on that collection
The partition key filter expression must use equality or $in semantics; range comparisons on the partition key do not guarantee partition pruning
Omitting the partition key filter in a search causes a full collection scan across all partitions, negating the benefit of the partition key design
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp