From f3cbe7f10e0ee231de5aace3a46fe63b1dc9c0eb Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 4 Dec 2017 01:48:41 +0100 Subject: [PATCH] Added ability to delete elasticsearch processors first (for cleanup). --- lib/search_index_backend.rb | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/lib/search_index_backend.rb b/lib/search_index_backend.rb index 2fdcdbd97..6547e491f 100644 --- a/lib/search_index_backend.rb +++ b/lib/search_index_backend.rb @@ -60,21 +60,20 @@ update processors items.each do |item| if item[:action] == 'delete' - #Rails.logger.info "# curl -X DELETE \"#{url}\"" - #response = UserAgent.delete( - # url, - # { - # json: true, - # open_timeout: 8, - # read_timeout: 12, - # user: Setting.get('es_user'), - # password: Setting.get('es_password'), - # } - #) - #Rails.logger.info "# #{response.code}" - #next if response.success? - #raise "Unable to process DELETE at #{url}\n#{response.inspect}" - next + Rails.logger.info "# curl -X DELETE \"#{url}\"" + response = UserAgent.delete( + url, + { + json: true, + open_timeout: 8, + read_timeout: 12, + user: Setting.get('es_user'), + password: Setting.get('es_password'), + } + ) + Rails.logger.info "# #{response.code}" + next if response.success? + raise "Unable to process DELETE at #{url}\n#{response.inspect}" end Rails.logger.info "# curl -X PUT \"#{url}\" \\" Rails.logger.debug "-d '#{data.to_json}'"