escargot icon indicating copy to clipboard operation
escargot copied to clipboard

Feature request: Add environment name to index name

Open pfeiffer opened this issue 14 years ago • 2 comments

At the moment the default index name and the custom index name are the same in all environments. This causes updates triggered in eg. test mode to update data/indexes in the other environment as well.

A suggestion could be to add a suffix to the index name, like this:

@index_name = [options[:index_name] || self.table_name.underscore, RAILS_ENV || Rails.env].join("_")

Causing a User-model to use an index name of "users_production" in production environment and "users_test" in test environment.

Let me know what you think and I can provide a patch.

pfeiffer avatar Jan 07 '11 02:01 pfeiffer

This makes a lot of sense. Even better would be to allow the user to independent elasticsearch configurations for each environment. Something like this:

config/elasticsearch.yml


production:
  host:  192.134.321.121:9200
  prefix: production

development:
  host:  192.134.321.121:9200
  prefix: development

test:
  host: localhost:9200
  prefix: test

Using "prefix" as a way to isolate indexes between enviroments, an of course defaulting "prefix" to the environment name.

What do you think?

angelf avatar Jan 07 '11 12:01 angelf

I like the idea of having the option to use independent configurations for each environment.

Can you think of any cases where it would be necessary to use a different prefix than the current environment?

pfeiffer avatar Jan 07 '11 15:01 pfeiffer