Sha256: a25757b52cb6fa677cbc61c1e1fbc766cf10f86bde926129ffc6a858c138f05d
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# frozen_string_literal: true module Esse module Backend class Index module InstanceMethods # Deletes ES index # # UsersIndex.elasticsearch.delete_index! # deletes `<prefix_>users<_suffix|_index_version|_timestamp>` index # # @param suffix [String, nil] The index suffix Use nil if you want to delete the current index. # @raise [Esse::Backend::NotFoundError] when index does not exists # @return [Hash] elasticsearch response def delete_index!(suffix: index_version, **options) Esse::Events.instrument('elasticsearch.delete_index') do |payload| payload[:request] = opts = options.merge(index: index_name(suffix: suffix)) payload[:response] = response = coerce_exception { client.indices.delete(**opts) } coerce_exception { cluster.wait_for_status! } if response response end end # Deletes ES index # # UsersIndex.elasticsearch.delete_index # deletes `<prefix_>users<_suffix|_index_version|_timestamp>` index # # @param suffix [String, nil] The index suffix Use nil if you want to delete the current index. # @return [Hash] the elasticsearch response, or an hash with 'errors' as true in case of failure def delete_index(suffix: index_version, **options) delete_index!(suffix: suffix, **options) rescue ServerError { 'errors' => true } end end include InstanceMethods end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
esse-0.2.2 | lib/esse/backend/index/delete.rb |