diff --git a/README.markdown b/README.markdown index cb76bb7..2169237 100644 --- a/README.markdown +++ b/README.markdown @@ -320,7 +320,7 @@ Index versions ======= In *escargot* indexes are versioned: when you create an index for the model Post the actual index created in ElasticSearch will be named something like -'posts_1287849616.57665' with an alias 'posts' pointing to it. The second time +'posts\_production\_1287849616.57665' with an alias 'posts\_production' pointing to it. The second time you run the "escargot:index" tasks a new index version will be created and the alias will be updated only when the new index is ready. diff --git a/lib/escargot/activerecord_ex.rb b/lib/escargot/activerecord_ex.rb index dcbe700..d07782d 100644 --- a/lib/escargot/activerecord_ex.rb +++ b/lib/escargot/activerecord_ex.rb @@ -40,7 +40,7 @@ def elastic_index(options = {}) options.symbolize_keys! send :include, InstanceMethods - @index_name = options[:index_name] || self.name.underscore.gsub(/\//,'-') + @index_name = [options[:index_name] || self.table_name.underscore, Rails.env].join("_") @update_index_policy = options.include?(:updates) ? options[:updates] : :immediate if @update_index_policy