ElasticSearch: Error while upgrading Chewy/ElasticSearch version

641 views Asked by At

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

2

There are 2 answers

2
Amit On BEST ANSWER

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.

0
Surya On

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