lib/esse/backend/index/close.rb in esse-0.2.0 vs lib/esse/backend/index/close.rb in esse-0.2.2
- old
+ new
@@ -13,19 +13,19 @@
# @option options [String] :ignore_indices When performed on multiple indices, allows to ignore
# `missing` ones (options: none, missing) @until 1.0
# @option options [Boolean] :ignore_unavailable Whether specified concrete indices should be ignored when
# unavailable (missing, closed, etc)
# @option options [Time] :timeout Explicit operation timeout
- # @raise [Elasticsearch::Transport::Transport::Errors::BadRequest, Elasticsearch::Transport::Transport::Errors::NotFound]
+ # @raise [Esse::Backend::ServerError]
# in case of failure
# @return [Hash] the elasticsearch response
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html
def close!(suffix: index_version, **options)
Esse::Events.instrument('elasticsearch.close') do |payload|
payload[:request] = attributes = options.merge(index: index_name(suffix: suffix))
- payload[:response] = client.indices.close(**attributes)
+ payload[:response] = coerce_exception { client.indices.close(**attributes) }
end
end
# Close an index (keep the data on disk, but deny operations with the index).
#
@@ -41,10 +41,10 @@
# @return [Hash] the elasticsearch response, or an hash with 'errors' as true in case of failure
#
# @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html
def close(suffix: index_version, **options)
close!(suffix: suffix, **options)
- rescue Elasticsearch::Transport::Transport::ServerError
+ rescue ServerError
{ 'errors' => true }
end
end
include InstanceMethods