2

I have been using the gem chewy in my rails app, to create index and search in ElasticSearch. Previously, I was using elastic search version 5.6, now I would like to upgrade it to 7.7. When I try to create an index I am getting the below error. The upgraded chewy version that I am using in 5.1.0

Elasticsearch::Transport::Transport::Errors::BadRequest: [400] {"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_doc]: Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Root mapping definition has unsupported parameters:  [country : {value={}}] [city : {value={}}] [state : {value={}}]"}},"status":400}

However, it worked perfectly well with 5.6. I tried to find any change logs in chewy but couldn't come across any. Please help me understand where the issue is. Thanks

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Surya
  • 2,429
  • 1
  • 21
  • 42

2 Answers2

2

As Elastic Search Ninja has suggested, this is happening due to the removal of types in the latest version of elasticsearch.

As of today (19-Oct-2020) , Chewy does not support 7.x or 6.x

Ref: https://github.com/toptal/chewy/issues/609 and https://github.com/toptal/chewy/issues/673

It is recommended to use ES's official standard packages for ruby or rails. https://github.com/elastic/elasticsearch-ruby or https://github.com/elastic/elasticsearch-rails

Surya
  • 2,429
  • 1
  • 21
  • 42
1

This is happening due to the removal of types in the latest version of elasticsearch. You need to change your mapping and index definition in order to resolve the issue.

Also, refer schedule of removal types according to versions and what all steps are required if you want to migrate from 5.X to 7.7.

Amit
  • 30,756
  • 6
  • 57
  • 88
  • But looks like `chewy` does not support 6.x or 7.x :( – Surya Oct 17 '20 at 14:35
  • Yes, people have already raised feature requests but the owner isn't merging since it is backward incompatible. Sure, up voting your answer. But to handle indexing in rails app if there is any alternative please do let me know, thanks – Surya Oct 18 '20 at 04:13