Class: Esse::CLI::Index::UpdateMapping

Inherits:
BaseOperation show all
Defined in:
lib/esse/cli/index/update_mapping.rb

Instance Method Summary collapse

Methods inherited from BaseOperation

#initialize

Methods included from Output

colorize, formatted_runtime, print_backtrace, print_error, print_message, runtime_padding

Constructor Details

This class inherits a constructor from Esse::CLI::Index::BaseOperation

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/esse/cli/index/update_mapping.rb', line 8

def run
  validate_options!
  indices.each do |index|
    if !index.mapping_single_type?
      # Elasticsearch 6.x and older have multiple types per index.
      # This gem supports multiple types per index for backward compatibility, but we recommend to update
      # your elasticsearch to a at least 7.x version and use a single type per index.
      #
      # Note that the repository name will be used as the document type.
      index.repo_hash.keys.each do |doc_type|
        index.update_mapping(type: doc_type, **options)
      end
    else
      index.update_mapping(**options)
    end
  end
end