module Elasticsearch::Model::ClassMethods

Public Instance Methods

client() click to toggle source

Get the client common for all models

@example Get the client

Elasticsearch::Model.client
=> #<Elasticsearch::Client:0x007f96a7d0d000... >
# File lib/elasticsearch/model.rb, line 132
def client
  @client ||= Elasticsearch::Client.new
end
client=(client) click to toggle source

Set the client for all models

@example Configure (set) the client for all models

Elasticsearch::Model.client = Elasticsearch::Client.new host: 'http://localhost:9200', tracer: true
=> #<Elasticsearch::Client:0x007f96a6dd0d80... >

@note You have to set the client before you call Elasticsearch methods on the model,

or set it directly on the model; see {Elasticsearch::Model::Client::ClassMethods#client}
# File lib/elasticsearch/model.rb, line 146
def client=(client)
  @client = client
end
settings() click to toggle source

Access the module settings

# File lib/elasticsearch/model.rb, line 177
def settings
  @settings ||= {}
end