如何在Heroku上设置弹性搜索? [英] How to setup elasticsearch on Heroku?

查看:170
本文介绍了如何在Heroku上设置弹性搜索?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序上执行了elasticsearch / searchkick,它的开发工作。我的弹性搜索/ searchkick实现的资源是GoRails和我成功安装弹性搜索。但是当我把它推到Heroku时,它给了我错误:


我们很抱歉,但出了问题。 p>

我做了英文日志,错误是:


16ms内完成500内部服务器错误(SearchKick:8.0ms |
ActiveRecord:0.0ms)



Faraday :: ConnectionFailed(Connection refused - connect(2)for
localhostport 9200): p>


解决方案

请尝试这个................

  Searchkick为Elasticsearch服务器使用ENV [ELASTICSEARCH_URL]。默认值为http:// localhost:9200。 
Heroku

选择一个附加组件:SearchBox,Bonsai或Elastic Cloud。 p>

#SearchBox

  heroku addons:create searchbox:starter 
heroku config:set ELASTICSEARCH_URL =`heroku config:get SEARCHBOX_URL`

#盆景

  heroku addons:create bonsai 
heroku config:set ELASTICSEARCH_URL =`heroku config

#找到

  heroku addons:create foundelasticsearch 
heroku config:set ELASTICSEARCH_URL =`heroku config:get FOUNDELASTICSEARCH_URL`
/ pre>

然后部署和重新索引:

  heroku run rake searchkick :reindex CLASS = Product 

请参考这篇文档 https://github.com/ankane/searchkick#dep更多信息
希望这将为您工作。谢谢!


I've implemented elasticsearch/searchkick on my app and it works on development. My resources for the elasticsearch/searchkick implementation is GoRails and I installed elasticsearch successfully. But when I pushed it on Heroku, it gave me the error:

"We're sorry, but something went wrong."

I did heroku logs and the errors are:

"Completed 500 Internal Server Error in 16ms (Searchkick: 8.0ms | ActiveRecord: 0.0ms)"

and

"Faraday::ConnectionFailed (Connection refused - connect(2) for "localhost" port 9200):"

解决方案

Please try this .................

Searchkick uses ENV["ELASTICSEARCH_URL"] for the Elasticsearch server. This defaults to http://localhost:9200.
Heroku

Choose an add-on: SearchBox, Bonsai, or Elastic Cloud.

# SearchBox

heroku addons:create searchbox:starter
heroku config:set ELASTICSEARCH_URL=`heroku config:get SEARCHBOX_URL`

# Bonsai

heroku addons:create bonsai
heroku config:set ELASTICSEARCH_URL=`heroku config:get BONSAI_URL`

# Found

heroku addons:create foundelasticsearch
heroku config:set ELASTICSEARCH_URL=`heroku config:get FOUNDELASTICSEARCH_URL`

Then deploy and reindex:

heroku run rake searchkick:reindex CLASS=Product

Please refer this documentation https://github.com/ankane/searchkick#deployment for more information. Hope this will work for you. Thanks!

这篇关于如何在Heroku上设置弹性搜索?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆