I am very new to programming and I have been doing a lot of research for how to incorporate the Elasticsearch-rails gem into my apps. However, I have come to a point where I don't know how to get it up and running within my app. This is what I've done so far.
- put
gem 'elasticsearch', '~> 1.0.5'
in my gemfile. - typed
gem install elasticsearch
in terminal
Now I see that I need to put the following code into my app files, but I'm not sure where it goes:
require 'elasticsearch'
And then what do I do with this code?:
client = Elasticsearch::Client.new log: true
client.transport.reload_connections!
client.cluster.health
client.search q: 'test'
# etc.
Also, I'm confused about the difference between the following gems:
gem 'elasticsearch', '~> 1.0.5
https://github.com/elasticsearch/elasticsearch-ruby
gem install elasticsearch-model elasticsearch-rails
https://github.com/elasticsearch/elasticsearch-rails
https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-model
Are the elasticsearch-model and elasticsearch-rails already in elasticsearch-ruby?
In some tutorials I see it mentioned that you need to install elasticsearch on your computer and then navigate to http://localhost:9200
to see if it's up and running. Can't I just have it run within my app instead of having it run on my computer?
Thanks in advance for any insight you can provide me.