首页 > 解决方案 > 未找到 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]

请帮助我如何解决它。提前致谢。

标签: ruby-on-railselasticsearchtire

解决方案


推荐阅读