Module: Elastic::Stats::ElasticClient
- Included in:
- KS, NaiveBayes::Predictor, NaiveBayes::Set
- Defined in:
- lib/elastic/stats/elastic_client.rb
Overview
Module to set up and manage the Elasticsearch client
Instance Attribute Summary collapse
- #client ⇒ Object
-
#index ⇒ Object
Returns the value of attribute index.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #analyze(options = {}) ⇒ Object
- #client_options ⇒ Object
- #client_options=(options = {}) ⇒ Object
- #search(options = {}) ⇒ Object
Instance Attribute Details
#client ⇒ Object
10 11 12 |
# File 'lib/elastic/stats/elastic_client.rb', line 10 def client @client ||= Elasticsearch::Client.new end |
#index ⇒ Object
Returns the value of attribute index.
8 9 10 |
# File 'lib/elastic/stats/elastic_client.rb', line 8 def index @index end |
#type ⇒ Object
Returns the value of attribute type.
8 9 10 |
# File 'lib/elastic/stats/elastic_client.rb', line 8 def type @type end |
Instance Method Details
#analyze(options = {}) ⇒ Object
26 27 28 |
# File 'lib/elastic/stats/elastic_client.rb', line 26 def analyze( = {}) client.indices.analyze({ index: index, type: type }.merge()) end |
#client_options ⇒ Object
14 15 16 |
# File 'lib/elastic/stats/elastic_client.rb', line 14 def @client_options ||= end |
#client_options=(options = {}) ⇒ Object
18 19 20 |
# File 'lib/elastic/stats/elastic_client.rb', line 18 def ( = {}) .update() end |
#search(options = {}) ⇒ Object
22 23 24 |
# File 'lib/elastic/stats/elastic_client.rb', line 22 def search( = {}) client.search({ index: index, type: type }.merge()) end |