我正在使用:Ruby版本2.4.0和Rails 5.2.3,带有CentOS 7的AWS Ec2实例 应用程序正在使用searchkiq gem进行Elasticsearch。
使用searchkiq的我的模型为:
class ThreeDGarment < ApplicationRecord
validates :three_d_model_id, :category_id, :pieces, :body, :fabric, :total_length, :chest, :waist, :hip, presence: true
has_many :three_d_garment_images, dependent: :destroy
has_many :tukabank_order_items, as: :itemable
has_one :garment_efm
has_one :garment_edm
has_one :garment_pattern
belongs_to :three_d_model
belongs_to :category
mount_uploader :thumbnail, ThreeDGarmentThumbnailUploader
validates_presence_of :thumbnail
## To add the functionality of elastic search
searchkick
## parameters `to be searched by elastic search
def search_data
{
category: category.try(:name),
chest: chest,
total_length: total_length,
waist: waist,
hip: hip,
body: body,
}
end
end
当我在生产模型的rails控制台中为Model ThreeDGarment重新编制索引时,会出现以下错误:
2.4.0 :014 > ThreeDGarment.reindex
Elasticsearch::Transport::Transport::Errors::BadRequest: [400]
{"error":{"root_cause":[{"type":"mapper_parsing_exception",
"reason":"Root mapping definition has unsupported parameters:
[three_d_garment : {_routing={}, dynamic_templates=[
{string_template={mapping={ignore_above=30000, type=keyword,
fields={analyzed={analyzer=searchkick_index, index=true, type=text}}},
match_mapping_type=string, match=*}}], properties={}}]"}],
"type":"mapper_parsing_exception","reason":"Failed to parse mapping
[_doc]: Root mapping definition has unsupported parameters:
[three_d_garment : {_routing={}, dynamic_templates=
[{string_template={mapping={ignore_above=30000, type=keyword,
fields={analyzed={analyzer=searchkick_index, index=true, type=text}}},
match_mapping_type=string, match=*}}], properties={}}]",
"caused_by":{"type":"mapper_parsing_exception",
"reason":"Root mapping definition has unsupported parameters:
[three_d_garment : {_routing={}, dynamic_templates=
[{string_template={mapping={ignore_above=30000, type=keyword,
fields={analyzed={analyzer=searchkick_index, index=true, type=text}}},
match_mapping_type=string, match=*}}], properties={}}]"}},"status":400}
我正在运行弹性搜索服务器:用于7.x软件包的Elasticsearch存储库,并且正在
上运行答案 0 :(得分:0)
删除旧版本的searchkiq gem,并将其更新为Gemfile中的以下版本:
gem 'searchkick', '~> 4.01'
此版本可与Elasticsearch 7.x配合使用
gem 'searchkick', '~> 3.1', '>= 3.1.2'
这适用于elasticseatch 6.x