带有ElasticSearch的Searchkick返回“ Faraday :: ConnectionFailed:执行到期” [英] Searchkick with ElasticSearch returns "Faraday::ConnectionFailed: execution expired"

查看:194
本文介绍了带有ElasticSearch的Searchkick返回“ Faraday :: ConnectionFailed:执行到期”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用 searchkick gem和elasticsearch,在Rails 4.2.0应用程序上没有问题。我有一个使用searchkick的视频模型。

I've been using the searchkick gem with elasticsearch with no problems on a Rails 4.2.0 application. I have a single Video model using searchkick.

由于某些原因 rake searchkick:reindex:all 现在始终失败

For some reason rake searchkick:reindex:all is now failing consistently with:


重新索引视频...耙中止了! Faraday :: ConnectionFailed:执行
过期

Reindexing Video... rake aborted! Faraday::ConnectionFailed: execution expired

我最初是通过 brew install elasticsearch安装了Elasticsearch ,它返回:

I originally installed elasticsearch via brew install elasticsearch, which returns:


警告:elasticsearch-1.3.4已经安装

Warning: elasticsearch-1.3.4 already installed

弹性搜索安装/数据库是否已损坏?如果是这样,刷新它的最佳方法是什么?

Is it likely that my elasticsearch installation/database has become corrupted? If so, what is the best way to refresh it?

根据 https://www.elastic.co/guide/zh-CN/elasticsearch/reference/1.4/indices-delete-index.html I尝试 curl -XDELETE'http:// localhost:9200 / _all',但这不能解决错误。

As per https://www.elastic.co/guide/en/elasticsearch/reference/1.4/indices-delete-index.html I tried curl -XDELETE 'http://localhost:9200/_all' but this doesn't resolve the error.

当我将此代码部署到AWS时(以前都正常工作),在我的Mac上以及Elastic Beanstalk上都会发生此问题。

This problem occurs on my Mac, as well as Elastic Beanstalk when I deploy this code to AWS (both were previously working correctly).

推荐答案

通常经过数小时的奋斗,我在发布问题后几分钟找到了答案...

Typically after hours of struggling I found the answer minutes after posting the question...

根据 https://github.com/ankane/searchkick/issues/382 我添加了带有以下内容的初始化程序:

As per https://github.com/ankane/searchkick/issues/382 I added an initializer with:

Searchkick.client = Elasticsearch::Client.new(hosts: ["localhost:9200"], retry_on_failure: true, transport_options: {request: {timeout: 250}})

这似乎已经解决了问题。我会再报告一次。

which seems to have solved the problem. I'll report back if it recurs.

这篇关于带有ElasticSearch的Searchkick返回“ Faraday :: ConnectionFailed:执行到期”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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