toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 364 forks source link

Use ENV variable to name index by default #938

Open loqimean opened 4 months ago

loqimean commented 4 months ago

Is your feature request related to a problem? Please describe.

I'm always frustrated when I run the tests and my DEV index is reset (because I need real ElasticSearch index testing). So, I solved it after ~2 years by setting name pattern in an initializer. There is too many devs who has this problem and don't know about solution, especially when it's a dev who started using ES and just development.

Describe the solution you'd like

Would be fine to provide built-in patter of naming indexes that use something like this:

Chewy.settings = { prefix: Rails.env }

Describe alternatives you've considered

nothing

Additional context

nothing

loqimean commented 4 months ago

I gues would be fine to do that not only for rails. If it is relevant, I can open a PR to solve it