toptal / chewy

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

Support for elasticsearch 8.2 #847

Open mandarvaze opened 2 years ago

mandarvaze commented 2 years ago

Is your feature request related to a problem? Please describe.

Latest version of elasticsearch is 8.2 (As of early Jun 2022) Does latest version of chewy work with elasticsearch 8.2 - even if in limited fashion ?

Describe the solution you'd like

Chewy works with elasticsearch 8.2

Describe alternatives you've considered

If not, I'll need to use elastic search 7.17

Additional context

https://www.elastic.co/guide/en/elasticsearch/reference/current/release-highlights.html

mandarvaze commented 2 years ago

FWIW, official elasticsearch-ruby client seems to support 8.2 https://github.com/elastic/elasticsearch-ruby - so maybe chewy automatically works on elasticsearch 8.2 🤷‍♂️

gabriel commented 1 year ago

I have a fork experimenting with chewy on elasticsearch 8.6.0 here: https://github.com/gabriel/chewy

trey-mindtrip commented 1 year ago

Hmm, 9 months out from 8.X release, no news on support from this gem. Any comments from any leads as to the status of support/health of this gem going forward?

Also @gabriel, what's the state of your fork? In truth we are really only looking for the most basic operations (define an index schema, efficient insert, convenient query), nothing as fancy as the more automatic ORM-ish features.

Thanks for any info.

gabriel commented 1 year ago

The fork works fine for me on 8.6.0. The changes to get it to work are pretty minor: https://github.com/toptal/chewy/compare/master...gabriel:chewy:master

franck commented 1 year ago

Hi @gabriel, any change you could create a pull request for the main repo to make it works with 8.x ?

gabriel commented 1 year ago

It's a breaking change. Also, I'm not sure if there is some weird licensing stuff with 8.x.

eggplants commented 1 year ago

Note: Elasticsearch 7 will be EOL next month. (01 Aug 2023)

picandocodigo commented 10 months ago

Hi, I'm the current maintainer for the Elasticsearch Ruby Client. I'd love to help supporting Elasticsearch 8.x on chewy.

Since chewy currently uses version 7.13 of elasticsearch-ruby, enabling the compatibility mode could help when using Elasticsearch 8.x. This was added to elasticsearch-ruby in 7.13:

The Elasticsearch server version 8.0 is introducing a new compatibility mode that allows you a smoother upgrade experience from 7 to 8. In a nutshell, you can use the latest 7.x Elasticsearch client with an 8.x Elasticsearch server, giving more room to coordinate the upgrade of your codebase to the next major version.

If you want to leverage this functionality, please make sure that you are using the latest 7.x client and set the environment variable ELASTIC_CLIENT_APIVERSIONING to true. The client is handling the rest internally. For every 8.0 and beyond client, you’re all set! The compatibility mode is enabled by default.

This could be introduced as an option. The code in 7.13 is here. If say, version is added to the config file, chewy could check if it's 8 (as long as it's using elasticsearch-ruby 7.x) and add the following headers in that case:

'Accept' => 'application/vnd.elasticsearch+json; compatible-with=7',
'Content-Type' => 'application/vnd.elasticsearch+json; compatible-with=7'

Or that could be set up elsewhere in the code, like checking the version in the first request to Elasticsearch and set the headers if the client is on 7 and the server on 8.

If support for newer versions of elasticsearch-ruby were considered, chewy could potentially support both 7.x and 8.x by checking which one was installed and setting the class for Elastic::Transport and changing any code accordingly. A big advantage in the latest version of the 7.x branch is compatibility with both Faraday 1 and 2.

I'm not sure if there is some weird licensing stuff with 8.x.

elasticsearch-ruby is still released under the Apache License in 8.x.

Let me know if this is something that could be considered and how I can help. I can work on a Pull Request and/or continue @gabriel's work on the fork.

mjankowski commented 5 months ago

A big advantage in the latest version of the 7.x branch is compatibility with both Faraday 1 and 2.

Just saw this comment ... I think allowing any 7.x ES version from chewy 7.x would be a great stopgap here to be less restrictive on faraday, until chewy 8.x with full ES 8 support is ready. May open PR to this effect.

eggplants commented 1 week ago

Chewy v8 beta has been published :eyes: https://github.com/toptal/chewy/releases/tag/v8.0.0-beta