Sha256: c9f12fb2ed51776f5f926970a422234d0b38e198c03bb4617ad85d6c37436b75
Contents?: true
Size: 1.54 KB
Versions: 4
Compression:
Stored size: 1.54 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 [Elasticsearch::Transport::Transport::Errors::NotFound] 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 = client.indices.delete(**opts) 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 Elasticsearch::Transport::Transport::Errors::NotFound { 'errors' => true } end end include InstanceMethods end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
esse-0.2.0 | lib/esse/backend/index/delete.rb |
esse-0.1.3 | lib/esse/backend/index/delete.rb |
esse-0.1.2 | lib/esse/backend/index/delete.rb |
esse-0.1.1 | lib/esse/backend/index/delete.rb |