Elasticsearch :: Transport :: Transport :: Errors :: NotFound: [404]

I am using ElasticSearch as full text engine for my rails pet project for my model Post

. In my index action posts_controller.rb

:

    def index
        if params[:query]
            @posts = Post.search(params[:query]).page(params[:page]).records
        else
            @posts = Post.paginate(page: params[:page]).order('created_at DESC')  
        end
    end

      

Where, if a query parameter is present, it should filter the results and present them in index.html.erb

.

What happens I get

Elasticsearch::Transport::Transport::Errors::NotFound: [404] {"error":"IndexMissingException[[posts] missing]","status":404}

      

I ran bundle exec rake environment elasticsearch:import:model CLASS='Post'

it but still get the same error.

According to Marvin Gaia, what's going on?

+3


source to share


1 answer


Try:

bundle exec rake environment elasticsearch:import:model CLASS='Post' FORCE=true

      



Note FORCE=true

.

+4


source







All Articles