rollover

in elasticsearch-api/lib/elasticsearch/api/actions/indices/rollover.rb [80:111]


        def rollover(arguments = {})
          request_opts = { endpoint: arguments[:endpoint] || 'indices.rollover' }

          defined_params = [:alias, :new_index].each_with_object({}) do |variable, set_variables|
            set_variables[variable] = arguments[variable] if arguments.key?(variable)
          end
          request_opts[:defined_params] = defined_params unless defined_params.empty?

          raise ArgumentError, "Required argument 'alias' missing" unless arguments[:alias]

          arguments = arguments.clone
          headers = arguments.delete(:headers) || {}

          body = arguments.delete(:body)

          _alias = arguments.delete(:alias)

          _new_index = arguments.delete(:new_index)

          method = Elasticsearch::API::HTTP_POST
          path   = if _alias && _new_index
                     "#{Utils.listify(_alias)}/_rollover/#{Utils.listify(_new_index)}"
                   else
                     "#{Utils.listify(_alias)}/_rollover"
                   end
          params = Utils.process_params(arguments)

          Elasticsearch::API::Response.new(
            perform_request(method, path, params, body, headers, request_opts)
          )
        end