toptal / chewy

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

Prepare 7.0.1 release with skipped ES cluster version memoization for search requests #792

Closed rabotyaga closed 3 years ago

rabotyaga commented 3 years ago

The “total hits” counter is an integer for ES versions < 7 and an object (hash) for the versions starting from 7.0.0. Elasticsearch added a special option, rest_total_hits_as_int, to ease the upgrade, that could be appended to any request and results in the old “total hits” format. Unfortunately, this option is not recognized by ES versions prior to 7.0.0, which means that we have to check the version to decide if we need this option.

Normally Chewy does memoization of the current ES version, but this might be inappropriate for the upgrade, as the version changes live.

Release the v7.0.1 Chewy version to allow dynamically detect the current Elasticsearch version. More details in the Migration Guide.


Before submitting the PR make sure the following are checked:

dalthon commented 3 years ago

@rabotyaga, don't you think that it would be nice to keep this memoization by default and only disable it with some configuration? The issue you described seem to be a very rare case that in order to be handled puts an extra burden in all requests

rabotyaga commented 3 years ago

@rabotyaga, don't you think that it would be nice to keep this memoization by default and only disable it with some configuration? The issue you described seem to be a very rare case that in order to be handled puts an extra burden in all requests

@dalthon You're absolutely right. And this configuration is release 7.0.1. Please take a look at https://github.com/toptal/chewy/pull/792/files#diff-134d08723ee8d2712d2f3250f8936bda26c620b022ec5d7003b3c06b114938c0R20.

rabotyaga commented 3 years ago

We don't need to actually merge this, the release is published from the tag: https://github.com/toptal/chewy/releases/tag/v7.0.1