ruby-on-rails – 当我停止rails服务器时,我的弹性搜索索引会发生什么?

栏目: Ruby · 发布时间: 7年前

内容简介:我很高兴在Rails应用程序中使用Elasticsearch并使用耐嚼的gem来实现它.当我通过rails s在开发模式下运行rails应用程序时,然后通过elasticsearch命令运行Elasticsearch并运行rake chewy:reset:all为我的数据创建索引.一切正常,但是如果我重新启动服务器,我必须运行rake chewy:reset:all命令再次重建索引,否则我收到错误.重启服务器时索引会发生什么?它在服务器停止时被销毁了吗?我对Elasticsearch的功能不是很熟悉,所以我

我很高兴在Rails应用程序中使用Elasticsearch并使用耐嚼的gem来实现它.当我通过rails s在开发模式下运行rails应用程序时,然后通过elasticsearch命令运行Elasticsearch并运行rake chewy:reset:all为我的数据创建索引.

一切正常,但是如果我重新启动服务器,我必须运行rake chewy:reset:all命令再次重建索引,否则我收到错误.重启服务器时索引会发生什么?它在服务器停止时被销毁了吗?

我对Elasticsearch的功能不是很熟悉,所以我很欣赏任何人对幕后发生的事情有所了解.

我从来没有使用过Chewy,但是如果你在config / initializers / chewy.rb中加上“Chewy.settings = {prefix:’test’}”来判断它们的文档,那么它的前缀将是’test’,也是在开发中.当然,我不知道你是否把它放在了哪里.

另请注意,黄瓜倾向于在开发模式下运行测试( https://github.com/cucumber/cucumber-rails/issues/222 ).

因此,请尝试从代码中删除“Chewy.settings = {prefix:’test’}”,然后在chewy.yml文件中添加以下内容:

# config/chewy.yml
cucumber:
  host: 'localhost:9200'
  prefix: 'test'

然后将其添加到您的黄瓜env.rb文件中:

ENV["RAILS_ENV"] ||= 'cucumber'

并尝试用耙黄瓜再次运行黄瓜

翻译自:https://stackoverflow.com/questions/31201517/what-happens-to-my-elasticsearch-index-when-i-stop-rails-server


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Foundation Web Standards

Foundation Web Standards

Jonathan Lane、Steve Smith / Friends of ED / 21st July 2008 / $34.99

Foundation Web Standards explores the process of constructing a web site from start to finish. There is more to the process than just knowing HTML! Designers and developers must follow a proper proces......一起来看看 《Foundation Web Standards》 这本书的介绍吧!

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具