Skip to content

Aliases use-case #3

@Thaigun

Description

@Thaigun

Hi again! I hope I don't annoy you with all the issues and that you find the use cases from the field useful.

Typesense docs mention this alias use-case: https://typesense.org/docs/28.0/api/collection-alias.html#use-case

That's what I had done, too. My idea was that I'd have a workflow to re-index everything into a new collection when needed, point the alias to the new collection and remove the old collection. I used to call the collections with names like tenants-${Date.now()} while the alias would be tenants. Clients would search from the alias as if it was a collection.

Now, the issue. Creating an alias is not allowed for collection names that have not been defined beforehand. That also makes re-indexing use-case a bit hairy. I.e. the following is not allowed:

    await alias({
        name: 'tenants',
        collection_name: 'tenants-' + Date.now(),
    }).upsert();

I don't know, maybe we could allow overriding collection names when indexing data and alias could be more relaxed with the collection name and take the collection schema as a parameter to know what type will be returned?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions