toptal / chewy

High-level Elasticsearch Ruby framework based on the official elasticsearch-ruby client
MIT License
1.88k stars 366 forks source link

bundle gem chewy 7.2.x auto install gem elasticsearch 8.x ?? #866

Open namdv-1375 opened 1 year ago

namdv-1375 commented 1 year ago

i add gem file gem "chewy", "~> 7.2", ">= 7.2.2" -> run bundle -> gemlock installed, example:

elastic-transport (8.1.0)
      faraday (< 3)
      multi_json
    elasticsearch (8.4.0)
      elastic-transport (~> 8)
      elasticsearch-api (= 8.4.0)
    elasticsearch-api (8.4.0)
      multi_json
    elasticsearch-dsl (0.1.10)

while my computer is installing elasticsearch version 7.x so when running the command create index, e.x:

rescue Elasticsearch::Transport::Transport::Errors::NotFound
                            ^^^^^^^^^^^
from /usr/share/rvm/gems/ruby-3.1.2/gems/chewy-7.2.2/lib/chewy/index/actions.rb:88:in `rescue in delete'
Caused by Elasticsearch::UnsupportedProductError: The client noticed that the server is not Elasticsearch and we do not support this unknown product.
from /usr/share/rvm/gems/ruby-3.1.2/gems/elasticsearch-8.4.0/lib/elasticsearch.rb:115:in `verify_with_version_or_header'

Please, show me how to fix it, i want to use elastic ver 7.x Thanksssssssssssssssss!

gabriel commented 1 year ago

Elasticsearch::Transport was renamed to Elastic::Transport in 8.x

You can't use this chewy repo with 8.x out of the box.

I am experimenting with a fork that uses 8.x here: https://github.com/gabriel/chewy

benjaminwols commented 1 year ago

@konalegi Are there any plans to support the 8.x version of elastisearch by this gem?

konalegi commented 1 year ago

@benjaminwols I’m not sure exactly about it, let me take a look and get back with the answer. I’ll create a patch to lock chewy 7 to elastic 7 today to tomorrow

konalegi commented 1 year ago

@namdv-1375 please upgrade to chewy 7.2.6 it has fix for your issue. https://github.com/toptal/chewy/commit/e48f0918e9efde4142cbc0d94c4183b423ce9e27

mjankowski commented 1 year ago

@benjaminwols I’m not sure exactly about it, let me take a look and get back with the answer.

@konalegi any progress on this front? Were you able to review either the @gabriel repo with 8.x support, or any other approaches? If so, would you be open to a PR along the lines of what gabriel has there?

Separately - do you have a preference versioning-wise to do either a) a hard version bump to chewy 8.x which would require the ES 8.x gems (this is what gabriel fork does); or b) a softer bump where chewy allows but does not require 8.x gems, and still supports the 7.x gems (possible, but would need some conditional branches in code to detect the diff classes in the ES gems.

konalegi commented 9 months ago

@mjankowski Sorry for the long delay with a response. I was extremely busy and only now started looking at the transition into ES 8.x.

mjankowski commented 9 months ago

Thanks for the update, glad to hear you're looking at it.

konalegi commented 9 months ago

I've started my work here, https://github.com/toptal/chewy/pull/917, although need to confirm how we are going to release 8.x version