class Stretch::Cluster

Attributes

connection[R]

Public Class Methods

new(connection) click to toggle source
# File lib/stretch/cluster.rb, line 5
def initialize connection
  @connection = connection
end

Public Instance Methods

health(options = {}) click to toggle source
# File lib/stretch/cluster.rb, line 9
def health options = {}
  indices = options.delete(:indices) if options.has_key? :indices

  path = "/health"

  if indices
    path << "/#{[indices].flatten.join(',')}"
    options[:level] = "indices"
  end

  get path, options
end
settings(options = {}) click to toggle source
# File lib/stretch/cluster.rb, line 26
def settings options = {}
  if options.any?
    put "/settings", options
  else
    get "/settings"
  end
end
state(options = {}) click to toggle source
# File lib/stretch/cluster.rb, line 22
def state options = {}
  get "/state", options
end

Private Instance Methods

get(path, options = {}) click to toggle source
# File lib/stretch/cluster.rb, line 35
def get path, options = {}
  @connection.request :get, "/_cluster#{path}", options
end
put(path, options = {}) click to toggle source
# File lib/stretch/cluster.rb, line 39
def put path, options = {}
  @connection.request :put, "/_cluster#{path}", options
end