If you’ve ever used Heroku’s low cost staging plan for Bonsai Elasticsearch you may have
ran into the following error:
reached maximum index count for current plan.
Since in most cases your staging indices aren’t as critical as say production (don’t use the fix below in production, please!), you can safely follow the procedure below for removing and reindexing your search enabled models.
Find your Elasticsearch URL
First you’ll need to find your Elasticsearch url. If you are using the Bonsai addon from Heroku you can do so in your terminal with:
If you don’t know what your environment variable is for BONSAI then you’ll need
to go into Heroku’s web UI and look at the config variables for it. It should
be in the format of
Delete all available indices
The next step is to remove all the available Elasticsearch indices.
WARNING DO NOT RUN THIS IN PRODUCTION! PLEASE, PLEASE, PLEASE DON’T DO THIS.
We offer a low cost staging plan for development and testing - Heroku
You can read more on this in Elasticsearch’s documentation. This can be accomplished via cURL, which you’ll also need installed, from the following:
Reindex all search enabled models
Lastly, we need to reindex all of your available models. If you are using Searchkick you can accomplish this by running the following command. This will run through all of your searchkick models 1-by-1 and reindex them. Otherwise, you’ll need to reindex your content based on whatever method you have configured.
That’s it! You now have removed all the current indices and reindexed with new ones. Start searching!