Adding New Fields to Items in Typesense Without Wiping Data
TLDR Alex wanted to add more fields to their Typesense items without wiping data. Kishore Nallan explained they had to create a new collection instead, and suggested using automatic schema detection for future changes. They also discussed potential downsides of indexing every field.

Jun 02, 2021 (27 months ago)
Alex
08:50 AMAlex
08:56 AMKishore Nallan
08:56 AMKishore Nallan
08:59 AMFor future use: you can use automatic schema detection to help with schema changes. For e.g you can have a collection with a field defined as:
```{"name": ".*_int32", "type": "int32"}```
This way, you can easily add a new field called
age_int32` and this will be automatically be inferred and indexed by Typesense.Kishore Nallan
09:00 AMv0.20.0
Alex
09:08 AMDo you see any downsides to adding:
{"name": ".*", "type": "auto" },
{"name": ".*_facet", "type": "auto", "facet": true }
to our schema? To make sure we never have to swap clusters again.
Kishore Nallan
09:12 AM.*_int32
gives you flexibility. If you have two integer fields only one of which must be indexed, then suffix the indexable field name with _int32
but for the other field name don't do that, so it is only stored and not indexed.
Typesense
Indexed 2764 threads (79% resolved)
Similar Threads
Discussions on Typesense, Collections, and Dynamic Fields
Tugay shares plans to use Typesense for their SaaS platform and asks about collection sizes and sharding. Jason clarifies Typesense's capabilities and shares a beta feature. They discuss using unique collections per customer and new improvements. Kishore Nallan and Gabe comment on threading and data protection respectively.


Updating Collection Schema and Querying Unspecified Fields in Typesense
Stefan asked about updating a collection schema. Kishore Nallan stated it's not currently possible but suggested automatic schema detection in version 0.20. Rishabh sought a workaround and Jason suggested creating a new collection with a new schema and re-indexing the data. Rishabh also asked about defining custom field IDs which Jason confirmed is not possible with Typesense.
Updating Collections Strategy and Faceting New Field
Nithin asked about strategies for updating collections and faceting new fields. Kishore Nallan suggested creating another collection, indexing in the background and using aliases to switch live traffic over, and shared details about the upcoming release.