Search code examples
ruby-on-railselasticsearchsearchkick

Destroying all information on elasticsearch and starting fresh


I recently attempted to use elasticsearch and search kick in a rails 4 application. I had generated a cluster with one index and I'd like to delete all information and start from scratch, however, I cannot seem to do so. When I start the ES server it is frozen with pending tasks trying to initialize shards.

I've tried brew remove elasticsearch and reinstalling I've tried spinning up the ES server and running: $ curl -XDELETE 'http://localhost:9200/_all' to no avail. It simply adds another pending task.

Any suggestions on how to wipe the slate clean and start from scratch?

*****EDIT*****

My problem came from having previously spun up an ES server on another branch with the same cluster name. This is what I believe caused an (for lack of understand the real cause/issue) endless loop of ES trying to initialize a new shard, failing, and retrying. Answer below to how I started completely fresh.


Solution

  • To wipe the slate clean I did the following:

    After $ brew install elasticsearch I ran $ brew info elasticsearch to gain the path to the config file.

    In the config.yml file I changed the name of the cluster, the name of the node, and the mlock setting to true per the advice of this seemingly recent and relevant video from ES: https://www.elastic.co/webinars/get-started-with-elasticsearch/?baymax=rtp&elektra=videos&storm=video1&iesrc=ctr

    If you're looking to start fresh, this worked perfectly for me.

    All other steps per the ES docs and searchkick docs work smashingly.