Heroku 上的 Searchkick 无法正常工作

Searchkick on Heroku is not working

我将我的应用程序部署到 heroku,为 elasticsearch 添加了 bonsai 插件,然后我使用 url.

创建了一个配置变量 ELASTICSEARCH_URL

我要索引的 class 是 Product

我运行:

heroku run rake searchkick:reindex CLASS=Product

而且效果很好。但是当我打开应用程序时出现错误,我阅读了日志,这就是我得到的:

Searchkick::InvalidQueryError ([400] {"error":{"root_cause":[{"type":"search_parse_exception","reason":"No mapping found for [created_at] in order to sort on"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query_fetch","grouped":true,"failed_shards":[{"shard":0,"index":"products_production_20170105030153240","reason":{"type":"search_parse_exception","reason":"No mapping found for [created_at] in order to sort on"}}]},"status":400}):

有什么想法吗?

问题是我在 heroku 中没有任何产品。我创建了一个产品,然后 运行

heroku run rake searchkick:reindex CLASS=Product

现在我开始工作了