ruby-on-rails - 未找到 uri 的处理程序 [///] 和方法 [POST]
问题描述
嗨,我正在使用 ruby-2.4.0 和 rails 5 开发一个 RoR 项目。我正在使用 elasticsearch 在我的应用程序中进行搜索。我有一个模型venue_details如下: -
class VenueDetail < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
settings index: {
number_of_shards: 1,
number_of_replicas: 0,
} do
mapping do
indexes :id, :index => :not_analyzed
indexes :venue_name, :type => 'string', :index => :analyzed
end
end
def self.search(params)
if params[:query].present?
tire.search(load: true) do
query { string "*#{params[:query]}*", default_operator: "AND" }
size 100
end
else
tire.search(load: true) do
query { string "*#{params[:term]}*", default_operator: "AND"}
size 100
end
end
end
end
我正在使用elasticsearch-5.1.2。我正在尝试使用命令重新索引场地详细信息,rake environment tire:import CLASS=VenueDetail FORCE=true
它会引发如下错误:-
There has been an error when creating the index -- elasticsearch returned:
400 : No handler found for uri [/venue_details] and method [POST]
请帮助我如何解决它。提前致谢。
解决方案
推荐阅读
- mysql - 如何使用参数进行登录和注册以防止sql注入?
- css - 字体真棒图标未显示
- python - 有效地从熊猫数据框中提取行,我必须在其中搜索列表中的元素
- python-2.7 - Openpyxl:如何使用 write_only 单元格和工作簿更改行高
- javascript - 如何根据javascript中的条件将属性添加到对象的属性?
- thunderbird - 为 Mozilla Thunderbird 实施自定义更新插件
- wordpress - 联系表格 7 显示已发送消息但未收到电子邮件
- r - Python中正则表达式字符串的警告
- django - 芹菜没有配置不同的队列
- html - 猫头鹰旋转木马导航箭头在一边