试图通过Elasticsearch和Tire在Heroku生产中部署Rails应用。
Heroku盆景插件已添加,但仍在运行此命令后
heroku run rake environment tire:import CLASS=Property FORCE=true
出现错误:
400 : No handler found for uri [/properties] and method [POST]
请帮助调试此错误?
这是我的属性(property)模型:
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
这是我的盆景配置config / initializers / bonsai.rb
ENV['ELASTICSEARCH_URL'] = ENV['BONSAI_URL']
最佳答案
这已经是Elasticsearch错误消息,因此您可以访问它-仅查询不正确。
我在这里大胆猜测:您缺少type
;至少这是(一种)可能会遇到此错误的可能性。
$ curl -XPOST localhost:9200/properties/ -d '{"foo": "bar"}'
No handler found for uri [/properties/] and method [POST]
PS:轮胎不是现在不保养/不赞成使用吗?我认为最好的选择应该是https://github.com/elastic/elasticsearch-rails
关于elasticsearch - 找不到uri [/ModelName]和方法[POST]的处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45690027/