mirror of
https://github.com/glitch-soc/mastodon
synced 2025-04-24 14:14:51 +00:00
Add --only-mapping
option to tootctl search deploy
(#34466)
This commit is contained in:
parent
ee62ac53e1
commit
c01d219c12
1 changed files with 15 additions and 0 deletions
|
@ -20,6 +20,7 @@ module Mastodon::CLI
|
|||
option :import, type: :boolean, default: true, desc: 'Import data from the database to the index'
|
||||
option :clean, type: :boolean, default: true, desc: 'Remove outdated documents from the index'
|
||||
option :reset_chewy, type: :boolean, default: false, desc: "Reset Chewy's internal index"
|
||||
option :only_mapping, type: :boolean, default: false, desc: 'Update the index specification without re-index'
|
||||
desc 'deploy', 'Create or upgrade Elasticsearch indices and populate them'
|
||||
long_desc <<~LONG_DESC
|
||||
If Elasticsearch is empty, this command will create the necessary indices
|
||||
|
@ -52,6 +53,20 @@ module Mastodon::CLI
|
|||
|
||||
Chewy::Stash::Specification.reset! if options[:reset_chewy]
|
||||
|
||||
if options[:only_mapping]
|
||||
indices.select { |index| index.specification.changed? }.each do |index|
|
||||
progress.title = "Updating mapping for #{index} "
|
||||
index.update_mapping
|
||||
index.specification.lock!
|
||||
end
|
||||
|
||||
progress.title = 'Done! '
|
||||
progress.finish
|
||||
|
||||
say('Updated index mappings', :green, true)
|
||||
return
|
||||
end
|
||||
|
||||
# First, ensure all indices are created and have the correct
|
||||
# structure, so that live data can already be written
|
||||
indices.select { |index| index.specification.changed? }.each do |index|
|
||||
|
|
Loading…
Add table
Reference in a new issue