[英]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. 我的计划是在单独的Linux服务器上将弹性搜索作为Web服务运行。 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?
我不明白的是,这是否会基本替换某些对象或创建对象时的数据库,我应该在弹性搜索中为它的ID,对象类型和标签建立索引,同时将整个对象保存到我的数据库中? 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?
然后,我可以调用Web服务以获取对象的ID,然后基于该ID查询数据库以检索实际的对象?
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. 您可以通过两种方式使用ElasticSearch:将其用作主要存储或用作搜索引擎。 The Tire rubygem allows you to do that, see the README.
Tire rubygem允许您执行此操作,请参阅自述文件。
With ElasticSearch, it makes more sense to use it as a source for data, since it can index and store arbitrary JSON. 使用ElasticSearch,将其用作数据源更加有意义,因为它可以索引和存储任意JSON。 You may want to save your data into separate storage for backup and redundancy.
您可能需要将数据保存到单独的存储中,以进行备份和冗余。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.