I want to use ElasticSearch + Tire to search stored in MongoDB.
However, I'm getting the following error when I try to perform a search:
Tire::Search::SearchRequestFailed in SearchController#index
404 : {"error":"IndexMissingException[[events] missing]","status":404}
From what I understand, this tells me that the indexes are missing for the Event, even though I've told it to generate them when I ran db:setup
.
Model:
class Event
include Mongoid::Document
include Mongoid::Timestamps
include Tire::Model::Search
include Tire::Model::Callbacks
field :name, :type => String
field :description, :type => String
field :started_at => Time
field :ended_at => Time
def to_indexed_json
self.as_json
end
end
Controller:
def search
Event.tire.search(params[:q])
end
Any ideas on how to resolve this please?
field
definitions there. All in all, when you load the app, the should be created, unless it already exists. – Pennate