Method: Esse::CLI::Index::UpdateMapping#run

Defined in:
lib/esse/cli/index/update_mapping.rb

#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