ruby-on-railselasticsearchelasticsearch-rails

Elasticsearch::Transport::Transport::Errors::NotFound ([404] {"error":{"root_cause":[{"type":"index_not_found_exception"


Not sure while working in local environment with elasticsearch i m getting this weird error, any help would me appreciated. thanks

Elasticsearch::Transport::Transport::Errors::NotFound ([404] {"error":{"root_cause":[{"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"invoices","index":"invoices"}],"type":"index_not_found_exception","reason":"no such index","resource.type":"index_or_alias","resource.id":"invoices","index":"invoices"},"status":404})


Solution

  • Fixed issue by indexing ES by running these commands at rails console: -

    Model.__elasticsearch__.create_index!
    Model.__elasticsearch__.create_index! force: true
    Model.import force: true