我的rails应用程序有一个“实时测试”环境,它允许我们使用接近实际的生产设置测试我们的应用程序(电子邮件是真实发送的等等)
我在这个“实时测试”网站上添加了一些按钮,可以让我们快速清除一个集合(即从MongoDB集合中删除所有文档)
def purge
if Rails.env.production?
should_not_happen(severity: :armageddon)
else
Company.unscoped do
Company.all.each(&:destroy)
end
Utility.seed
flashy(:info, 'company XXX restored')
redirect_back
end
end
ElasticSearch的问题越来越严重。第一次调用这个清除方法时,它运行正常,我有一些错误
Elasticsearch::Transport::Transport::Errors::NotFound in MyController#purge
如果我在浏览器上点击几次刷新,2-3次请求最终被接受,但我再次遇到同样的问题:
# 1st time executing purge action : Works
# 2nd time : [404] {"found":false,"_index":"professionals-test","_type":"employee","_id":"57221655f5ae457700b464a2","_version":4}
# 3rd time : [404] {"found":false,"_index":"professionals-test","_type":"employee","_id":"57221655f5ae457700b464a5","_version":6}
# 4th time : [404] {"found":false,"_index":"professionals-test","_type":"employee","_id":"57221655f5ae457700b464a7","_version":4}
# 5th Time : Works
# 6th refresh : Again errors....
我正在使用AWS ElasticSearch服务和经典的elasticsearch ruby gems。