module Chewy::Index::Aliases::ClassMethods

Public Instance Methods

aliases() click to toggle source
# File lib/chewy/index/aliases.rb, line 13
def aliases
  empty_if_not_found do
    client.indices.get_alias(index: index_name, name: '*').values.flat_map do |aliases|
      aliases['aliases'].keys
    end
  end.compact.uniq
end
indexes() click to toggle source
# File lib/chewy/index/aliases.rb, line 7
def indexes
  indexes = empty_if_not_found { client.indices.get(index: index_name).keys }
  indexes += empty_if_not_found { client.indices.get_alias(name: index_name).keys }
  indexes.compact.uniq
end

Private Instance Methods

empty_if_not_found() { || ... } click to toggle source
# File lib/chewy/index/aliases.rb, line 23
def empty_if_not_found
  yield
rescue Elasticsearch::Transport::Transport::Errors::NotFound
  []
end