Searchkick on Heroku is not working

486 views Asked by At

I deployed my app to heroku, add the bonsai addon for elasticsearch, and then I create a config var ELASTICSEARCH_URL with the url.

The class I am trying to index is Product.

I run:

heroku run rake searchkick:reindex CLASS=Product

And it works fine. But then when I open the app I get an error, and I read the logs and this is what I got:

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}):

Any ideas?

1

There are 1 answers

0
ascherman On BEST ANSWER

The problem was that I didn't have any Products in heroku. I created a product, then I run

heroku run rake searchkick:reindex CLASS=Product

And now I got it working