Sha256: f25e8dd073e2e7c145f3459a33fef016e711694c09befa2cdf55621369942080

Contents?: true

Size: 1.32 KB

Versions: 2

Compression:

Stored size: 1.32 KB

Contents

module Elasticsearch
  module API
    module Cluster
      module Actions

        # Shutdown one or all nodes
        #
        # @example Shut down node named _Bloke_
        #
        #     client.cluster.node_shutdown node_id: 'Bloke'
        #
        # @option arguments [List] :node_id A comma-separated list of node IDs or names to perform the operation on; use
        #                                   `_local` to shutdown the node you're connected to, leave empty to
        #                                   shutdown all nodes
        # @option arguments [Time] :delay Set the delay for the operation (default: 1s)
        # @option arguments [Boolean] :exit Exit the JVM as well (default: true)
        #
        # @see http://elasticsearch.org/guide/reference/api/admin-cluster-nodes-shutdown/
        #
        def node_shutdown(arguments={})
          method = 'POST'
          path   = Utils.__pathify( '_cluster/nodes', Utils.__listify(arguments[:node_id]), '_shutdown' )
          params = arguments.select do |k,v|
            [ :delay,
              :exit ].include?(k)
          end
          # Normalize Ruby 1.8 and Ruby 1.9 Hash#select behaviour
          params = Hash[params] unless params.is_a?(Hash)
          body   = nil

          perform_request(method, path, params, body).body
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
elasticsearch-api-0.4.0 lib/elasticsearch/api/actions/cluster/node_shutdown.rb
elasticsearch-api-0.0.2 lib/elasticsearch/api/actions/cluster/node_shutdown.rb