lib/esse/index/settings.rb in esse-0.0.2 vs lib/esse/index/settings.rb in esse-0.0.3

- old
+ new

@@ -2,14 +2,13 @@ module Esse # https://github.com/elastic/elasticsearch-ruby/blob/master/elasticsearch-api/lib/elasticsearch/api/actions/indices/put_settings.rb class Index module ClassMethods - SETTING_ROOT_KEY = 'settings' - def settings_hash - hash = setting.body - { SETTING_ROOT_KEY => (hash.key?(SETTING_ROOT_KEY) ? hash[SETTING_ROOT_KEY] : hash) } + def settings_hash(cluster_settings: true) + hash = cluster_settings ? cluster.index_settings.merge(setting.body) : 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.