eleasticsearch在EC2中不使用Rails进行生产,而在使用Nginx进行生产时安装

问题描述 投票:0回答:1

我正在使用: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 ThreeDGar​​ment重新编制索引时,出现以下错误:

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存储库,并且正在运行于

ruby elasticsearch amazon-ec2 ruby-on-rails-5 seachkiq
1个回答
0
投票

删除旧版本的searchkiq gem,并将其更新为Gemfile中的以下版本:

gem 'searchkick', '~> 4.01'

此版本适用于elasticsearch 7.x

对于gem 'searchkick', '~> 3.1', '>= 3.1.2'这适用于elasticseatch 6.x

© www.soinside.com 2019 - 2024. All rights reserved.