Class: Elasticsearch::Resources::Configuration::Cluster

Inherits:
Settings
  • Object
show all
Defined in:
lib/elasticsearch/resources/configuration/cluster.rb

Defined Under Namespace

Classes: NullHostError

Instance Method Summary collapse

Instance Method Details

#clientObject



5
6
7
# File 'lib/elasticsearch/resources/configuration/cluster.rb', line 5

def client
  @client ||= Elasticsearch::Client.new(host: host)
end

#hostObject



19
20
21
# File 'lib/elasticsearch/resources/configuration/cluster.rb', line 19

def host
  @host ||= '127.0.0.1:9200'
end

#host=(host) ⇒ Object

Raises:



23
24
25
26
# File 'lib/elasticsearch/resources/configuration/cluster.rb', line 23

def host=(host)
  raise NullHostError.new if host.nil?
  @host = host
end

#index(key) ⇒ Object



13
14
15
16
17
# File 'lib/elasticsearch/resources/configuration/cluster.rb', line 13

def index(key)
  indexes[key.to_sym].tap do |t|
    yield(t) if block_given?
  end
end

#indexesObject



9
10
11
# File 'lib/elasticsearch/resources/configuration/cluster.rb', line 9

def indexes
  @indexes ||= default_indexes
end