class Elastics::Indices

Public Class Methods

new(config_path) click to toggle source
# File lib/elastics/indices.rb, line 6
def initialize(config_path)
  hash = YAML.load(Utils.erb_process(config_path))
  replace Utils.delete_allcaps_keys(hash)
end

Public Instance Methods

create_index(index, name=nil, opts={}) click to toggle source
# File lib/elastics/indices.rb, line 11
def create_index(index, name=nil, opts={})
  name ||= index
  Elastics.PUT name, self[index], opts
end
create_indices(indices=keys, opts={}) click to toggle source
# File lib/elastics/indices.rb, line 16
def create_indices(indices=keys, opts={})
  indices.each{|i| create_index(i, i, opts)}
end
delete_indices(indices=keys, opts={}) click to toggle source
# File lib/elastics/indices.rb, line 20
def delete_indices(indices=keys, opts={})
  indices.each do |i|
    args = {:index=>i}.merge(opts)
    Elastics.delete_index(args)
  end
end