Sha256: d5185c78751af3d530bfc96ddeb288ecffa883f0f93b8a31b7826b35cfa73f82

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

# frozen_string_literal: true

module Esse
  class Transport
    module InstanceMethods
      # Return a list of index aliases.
      #
      # @param options [Hash] Hash of paramenters that will be passed along to elasticsearch request
      # @option [String] :index A comma-separated list of index names to filter aliases
      # @option [String] :name A comma-separated list of alias names to return
      # @raise [Esse::Transport::ServerError] in case of failure
      #
      # @see https://www.elastic.co/guide/en/elasticsearch/reference/7.5/indices-get-alias.html
      def aliases(**options)
        coerce_exception { client.indices.get_alias(**options) }
      end

      # Updates index aliases.
      #
      # @param options [Hash] Hash of paramenters that will be passed along to elasticsearch request
      # @option [Hash] :body The definition of `actions` to perform
      #
      # @see https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html
      def update_aliases(body:, **options)
        throw_error_when_readonly!

        Esse::Events.instrument('elasticsearch.update_aliases') do |payload|
          payload[:request] = options.merge(body: body)
          payload[:response] = coerce_exception { client.indices.update_aliases(**options, body: body) }
        end
      end
    end

    include InstanceMethods
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
esse-0.4.0.rc4 lib/esse/transport/aliases.rb
esse-0.4.0.rc3 lib/esse/transport/aliases.rb
esse-0.4.0.rc2 lib/esse/transport/aliases.rb
esse-0.4.0.rc1 lib/esse/transport/aliases.rb
esse-0.3.5 lib/esse/transport/aliases.rb
esse-0.3.4 lib/esse/transport/aliases.rb
esse-0.3.3 lib/esse/transport/aliases.rb
esse-0.3.2 lib/esse/transport/aliases.rb
esse-0.3.1 lib/esse/transport/aliases.rb
esse-0.3.0 lib/esse/transport/aliases.rb
esse-0.2.6 lib/esse/transport/aliases.rb
esse-0.2.5 lib/esse/transport/aliases.rb