diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 18:46:44 -0800 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-02-23 18:46:44 -0800 |
commit | 2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd (patch) | |
tree | 8315d20ffdfe2defd0c7135364eda21da207ed23 /ag | |
parent | Leave a note about reindex. (diff) | |
download | backend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.tar.gz backend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.tar.bz2 backend-2f5ae0b2e329ee78b940c7a25e7f45b3bb09d2cd.zip |
Prepare real wait for status.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'ag')
-rwxr-xr-x | ag | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -51,6 +51,13 @@ op = OptionParser.new do |opts| $options.action = :do_delete_msg end + + opts.on('--create-index', 'Create index but do not populate. Needs --list') do + abort 'Can only select one action' if $options.action != nil + + $options.action = :do_create_index + $options.need_argument = false + end opts.on('--delete-index', 'Delete index. Needs --list') do abort 'Can only select one action' if $options.action != nil @@ -140,6 +147,11 @@ Ag::Utils.proc_count = $options.jobs def do_full abort "Wrong argument type: #{$options.argmode.to_s}" unless $options.argmode == :dir + begin + Ag::Storage.delete_index(list) + rescue Elasticsearch::Transport::Transport::Errors::NotFound => e + $stderr.puts "Index did not exist yet. Creating." if $options.debug + end Ag::Storage.create_index($options.name) messages = $maildir.list(:cur) @@ -199,11 +211,16 @@ def do_delete_index begin Ag::Storage.delete_index($options.name) rescue Elasticsearch::Transport::Transport::Errors::NotFound => e + $stderr.puts "Index does not exist: #{e}" rescue => e $stderr.puts "Cannot delete index: #{e}" end end +def do_create_index + Ag::Storage.create($options.name) +end + def do_reindex # http://babinho.net/2014/07/refresh-your-elasticsearch-index-with-zero-downtime/ abort 'Come back later.' |