I am attempting to implement Partition-key-based multi-tenancy, but I was not able to find any code implementation tutorial for me to follow along.
Here is the code I have so far. However, I am having trouble figuring out if this is the correct way to execute and what would be the proper next step for searching with Milvus?
schema = MilvusClient.create_schema(auto_id=True, enable_dynamic_field=True, primary_field="id")
schema.add_field(field_name="id", datatype=DataType.INT64, is_primary=True)
schema.add_field(field_name="source", datatype=DataType.VARCHAR, max_length=50000)
schema.add_field(field_name="embeddings", datatype=DataType.FLOAT_VECTOR, dim=self.truncate_dim)
schema.add_field(field_name="tenant", datatype=DataType.VARCHAR, is_partition_key=True) # i set the is_partition_key to True
index_params = MilvusClient.prepare_index_params()
index_params.add_index(field_name="id", index_type="STL_SORT")
index_params.add_index(
field_name="embeddings",
index_type="IVF_FLAT",
metric_type="L2",
params={"nlist": 1024},
)
self.milvusClient.create_collection(
collection_name=self.collection_name,
schema=schema,
index_params=index_params,
partition_key_field="tenant" # added a partition_key_field inside here
)