module ElasticsearchHermes::Indexing::Helper

Public Instance Methods

delete_index(index_name: to_s.underscore) click to toggle source
# File lib/elasticsearch_hermes/indexing/helper.rb, line 12
def delete_index(index_name: to_s.underscore)
  @index_object ||= ElasticsearchHermes::Index.new(name: index_name, fields: @fields)
  @index_object.delete
rescue Elasticsearch::Transport::Transport::Errors::NotFound
  Logger.log("No Such index: #{index_name}")
end
index_on(fields: []) click to toggle source
# File lib/elasticsearch_hermes/indexing/helper.rb, line 19
def index_on(fields: [])
  @fields = fields
end
re_index(index_name: to_s.underscore) click to toggle source
# File lib/elasticsearch_hermes/indexing/helper.rb, line 6
def re_index(index_name: to_s.underscore)
  delete_index(index_name: index_name)
  @index_object.create
  all.find_each(&:touch)
end