При налаштуванні аддону пошуку SearchBox на Heroku сталась помилка під час запуску індексації з консолі.
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)
Встановленні були ліби останніх версій (8):
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
Офіційна документація каже:
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.
Але локнути версії elasticsearch-model та elasticsearch-rails на 7 не вийде. вони залежуть від elasticsearch 8 аб 7.17 (яка нам теж не підходить)
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)
Тож найкращий варіант це додати elasticsearch до Gemfile та локнути його на потрібну нам 7 версію.
gem 'elasticsearch', '7.0.0'
gem 'elasticsearch-model', '7.0.0'
gem 'elasticsearch-rails', '7.0.0'
Але краще розглянути альтернативні аддони на Heroku, типу Bonsai. Які використовують останні версії бібліотек з потрібними патчами. Безпека понад усе.