class Esse::IndexSetting

www.elastic.co/guide/en/elasticsearch/reference/1.7/indices.html

Public Class Methods

new(body: {}, paths: [], globals: {}) click to toggle source
# File lib/esse/index_setting.rb, line 6
def initialize(body: {}, paths: [], globals: {})
  @globals = globals || {}
  @paths = Array(paths)
  @settings = body
end

Public Instance Methods

as_json() click to toggle source

This method will be overwrited when passing a block during the settings defination on index class.

Example:

class UserIndex < Esse::Index
  settings do
    # do something to load settings..
  end
end
# File lib/esse/index_setting.rb, line 22
def as_json
  return @settings unless @settings.empty?

  from_template || @settings
end
body() click to toggle source
# File lib/esse/index_setting.rb, line 28
def body
  @globals.merge(as_json)
end

Protected Instance Methods

from_template() click to toggle source
# File lib/esse/index_setting.rb, line 34
def from_template
  return if @paths.empty?

  loader = Esse::TemplateLoader.new(@paths)
  loader.read('{setting,settings}')
end