Class: Elasticsearch::Client::ESClient

Inherits:
Base
  • Object
show all
Defined in:
lib/elasticsearch/client/elasticsearch.rb

Instance Method Summary collapse

Methods inherited from Base

#_get, #_prep_opts, #_put, #get, #initialize, #put

Constructor Details

This class inherits a constructor from Elasticsearch::Client::Base

Instance Method Details

#green?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/elasticsearch/client/elasticsearch.rb', line 12

def green?
  status == 'green'
end

#healthObject



16
17
18
# File 'lib/elasticsearch/client/elasticsearch.rb', line 16

def health
  get('/_cluster/health')
end

#node_concurrent_recoveries(num_recoveries = 2) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/elasticsearch/client/elasticsearch.rb', line 32

def node_concurrent_recoveries(num_recoveries = 2)
  data = {
    'transient' => {
      'cluster.routing.allocation.node_concurrent_recoveries' => num_recoveries
    }
  }.to_json

  put('/_cluster/settings', data)
end

#nodesObject



20
21
22
# File 'lib/elasticsearch/client/elasticsearch.rb', line 20

def nodes
  get('/_nodes')
end

#routing(disable = true) ⇒ Object



42
43
44
45
46
47
48
49
50
# File 'lib/elasticsearch/client/elasticsearch.rb', line 42

def routing(disable = true)
  data = {
    'transient' => {
      'cluster.routing.allocation.enable' => disable ? 'none' : 'all'
    }
  }.to_json

  put('/_cluster/settings', data)
end

#settingsObject



28
29
30
# File 'lib/elasticsearch/client/elasticsearch.rb', line 28

def settings
  get('/_cluster/settings')
end

#stateObject



24
25
26
# File 'lib/elasticsearch/client/elasticsearch.rb', line 24

def state
  get('/_cluster/state')
end

#statusObject



7
8
9
10
# File 'lib/elasticsearch/client/elasticsearch.rb', line 7

def status
  data = get('/_cluster/health')
  data['status']
end