简体   繁体   中英

How do I implement elastic search in a ruby on rails project hosted on heroku?

My plan is to run elastic search on a separate linux server as a web service. Then I will make calls to it directly from my app to search with strings or other unstructured data. What I don't understand is will this basically replace my database for certain objects or at the time that the object is created, should I index it's ID, object type and tags in elastic search as well as simultaneously save the entire object to my database? Then I can make a call to the web service to get the object's ID and then query my database based on that ID to retrieve the actual object?

Is this the right way to think about using elastic search?

You can use ElasticSearch in both ways: using it as a primary storage, or as a search engine. The Tire rubygem allows you to do that, see the README.

With ElasticSearch, it makes more sense to use it as a source for data, since it can index and store arbitrary JSON. You may want to save your data into separate storage for backup and redundancy.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM