2017-08-15 109 views
2

尝试在Elasticsearch和Tire上部署heroku生产中的rails应用程序。 Heroku的盆景插件添加,但仍运行此命令未找到处理uri [/ ModelName]的处理程序和方法[POST]

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

收到错误后:

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

请帮助调试这个错误?

这是我的财产型号:

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 

这是我的盆景配置配置/初始化/ bonsai.rb

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

回答

0

这已经是一个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

+0

$ curl -XPUT localhost:9200/properties- works! – webber

+0

是的,这会创建索引 – xeraa

相关问题