class Ej::Indices
Public Class Methods
new(values)
click to toggle source
# File lib/ej/indices.rb, line 3 def initialize(values) @logger = values.logger @index = values.index @client = values.client end
Public Instance Methods
aliases()
click to toggle source
# File lib/ej/indices.rb, line 9 def aliases @client.indices.get_aliases end
create_aliases(als, indices)
click to toggle source
# File lib/ej/indices.rb, line 25 def create_aliases(als, indices) actions = [] indices.each do |index| actions << { add: { index: index, alias: als } } end @client.indices.update_aliases body: { actions: actions } end
delete(index, type, query)
click to toggle source
# File lib/ej/indices.rb, line 49 def delete(index, type, query) if query.nil? if type.nil? @client.indices.delete index: index else body = { query: { match_all: {} } } @client.delete_by_query index: index, type: type, body: body end else body = { query: query } @client.delete_by_query index: index, body: body end end
delete_template(name)
click to toggle source
# File lib/ej/indices.rb, line 73 def delete_template(name) @client.indices.delete_template name: name end
indices()
click to toggle source
# File lib/ej/indices.rb, line 13 def indices @client.cat.indices format: 'json' end
mapping()
click to toggle source
# File lib/ej/indices.rb, line 44 def mapping data = @client.indices.get_mapping index: @index @index == '_all' ? data : data[@index]['mappings'] end
put_mapping(index, type, body)
click to toggle source
# File lib/ej/indices.rb, line 39 def put_mapping(index, type, body) @client.indices.create index: index unless @client.indices.exists index: index @client.indices.put_mapping index: index, type: type, body: body end
put_template(name, hash)
click to toggle source
# File lib/ej/indices.rb, line 21 def put_template(name, hash) @client.indices.put_template name: name, body: hash end
recovery()
click to toggle source
# File lib/ej/indices.rb, line 35 def recovery @client.indices.recovery index: @index end
refresh()
click to toggle source
# File lib/ej/indices.rb, line 85 def refresh @client.indices.refresh index: @index end
settings()
click to toggle source
# File lib/ej/indices.rb, line 77 def settings @client.indices.get_settings end
stats()
click to toggle source
# File lib/ej/indices.rb, line 17 def stats @client.indices.stats index: @index end
template()
click to toggle source
# File lib/ej/indices.rb, line 69 def template @client.indices.get_template end
warmer()
click to toggle source
# File lib/ej/indices.rb, line 81 def warmer @client.indices.get_warmer index: @index end