lib/esse/backend/index/aliases.rb in esse-0.0.5 vs lib/esse/backend/index/aliases.rb in esse-0.1.1

- old
+ new

@@ -45,22 +45,26 @@ { remove: { index: index, alias: index_name } } end, { add: {index: build_real_index_name(suffix), alias: index_name } } ], } - client.indices.update_aliases(options) + + Esse::Events.instrument('elasticsearch.update_aliases') do |payload| + payload[:request] = options + payload[:response] = client.indices.update_aliases(options) + end end # Replaces all existing aliases by the respective suffixed index from argument. # # @param options [Hash] Hash of paramenters that will be passed along to elasticsearch request # @option [String] :suffix The suffix of the index used for versioning. # @raise [Elasticsearch::Transport::Transport::Errors::NotFound] in case of failure - # @return [Hash, false] the elasticsearch response, or false in case of failure + # @return [Hash] the elasticsearch response, or an hash with 'errors' as true in case of failure def update_aliases(suffix:, **options) update_aliases!(suffix: suffix, **options) rescue Elasticsearch::Transport::Transport::Errors::NotFound - false + { 'errors' => true } end end include InstanceMethods end