elasticsearch - 找不到uri [/ModelName]和方法[POST]的处理程序

标签 elasticsearch heroku ruby-on-rails-5 tire

试图通过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/

相关文章:

cron - 如何使用默认队列在本地查看我的 sidekiq 控制台输出?

ruby-on-rails - Ruby on Rails - 验证和更新/创建多个对象

bash - 无法更新 Elasticsearch 中的映射

elasticsearch - 使用 golang 包 'elastic' 中的 BulkIndexRequest

ruby-on-rails-3 - PostgreSQL 查询在本地 (9.x) 工作,但在 Heroku (8.x) 上给出语法错误

grails - 无法在Heroku上部署我的Grails 3应用

mysql - 在一个 Controller 中调用两个相互依赖的模型进行 View

elasticsearch - Elasticsearch 接缝,可在全文搜索过程中使用孤立的搜索词对结果进行优先级排序

elasticsearch - Elasticsearch提前查询优化

javascript - 使用 GitLab 持续部署 NodeJS