aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-02-23 17:47:30 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2015-02-23 17:49:07 -0800
commit149ce341820a66010e8592975d86e5d6dd0c6b7e (patch)
treebfa728cc39b460f03511b183b0a5b775cf282505 /lib
parentFall back to charlock_holmes; also add stub encoding extraction from the mess... (diff)
downloadbackend-149ce341820a66010e8592975d86e5d6dd0c6b7e.tar.gz
backend-149ce341820a66010e8592975d86e5d6dd0c6b7e.tar.bz2
backend-149ce341820a66010e8592975d86e5d6dd0c6b7e.zip
Expose delete index.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/storage.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/storage.rb b/lib/storage.rb
index 5b360f5..656a6bf 100644
--- a/lib/storage.rb
+++ b/lib/storage.rb
@@ -3,9 +3,16 @@ require 'date'
module Ag::Storage
module_function
+
+ # Throws Elasticsearch::Transport::Transport::Errors::NotFound
+ # if the list does not exist
+ def delete_index(list)
+ $es.indices.delete index: 'ml-' + list
+ end
+
def create_index(list)
begin
- $es.indices.delete index: 'ml-' + list
+ delete_index(ist)
rescue Elasticsearch::Transport::Transport::Errors::NotFound => e
$stderr.puts "Index did not exist yet. Creating." if $options.debug
end
@@ -267,4 +274,4 @@ module Ag::Storage
return nil if result['hits']['total'] == 0
result['hits']['hits'].first
end
-end \ No newline at end of file
+end