简体   繁体   English

带有 ElasticSearch 7.1 重新索引错误的 Rails 5.1

[英]Rails 5.1 with ElasticSearch 7.1 reindex error

I am facing some issue while run this command on Rails 5 console .Rails 5 控制台上运行此命令时,我遇到了一些问题。

:017 > User.reindex

I have some data in users table我在用户表中有一些数据

 :012 >   User.all
  User Load (10.3ms)  SELECT  "users".* FROM "users" LIMIT $1  [["LIMIT", 11]]
 => #<ActiveRecord::Relation [#<User id: 1, email: "test@gmai.com", first_name: "test", last_name: "test", parent_id: nil, created_at: "2019-06-17 05:50:15", updated_at: "2019-06-17 09:27:56", role: "pm_lead", is_approved: true, phone: nil, country_code: nil, initials: nil, theme_code: "#4fa399", profile_pic: nil, is_guest: false, guest_migrated: false, projects_count: 0, is_archived: false, office: nil, department: nil, designation: nil, partner_id: 1>]> 

elasticSearch error:弹性搜索错误:

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [user : {_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={name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, last_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, first_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [user : {_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={name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, last_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, first_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [user : {_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={name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, last_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}, first_name={ignore_above=30000, type=keyword, fields={analyzed={analyzer=searchkick_index, index=true, type=text}, text_middle={analyzer=searchkick_text_middle_index, index=true, type=text}}}}}]"}},"status":400}

I got the solution of my problem.我得到了我的问题的解决方案。 Just update the searchkick gem version version 3.1 to 4.01.只需将searchkick gem 版本 3.1 更新到 4.01。

-    searchkick (3.1.0)
-      activemodel (>= 4.2)
-      elasticsearch (>= 5)
+    searchkick (4.0.2)
+      activemodel (>= 5)
+      elasticsearch (>= 6)

gem 'searchkick', '~> 4.01' works with elasticseatch 7.x gem 'searchkick', '~> 4.01'适用于 elasticseatch 7.x

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM