Sha256: d7afa137b55dfa5341691937d71d754985f4d72e5632b3b1120e34cdd25ff95e

Contents?: true

Size: 771 Bytes

Versions: 4

Compression:

Stored size: 771 Bytes

Contents

# frozen_string_literal: true

require_relative 'base_operation'

module Esse
  module CLI
    class Index::UpdateMapping < Index::BaseOperation
      def run
        validate_options!
        indices.each do |index|
          if index.type_hash.any?
            index.type_hash.each_value do |type|
              # @idea Add update_mapping! to IndexType and use it here
              index.elasticsearch.update_mapping!(type: type.type_name, **options)
            end
          else
            index.elasticsearch.update_mapping!(**options)
          end
        end
      end

      private

      def options
        @options.slice(*@options.keys - CLI_IGNORE_OPTS)
      end

      def validate_options!
        validate_indices_option!
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
esse-0.2.0 lib/esse/cli/index/update_mapping.rb
esse-0.1.3 lib/esse/cli/index/update_mapping.rb
esse-0.1.2 lib/esse/cli/index/update_mapping.rb
esse-0.1.1 lib/esse/cli/index/update_mapping.rb