Am building an Index using RediSearch in a multi-tenant application that has got:
- 150,000 tenants
- Each tenant has on average 3,500 customers
- Each customer has 10 fields that will be added to the index
- All of the fields are
TextFields
.
Question is, what would be best practice (Performance, Memory/Storage, Flexibility) in such a case?
Should I create one customer_index
with a tenant_code
field to help identify which data belongs to which tenant or should I create a tenant specific index?
From my current experience and understanding, tenant-specific-index would mean many indexes but with less data in them and it would also give me the flexibility to drop and recreate an index for a specific tenant?
In Python, the code would be as below:
Single Customer Index
client = Client(`customer_index`)
client.create_index(
[
TextField('tenant_code'), TextField('last_name'), TextField('first_name'),
TextField('other_name'),
]
)
Tenant Specific Customer Index
client = Client(`tenant_code_customer_index`)
client.create_index(
[
TextField('last_name'), TextField('first_name'), TextField('other_name'),
]
)