Sha256: a7f5f9809e7110bc565ed04e171df0c34f5c82a7f085fddd69d8904d24224daa
Contents?: true
Size: 1.31 KB
Versions: 4
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true module Esse # https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb class Index module ClassMethods def settings_hash hash = setting.body { Esse::SETTING_ROOT_KEY => (hash.key?(Esse::SETTING_ROOT_KEY) ? hash[Esse::SETTING_ROOT_KEY] : hash) } end # Define /_settings definition by each index. # # +hash+: The body of the request includes the updated settings. # +block+: Overwrite default :to_h from IndexSetting instance # # Example: # # class UserIndex < Esse::Index # settings { # number_of_replicas: 4, # } # end # # class UserIndex < Esse::Index # settings do # # do something to load settings.. # end # end def settings(hash = {}, &block) @setting = Esse::IndexSetting.new(body: hash, paths: template_dirs, globals: -> { cluster.index_settings }) return unless block @setting.define_singleton_method(:to_h, &block) end private def setting @setting ||= Esse::IndexSetting.new(paths: template_dirs, globals: -> { cluster.index_settings }) end end extend ClassMethods end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
esse-0.2.0 | lib/esse/index/settings.rb |
esse-0.1.3 | lib/esse/index/settings.rb |
esse-0.1.2 | lib/esse/index/settings.rb |
esse-0.1.1 | lib/esse/index/settings.rb |