Sha256: ab2cc8c6b6ac0a7ead423893a1a26b588d2b8795c5feeef483f6542bbb88cefb
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true module Esse module Backend class Index module InstanceMethods # Deletes, creates and imports data to the index. Performs zero-downtime index resetting. # # @option options [String, nil] :suffix The index suffix. Defaults to the index_version. # A uniq index name will be generated if one index already exist with the given alias. # @option options [Time] :timeout Explicit operation timeout # @raise [Elasticsearch::Transport::Transport::Errors::BadRequest, Elasticsearch::Transport::Transport::Errors::NotFound] # in case of failure # @return [Hash] the elasticsearch response # # @see https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-open-close.html def reset_index!(suffix: index_version, **options) existing = [] suffix ||= Esse.timestamp suffix = Esse.timestamp while exist?(suffix: suffix).tap { |exist| existing << suffix if exist } create_index!(suffix: suffix, **options) import!(suffix: suffix, **options) update_aliases!(suffix: suffix) existing.each { |_s| delete_index!(suffix: suffix, **options) } true end end include InstanceMethods end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
esse-0.1.3 | lib/esse/backend/index/reset.rb |
esse-0.1.2 | lib/esse/backend/index/reset.rb |
esse-0.1.1 | lib/esse/backend/index/reset.rb |