module ElasticSearch::Api::Admin::Index
Constants
- PSEUDO_INDICES
Public Instance Methods
:add => { “index” => “alias” } :add => [{“index” => “alias”}, {“index2” => “alias2”}] :add => { “index” => “alias”, “index2” => “alias2” } :remove => { “index” => “alias” } :remove => [{“index” => “alias”, {“index2” => “alias2”}] :remove => { “index” => “alias”, “index2” => “alias2” } :actions => [{:add => {:index => “index”, :alias => “alias”}}]
# File lib/elasticsearch/client/admin_index.rb, line 40 def alias_index(operations, options={}) if operations[:actions] alias_ops = operations else alias_ops = { :actions => [] } [:add, :remove].each do |op| next unless operations.has_key?(op) op_actions = operations[op].is_a?(Array) ? operations[op] : [operations[op]] op_actions.each do |action_hash| action_hash.each do |index, index_alias| alias_ops[:actions] << { op => { :index => index, :alias => index_alias }} end end end end execute(:alias_index, alias_ops, options) end
options: number_of_shards, number_of_replicas
# File lib/elasticsearch/client/admin_index.rb, line 22 def create_index(index, create_options={}, options={}) unless create_options[:index] create_options = { :index => create_options } end execute(:create_index, index, create_options, options) end
# File lib/elasticsearch/client/admin_index.rb, line 131 def create_river(type, create_options, options={}) execute(:create_river, type, create_options, options) end
# File lib/elasticsearch/client/admin_index.rb, line 29 def delete_index(index, options={}) execute(:delete_index, index, options) end
# File lib/elasticsearch/client/admin_index.rb, line 77 def delete_mapping(options={}) index, type, options = extract_required_scope(options) execute(:delete_mapping, index, type, options) end
# File lib/elasticsearch/client/admin_index.rb, line 143 def delete_river(type=nil, options={}) execute(:delete_river, type, options) end
list of indices, or :all options: refresh default: default_index if defined, otherwise :all
# File lib/elasticsearch/client/admin_index.rb, line 94 def flush(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:flush, indices, options) end
# File lib/elasticsearch/client/admin_index.rb, line 58 def get_aliases(index=default_index, options={}) index, type, options = extract_scope(options) execute(:get_aliases, index, options) end
# File lib/elasticsearch/client/admin_index.rb, line 135 def get_river(type, options={}) execute(:get_river, type, options) end
# File lib/elasticsearch/client/admin_index.rb, line 87 def get_settings(index=default_index, options={}) execute(:get_settings, index, options) end
# File lib/elasticsearch/client/admin_index.rb, line 14 def index_mapping(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:index_mapping, indices, options) end
# File lib/elasticsearch/client/admin_index.rb, line 7 def index_status(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:index_status, indices, options) end
list of indices, or :all options: max_num_segments, only_expunge_deletes, refresh, flush default: default_index if defined, otherwise all
# File lib/elasticsearch/client/admin_index.rb, line 124 def optimize(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:optimize, indices, options) end
list of indices, or :all no options default: default_index if defined, otherwise all
# File lib/elasticsearch/client/admin_index.rb, line 104 def refresh(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:refresh, indices, options) end
# File lib/elasticsearch/client/admin_index.rb, line 139 def river_status(type, options={}) execute(:river_status, type, options) end
list of indices, or :all no options default: default_index if defined, otherwise all
# File lib/elasticsearch/client/admin_index.rb, line 114 def snapshot(*args) options = args.last.is_a?(Hash) ? args.pop : {} indices = args.empty? ? [(default_index || :all)] : args.flatten indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:snapshot, indices, options) end
options: ignore_conflicts
# File lib/elasticsearch/client/admin_index.rb, line 64 def update_mapping(mapping, options={}) index, type, options = extract_required_scope(options) options = options.dup indices = Array(index) unless mapping[type] mapping = { type => mapping } end indices.collect! { |i| PSEUDO_INDICES.include?(i) ? "_#{i}" : i } execute(:update_mapping, indices, type, mapping, options) end
# File lib/elasticsearch/client/admin_index.rb, line 82 def update_settings(settings, options={}) index, type, options = extract_scope(options) execute(:update_settings, index, settings, options) end