module Elasticsearch::Rails2::Client::ClassMethods
Contains an ‘Elasticsearch::Client` instance
Public Instance Methods
client()
click to toggle source
Get the client for a specific model class
@example Get the client for ‘Building` and perform API request
Building.client.cluster.health # => { "cluster_name" => "elasticsearch" ... }
# File lib/elasticsearch/rails2/client.rb, line 15 def client @client ||= Elasticsearch::Rails2.client end
client=(client)
click to toggle source
Set the client for a specific model class
@example Configure the client for the ‘Building` model
Building.client = Elasticsearch::Client.new host: 'http://api.server:8080' Building.search ...
# File lib/elasticsearch/rails2/client.rb, line 26 def client=(client) @client = client end