我正在尝试在 rails 项目中运行弹性搜索,但出现错误:
[ERROR] 创建索引时出现错误——elasticsearch 返回:
405:{"error":"URI [/articles] 和方法 [POST] 的 HTTP 方法不正确,允许:[GET、DELETE、PUT、HEAD]","status":405}
[导入] 删除索引“文章” [导入] 使用映射创建索引“文章”:
{"article":{"properties":{"title":{"type":"string"},"category_name":{"boost":10,"type":"string"}}}}
[ERROR] 创建索引时出现错误——Elasticsearch 返回:
405:{"error":"URI [/articles] 和方法 [POST] 的 HTTP 方法不正确,允许:[GET、DELETE、PUT、HEAD]","status":405}
这是我的文章模型的样子:
include Tire::Model::Search
include Tire::Model::Callbacks
mapping do
indexes :id, type: 'integer'
# indexes :author_id, type: 'integer'
indexes :title
indexes :category_name, boost: 10
indexes :content # analyzer: 'snowball'
indexes :created_at, type: 'date'
indexes :published_comments, type: 'integer'
end
def self.search(params)
tire.search(page: params[:page], per_page: 2) do
query do
boolean do
must { string params[:query], default_operator: …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Windows上为Ruby on Rails 3.1安装Publify Web博客CMS 6.0.9.
每次我尝试bundle install Publify时,我都会在安装bluecloth gem时收到相同的错误消息:
C:\Users\Lunasea\Downloads\typo-6.0.9>gem install bluecloth
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing bluecloth:
ERROR: Failed to build gem native extension.
C:/RailsInstaller/Ruby1.9.2/bin/ruby.exe extconf.rb
checking for srand()... yes
checking for random()... no
checking for rand()... yes
checking for bzero() in string.h,strings.h... no
checking for strcasecmp()... yes
checking for strncasecmp()... yes
checking for mkdio.h... yes
checking for ruby/encoding.h... yes
creating extconf.h
creating Makefile …Run Code Online (Sandbox Code Playgroud)