Sha256: 9590a3fe62fb78afc138c980d39515ae451d6193582c45a3696c033629b4726a

Contents?: true

Size: 782 Bytes

Versions: 62

Compression:

Stored size: 782 Bytes

Contents

module Workarea
  class UpdateElasticsearchSettings
    include Sidekiq::Worker
    sidekiq_options queue: 'high'

    def perform(settings)
      Elasticsearch::Document.all.each do |klass|
        klass.current_index.wait_for_health # For initial setup

        klass.current_index.while_closed do
          # number_of_shards cannot be updated, ES will return
          # a 400 error
          Workarea.elasticsearch.indices.put_settings(
            index: klass.current_index.name,
            body: {
              settings: settings.except(
                'number_of_shards',
                'number_of_replicas'
              )
            }
          )
        end

        klass.current_index.wait_for_health # For running inline (e.g. tests)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.15 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.36 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.14 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.35 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.13 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.34 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.12 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.33 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.11 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.10 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.32 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.9 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.31 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.8 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.30 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.7 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.29 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.6 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.4.28 app/workers/workarea/update_elasticsearch_settings.rb
workarea-core-3.5.5 app/workers/workarea/update_elasticsearch_settings.rb