module Elasticsearch::Rails2::Client::InstanceMethods

Public Instance Methods

client() click to toggle source

Get or set the client for a specific model instance

@example Get the client for a specific record and perform API request

@building = Building.first
@building.client.info
# => { "name" => "Node-1", ... }
# File lib/elasticsearch/rails2/client.rb, line 41
def client
  @client ||= self.class.client
end
client=(client) click to toggle source

Set the client for a specific model instance

@example Set the client for a specific record

@building = Building.first
@building.client = Elasticsearch::Client.new host: 'http://api.server:8080'
# File lib/elasticsearch/rails2/client.rb, line 52
def client=(client)
  @client = client
end