← homeProgramming (Програмування)

[Fix] Heroku / SearchBox addon - indexing error "The client is unable to verify that the server is Elasticsearch"

When configuring the SearchBox search add-on on Heroku, an error occurred while starting the indexing from the console. Loading production environment (Rails 7.0.4.3) irb(main):001:0> Document.__elasticsearch__.cre...

This content has been automatically translated from Ukrainian.
When configuring the SearchBox search add-on on Heroku, an error occurred while starting the indexing from the console.
Loading production environment (Rails 7.0.4.3)
irb(main):001:0> Document.__elasticsearch__.create_index! force: true
The client is unable to verify that the server is Elasticsearch. Some functionality may not be compatible if the server is running an unsupported product.
/app/vendor/bundle/ruby/3.2.0/gems/elasticsearch-8.17.1/lib/elasticsearch.rb:103:in `verify_elasticsearch’:ssupport this unknown product. (Elasticsearch::UnsupportedProductError)
The installed libraries were the latest versions (8):
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
The official documentation states:
Ensure you are using client version of 7 if you get error The client noticed that the server is not a supported distribution of Elasticsearch while connecting to your endpoint.
But it won't be possible to lock the versions of elasticsearch-model and elasticsearch-rails to 7, as they depend on elasticsearch 8 or 7.17 (which also does not suit us)
irb(main):001:0> Topic.__elasticsearch__.create_index! force: true
/app/vendor/bundle/ruby/3.2.0/gems/elasticsearch-7.17.11/lib/elasticsearch.rb:86:in `verify_with_version_or_header': The client noticed that the server is not a supported distribution of Elasticsearch. (Elasticsearch::UnsupportedProductError)
So the best option is to add elasticsearch to the Gemfile and lock it to the required version 7.
gem 'elasticsearch', '7.0.0'
gem 'elasticsearch-model', '7.0.0'
gem 'elasticsearch-rails', '7.0.0'
But it’s better to consider alternative add-ons on Heroku, like Bonsai. They use the latest versions of libraries with the necessary patches. Security above all.

🔥 More posts

All posts
What is PORO in Ruby?
Programming (Програмування)Dec 8, '24 12:46

What is PORO in Ruby?

In Ruby, the term PORO (Plain Old Ruby Object) is often mentioned, but what is it and why is it i...

What is CFB (Cipher Feedback)?
Programming (Програмування)Mar 21, '25 16:53

What is CFB (Cipher Feedback)?

CFB (short for Cipher Feedback) is one of the methods of data encryption that works on the princi...