webber
webber

Reputation: 23

No handler found for uri [/ModelName] and method [POST]

Trying to deploy rails app on heroku production with Elasticsearch and Tire. Heroku bonsai addon is added but still after running this command

heroku run rake environment tire:import CLASS=Property FORCE=true

getting error:

400 : No handler found for uri [/properties] and method [POST]

Please help to debug this error?

this is my property model:

class Property < ApplicationRecord
 include Tire::Model::Search
 include Tire::Model::Callbacks

  mapping do
   indexes :id, type: 'integer'
   indexes :country
   indexes :city
   indexes :province
   indexes :holding_type
   indexes :price, boost: 10
  indexes :created_at, type: 'date'
 end
end

this is my bonsai configuration config/initializers/bonsai.rb

ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']

Upvotes: 2

Views: 5660

Answers (1)

xeraa
xeraa

Reputation: 10859

This is already an Elasticsearch error message, so you are reaching it — only your query isn't correct.

I'm taking a wild guess here: You're missing the type; at least that's (one) possibility how to run into this error.

$ curl -XPOST localhost:9200/properties/ -d '{"foo": "bar"}'
No handler found for uri [/properties/] and method [POST]

PS: Isn't tire unmaintained / deprecated by now? I think the best alternative should be https://github.com/elastic/elasticsearch-rails

Upvotes: 0

Related Questions