Skip to content

How does set_default_index_prefix('foo_') works? #31

@Boris-Sachet

Description

@Boris-Sachet

Hi, I'm not sure I understand how the method set_default_index_prefix('foo_') is supposed to work. Should it be called in the model? Before the connexion?

I tried to put it everywhere but nothing seems to work, the prefix used to store my class is always esorm.

Here's my very simple use case:

class Profile(ESModel)
    username: str = Field(frozen=True)
    profile_name: str = Field(frozen=True)
    config: list[dict] = Field(default_factory=list)

if __name__ == "__main__":
    set_default_index_prefix('foo_')
    asyncio.run(connect("http://localhost:9200"))
    set_default_index_prefix('foo_')
    profile = Profile(username="test_username", profile_name="test_profile_name",
                      config=[{"test": "foo", "columns": [{"name": "the column name"}]}])
    asyncio.run(profile.save())

The newly created index is name esorm_profile instead of foo_profile, am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions