Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow wildcard (*) at the end of the index names when creating tenant tokens #2908

@curquiza

Description

@curquiza

Following this product discussion: meilisearch/product#491 (comment)
Related to this spec: meilisearch/specifications#189

Goal

Allow using the wildcard * at the end of the index name (in searchRules field) when creating tenant tokens.

How does it work?

To create a tenant token, you need to provide a searchRules field containing one or several index names.

{
    "searchRules": {
        "medical_records": {
            "filter": "user_id = 1"
        },
        "medical_records_staging": {
            "filter": "user_id = 1"
        },     
    }
}

Also, the * is already allowing as following, meaning "all the indexes":

{
    "searchRules": {
        "*": {
            "filter": "user_id = 1"
        }
    }
}

But the users need an intermediate usage of the * character: allowing to use the * character at the end of the index name.

Instead of passing:

{
    "searchRules": {
        "medical_records": {
            "filter": "user_id = 1"
        },
        "medical_records_staging": {
            "filter": "user_id = 1"
        },     
    }
}

The users could pass:

{
    "searchRules": {
        "medical_records*": {
            "filter": "user_id = 1"
        }
}

And this tenant will be available for all indexes matching medical_records*, so medical_records and medical_records_staging will match, but not medical_record (without s)

Errors

  • if no indexes are matched, no error are thrown during the tenant token creation. However this token will be useless until a matching index is created

Todo

Impacted teams

Pinging @meilisearch/docs-team, but also @meilisearch/integration-team (I'm not sure for you)

Metadata

Metadata

Assignees

Labels

contribution acceptedThis issue accepts external contributionsenhancementNew feature or improvementimpacts docsThis issue involves changes in the Meilisearch's documentationimpacts integrationsThis issue involves changes in the Meilisearch's integrationsv1.1.0PRs/issues solved in v1.1.0 released on 2023-04-03

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions