Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add environment name to index name #5

Open
pfeiffer opened this issue Jan 7, 2011 · 2 comments · May be fixed by #7
Open

Feature request: Add environment name to index name #5

pfeiffer opened this issue Jan 7, 2011 · 2 comments · May be fixed by #7

Comments

@pfeiffer
Copy link

pfeiffer commented Jan 7, 2011

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.

@angelf
Copy link
Owner

angelf commented Jan 7, 2011

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?

@pfeiffer
Copy link
Author

pfeiffer commented Jan 7, 2011

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants