module Elastic::Stats::ElasticClient
Module to set up and manage the Elasticsearch client
Attributes
client[W]
index[RW]
type[RW]
Public Instance Methods
analyze(options = {})
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 26 def analyze(options = {}) client.indices.analyze({ index: index, type: type }.merge(options)) end
client()
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 10 def client @client ||= Elasticsearch::Client.new client_options end
client_options()
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 14 def client_options @client_options ||= default_options end
client_options=(options = {})
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 18 def client_options=(options = {}) client_options.update(options) end
search(options = {})
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 22 def search(options = {}) client.search({ index: index, type: type }.merge(options)) end
Private Instance Methods
default_options()
click to toggle source
# File lib/elastic/stats/elastic_client.rb, line 32 def default_options { url: ENV['ELASTICSEARCH_URL'] } end