简体   繁体   English

如何在heroku上托管的ruby on rails项目中实现弹性搜索?

[英]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.

相关问题 如何使用Heroku上的Ruby on Rails项目从开发过渡到生产? - How do I move from development to production with my Ruby on Rails project on Heroku? 我如何创建从WordPress(驻留在wsynth上)到Heroku托管的Rails应用的301重定向? - How do I create 301 redirect from WordPress (hosted on wsynth) to a Rails app hosted on Heroku? 如何在我的heroku托管的Ruby on Rails Web应用程序中调试“应用程序错误”? - How can I debug a “Application Error” in my heroku hosted Ruby on Rails web application? 带有Heroku的Ruby on Rails 2:如何安装插件? - Ruby on Rails 2 with Heroku: how do I install plugins? Ruby on Rails:Heroku:如何安装我的宝石? - Ruby on Rails: Heroku: How do I get my gems installed? Ruby on Rails:如何在Heroku上运行自动rake任务 - Ruby on Rails: How do I run an automated rake task on Heroku Ruby on Rails 项目托管在 GitHub - Ruby on Rails Project Hosted on GitHub 如何实现Ruby on Rails网站的搜索层? - How to implement search layer for Ruby on Rails site? Ruby on Rails:如何实现搜索功能 - Ruby on Rails: How to implement search function Ruby on Rails:如何在我的Web应用程序中实现快捷键? - Ruby on Rails: How do I implement shortcut keys in my webapp?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM