From 14b6b1d1abe44a92b0d8a115d468982d9397f0ce Mon Sep 17 00:00:00 2001 From: Dalton Pinto Date: Thu, 11 Feb 2021 18:29:11 +0100 Subject: [PATCH 01/15] Explain briefly the existence of `outdated_sync_field` at README (#756) Explain briefly the existence of `outdated_sync_field` at README Co-authored-by: ramazan Co-authored-by: Ivan Rabotyaga --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f045aafcd..b15485bf2 100644 --- a/README.md +++ b/README.md @@ -1028,7 +1028,7 @@ rake chewy:update[-users,places#city] # updates every index in the application e #### `chewy:sync` -Provides a way to synchronize outdated indexes with the source quickly and without doing a full reset. +Provides a way to synchronize outdated indexes with the source quickly and without doing a full reset. By default field `updated_at` is used to find outdated records, but this could be customized by `outdated_sync_field` as described at [Chewy::Type::Syncer](lib/chewy/type/syncer.rb). Arguments are similar to the ones taken by `chewy:update` task. It is possible to specify a particular type or a whole index. From 7a2cb01791d8a8c28dd90da66a8c1e2b41a32302 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 09:36:47 +0200 Subject: [PATCH 02/15] Fix the changelog headings --- CHANGELOG.md | 140 ++++++++++++++++++++++++++------------------------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4aa390fcc..a6610e6d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,27 +1,29 @@ -# master +# Changelog -# Version 6.0.0 (2021-02-11) +## master (unreleased) -## Breaking changes +## Version 6.0.0 (2021-02-11) + +### Breaking changes * [#743](https://github.com/toptal/chewy/pull/743): Elasticsearch 6.x support added. See [migration guide](migration_guide.md) & ES [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html). Removed legacy DSL support. Removed support for ES < 5 ([@mrzasa][], [@konalegi][], [@rabotyaga][]) -## Bug fixes +### Bug fixes * [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) * [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) * [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) -## Changes +### Changes * [#751](https://github.com/toptal/chewy/pull/751): Add [Multi Search API](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-multi-search.html) support ([@mpeychich][], [@dalthon][]) * [#755](https://github.com/toptal/chewy/pull/755): `attribute_highlights` returns an array of highlights ([@musaffa][], [@dalthon][]) * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading ([@TikiTDO][], [@dalthon][]) * [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on rspec* gems after `rspec-mocks` 3.10.2 is released ([@rabotyaga][]) -# Version 5.2.0 (2021-01-28) +## Version 5.2.0 (2021-01-28) -## Changes +### Changes * [#734](https://github.com/toptal/chewy/pull/734): Add support for Ruby 3 ([@lowang][]) * [#735](https://github.com/toptal/chewy/pull/735): Correct deprecation warning for Elasticsearch 5.6 to 6: empty query for`_delete_by_query`, delete by alias, `index_already_exists_exception` renaming ([@bhacaz][]) @@ -35,21 +37,21 @@ * [#711](https://github.com/toptal/chewy/pull/711): Setup CI on CircleCI ([@mrzasa][]) * [#710](https://github.com/toptal/chewy/pull/710): Fix deprecation warning for contructing new BigDecimal ([@AlexVPopov][]) -# Version 5.1.0 (2019-09-24) +## Version 5.1.0 (2019-09-24) -## Breaking changes +### Breaking changes * [#657](https://github.com/toptal/chewy/pull/657): Add support for multiple indices in request ([@pyromaniac][]) * [#647](https://github.com/toptal/chewy/pull/647): Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters ([@mattzollinhofer][]) -## Changes +### Changes * [#606](https://github.com/toptal/chewy/pull/606): Speed up imports when `bulk_size` is specified ([@yahooguntu][]) * [#682](https://github.com/toptal/chewy/pull/682): Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions` ([@dck][]) -# Version 5.0.0 (2018-02-13) +## Version 5.0.0 (2018-02-13) -## Breaking changes +### Breaking changes * Try to align the gem version with the ElasticSearch version we support * `Chewy.default_field_type` is `text` now. @@ -57,7 +59,7 @@ * Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields. * [#626](https://github.com/toptal/chewy/pull/626): Don't underscore suggested index name ([@dm1try][]) -## Changes +### Changes * [#598](https://github.com/toptal/chewy/pull/598): `pipeline` import option support ([@eManPrague][]) * [#625](https://github.com/toptal/chewy/pull/625): Proper Rails check ([@nattfodd][]) @@ -68,32 +70,32 @@ * [#565](https://github.com/toptal/chewy/pull/565): Fixed some Sequel deprecation warnings ([@arturtr][]) * [#577](https://github.com/toptal/chewy/pull/577): Fixed some Sequel deprecation warnings ([@matchbookmac][]) -## Bugfixes +### Bugfixes * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error ([@yahooguntu][]) * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method ([@heartfulbird][]) -# Version 0.10.1 +## Version 0.10.1 -## Changes +### Changes * [#558](https://github.com/toptal/chewy/pull/558): Improved parallel worker titles -## Bugfixes +### Bugfixes * [#557](https://github.com/toptal/chewy/pull/557): Fixed request strategy initial debug message * [#556](https://github.com/toptal/chewy/pull/556): Fixed will objects paginated array initialization when pagination was not used * [#555](https://github.com/toptal/chewy/pull/555): Fixed fields symbol/string value * [#554](https://github.com/toptal/chewy/pull/554): Fixed root field value proc -# Version 0.10.0 +## Version 0.10.0 -## Breaking changes +### Breaking changes * Changed behavior of `Chewy::Index.index_name`, it doesn't cache the values anymore. * Journal interfaces, related code and rake tasks were completely refactored and are not compatible with the previous version. -## Changes +### Changes * [#543](https://github.com/toptal/chewy/pull/543): Less noisy strategies logging ([@Borzik][]) * Parallel import and the corresponding rake tasks. @@ -116,9 +118,9 @@ * [#467](https://github.com/toptal/chewy/pull/467): Bulk indexing optimizations with new additional options ([@eproulx-petalmd][]) * [#438](https://github.com/toptal/chewy/pull/438): Configurable sidekiq options ([@averell23][]) -# Version 0.9.0 +## Version 0.9.0 -## Changes +### Changes * [#443](https://github.com/toptal/chewy/pull/443): Add `preference` param to Query ([@menglewis][]) * [#417](https://github.com/toptal/chewy/pull/417): Add the `track_scores` option to the query; `_score` to be computed and tracked even when there are no `_score` in sort. ([@dmitry][]) @@ -134,16 +136,16 @@ * Witchcraft™ supports dynamically generated procs with variables from closure. * Added `Query#preference` for specifying shard replicas to query against. ([@menglewis][]) -## Bugfixes +### Bugfixes * [#415](https://github.com/toptal/chewy/pull/415): `.script_fields` method in the Index class ([@dmitry][]) * [#398](https://github.com/toptal/chewy/pull/398): Fix routing_missing_exception on delete with parent missing ([@guigs][]) * [#385](https://github.com/toptal/chewy/pull/385): Sequel custom primary keys handling fix ([@okliv][]) * [#374](https://github.com/toptal/chewy/pull/374): Bulk import fixes ([@0x0badc0de][]) -# Version 0.8.4 +## Version 0.8.4 -## Changes +### Changes * Brand new import `:bulk_size` option, set desired ElasticSearch bulk size in bytes * Witchcraft™ technology @@ -159,7 +161,7 @@ * Accessing types with methods is deprecated. Use `MyIndex::MyType` constant reference instead of `MyIndex.my_type` method. * [#294](https://github.com/toptal/chewy/pull/294): Sequel adapter improvements ([@mrbrdo][]) -## Bugfixes +### Bugfixes * [#325](https://github.com/toptal/chewy/pull/325): Mongoid atomic strategy fix * [#324](https://github.com/toptal/chewy/pull/324): Method missing fix ([@jesjos][]) @@ -167,18 +169,18 @@ * [#306](https://github.com/toptal/chewy/pull/306): Better errors handling in strategies ([@barthez][]) * [#303](https://github.com/toptal/chewy/pull/303): Assets strategies silencer fix for Rails 5 API mode ([@clupprich][]) -# Version 0.8.3 +## Version 0.8.3 -## Breaking changes: +### Breaking changes: * `Chewy.atomic` and `Chewy.urgent_update=` methods was removed from the codebase, use `Chewy.strategy` block instead. * `delete_from_index?` hook is removed from the codebase. -## Changes +### Changes * Sequel support completely reworked to use common ORM implementations + better sequel specs covarage. -## Bugfixes +### Bugfixes * Sequel objects transactional destruction fix * Correct Rspec mocking framework checking ([@mainameiz][]) @@ -186,9 +188,9 @@ * Safe unsubscribe on import ([@marshall-lee][]) * Correct custom assets path silencer ([@davekaro][]) -# Version 0.8.2 +## Version 0.8.2 -## Changes +### Changes * ActiveJob strategy by [@mkcode][] * Async strategies tweak ([@AndreySavelyev][]) @@ -200,23 +202,23 @@ * Multiple grammar fixes ([@henrebotha][]) * Ability to pass a proc to `update_index` to define updating index dynamically ([@SeTeM][]) -## Bugfixes +### Bugfixes * Fixed transport logger and tracer configuration -# Version 0.8.1 +## Version 0.8.1 -## Bugfixes +### Bugfixes * Added support of elasticsearch-ruby 1.0.10 -# Version 0.8.0 +## Version 0.8.0 -## Breaking changes: +### Breaking changes: * `:atomic` and `:urgent` strategies are using `import!` method raising exceptions -## Changes +### Changes * Crutches™ technology * Added `.script_fields` chainable method to query ([@ka8725][]) @@ -225,14 +227,14 @@ * `:sidekiq` async strategy (inspired by [@sharkzp][]) * Added `Query#search_type` for `search_type` request option setup ([@marshall-lee][]) -## Bugfixes +### Bugfixes * Rails 4.2 migrations are not raising UndefinedUpdateStrategy anymore on data updates * Mongoid random failing specs fixes ([@marshall-lee][]) -# Version 0.7.0 +## Version 0.7.0 -## Breaking changes: +### Breaking changes: * `Chewy.use_after_commit_callbacks = false` returns previous RDBMS behavior in tests * ActiveRecord import is now called after_commit instead of after_save and after_destroy @@ -265,7 +267,7 @@ end ``` -## Changes +### Changes * Multiple enhancements by [@DNNX][] * Added `script_fields` to search criteria ([@ka8725][]) @@ -306,61 +308,61 @@ ``` * Implemented basic named scopes -## Bugfixes +### Bugfixes * `script_score` allow options ([@joeljunstrom][]) * Chewy indexes eaged loading fixes ([@leemhenson][]) * `Chewy::Index.import nil` imports nothing instead of initial data -# Version 0.6.2 +## Version 0.6.2 -## Changes +### Changes * document root id custom value option ([@baronworks][]) -## Bugfixes +### Bugfixes * Removed decay function defaults ([@Linuus][]) * Correct config file handling in case of empty file -# Version 0.6.1 +## Version 0.6.1 -## Changes +### Changes * `min_score` query option support ([@jshirley][]) * `Chewy::Query#find` method for finding documents by id -# Version 0.6.0 +## Version 0.6.0 -## Changes +### Changes * Mongoid support YaY! ([@fabiotomio][], [@leemhenson][]) * `urgent: true` option for `update_index` is deprecated and will be removed soon, use `Chewy.atomic` instead * `timeout` and `timed_out` support ([@MarkMurphy][]) * will_paginate support ([@josecoelho][]) -## Bugfixes +### Bugfixes * All the query chainable methods delegated to indexes and types (partially [@Linuus][]) -# Version 0.5.2 +## Version 0.5.2 -## Breaking changes: +### Breaking changes: * `Chewy::Type::Base` removed in favour of using `Chewy::Type` as a base class for all types -## Changes +### Changes * `Chewy.massacre` aliased to `Chewy.delete_all` method deletes all the indexes with current prefix -## Bugfixes: +### Bugfixes: * Advanced type classes resolving ([@inbeom][]) * `import` ignores nil -# Version 0.5.1 +## Version 0.5.1 -## Changes: +### Changes: * `chewy.yml` Rails generator ([@jirikolarik][]) * Parent-child mappings feature support ([@inbeom][]) @@ -370,20 +372,20 @@ * Rspec 3 `update_index` matcher support ([@jimmybaker][]) * Implemented function scoring ([@averell23][]) -## Bugfixes: +### Bugfixes: * Indexed eager-loading fix ([@leemhenson][]) * Field type deriving nested type support fix ([@rschellhorn][]) -# Version 0.5.0 +## Version 0.5.0 -## Breaking changes: +### Breaking changes: * 404 exception (IndexMissingException) while query is swallowed and treated like an empty result set. * `load` and `preload` for queries became lazy. Might be partially incompatible. * Changed mapping behavior: multi-fields are defined in conformity with ElasticSearch documentation (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_multi_fields.html#_multi_fields) -## Changes: +### Changes: * `suggest` query options support ([@rschellhorn][]). * Added hash data support. How it is possible to pass hashes to import. @@ -397,7 +399,7 @@ * `highlight` and `rescore` query options support. * config/chewy.yml ERB support. -## Bugfixes: +### Bugfixes: * Fixed `missing` and `exists` filters DSL constructors. * Reworked index data composing. @@ -405,7 +407,7 @@ * Correct waiting for status. After index creation, bulk import, and deletion. * [#23](https://github.com/toptal/chewy/pull/23): Fix "wrong constant name" with namespace models -# Version 0.4.0 +## Version 0.4.0 * Changed `update_index` matcher behavior. Now it compare array attributes position-independently. * Search aggregations API support ([@arion][]). @@ -416,18 +418,18 @@ * `import` now creates index before performing. * `Chewy.configuration[:wait_for_status]` option. Can be set to `red`, `yellow` or `green`. If set - chewy will wait for cluster status before creating, deleting index and import. Useful for specs. -# Version 0.3.0 +## Version 0.3.0 * Added `Chewy.configuration[:index]` config to setup common indexes options. * `Chewy.client_options` replaced with `Chewy.configuration` * Using source filtering instead of fields filter (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-source-filtering.html). -# Version 0.2.3 +## Version 0.2.3 * `.import!` indexes method, raises import errors. * `.import!` types method, raises import errors. Useful for specs. -# Version 0.2.2 +## Version 0.2.2 * Support for `none` scope ([@undr][]). * Auto-resolved analyzers and analyzers repository ([@webgago][]): @@ -443,7 +445,7 @@ ``` `title_analyzer` here will be automatically resolved and passed to index mapping -# Version 0.2.0 +## Version 0.2.0 * Reworked import error handling. Now all the import errors from ElasticSearch are handled properly, also import method returns true of false depending on the import process success. * `Chewy::Index.import` now takes types hash as argument within options hash: @@ -461,7 +463,7 @@ `CitiesIndex.all.load(scope: {city: -> { include(:country) }})` `CitiesIndex.all.load(scope: ->{ include(:country) })` -# Version 0.1.0 +## Version 0.1.0 * Added filters simplified DSL. See [filters.rb](lib/chewy/query/filters.rb) for more details. * Queries and filters join system reworked. See [query.rb](lib/chewy/query.rb) for more details. @@ -498,7 +500,7 @@ * Implemented isolated adapters to simplify adding new ORMs * Query DLS chainable methods delegated to index class (no longer need to call MyIndex.search.query, just MyIndex.query) -# Version 0.0.1 +## Version 0.0.1 * Query DSL * Basic index handling From 87765695c46c45d4c157b3318dccd7d7fd9740a2 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 10:14:36 +0200 Subject: [PATCH 03/15] Clean up version headings --- CHANGELOG.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6610e6d9..b5a3bfc02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## master (unreleased) -## Version 6.0.0 (2021-02-11) +## 6.0.0 (2021-02-11) ### Breaking changes @@ -21,7 +21,7 @@ * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading ([@TikiTDO][], [@dalthon][]) * [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on rspec* gems after `rspec-mocks` 3.10.2 is released ([@rabotyaga][]) -## Version 5.2.0 (2021-01-28) +## 5.2.0 (2021-01-28) ### Changes @@ -37,7 +37,7 @@ * [#711](https://github.com/toptal/chewy/pull/711): Setup CI on CircleCI ([@mrzasa][]) * [#710](https://github.com/toptal/chewy/pull/710): Fix deprecation warning for contructing new BigDecimal ([@AlexVPopov][]) -## Version 5.1.0 (2019-09-24) +## 5.1.0 (2019-09-24) ### Breaking changes @@ -49,7 +49,7 @@ * [#606](https://github.com/toptal/chewy/pull/606): Speed up imports when `bulk_size` is specified ([@yahooguntu][]) * [#682](https://github.com/toptal/chewy/pull/682): Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions` ([@dck][]) -## Version 5.0.0 (2018-02-13) +## 5.0.0 (2018-02-13) ### Breaking changes @@ -75,7 +75,7 @@ * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error ([@yahooguntu][]) * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method ([@heartfulbird][]) -## Version 0.10.1 +## 0.10.1 ### Changes @@ -88,7 +88,7 @@ * [#555](https://github.com/toptal/chewy/pull/555): Fixed fields symbol/string value * [#554](https://github.com/toptal/chewy/pull/554): Fixed root field value proc -## Version 0.10.0 +## 0.10.0 ### Breaking changes @@ -118,7 +118,7 @@ * [#467](https://github.com/toptal/chewy/pull/467): Bulk indexing optimizations with new additional options ([@eproulx-petalmd][]) * [#438](https://github.com/toptal/chewy/pull/438): Configurable sidekiq options ([@averell23][]) -## Version 0.9.0 +## 0.9.0 ### Changes @@ -143,7 +143,7 @@ * [#385](https://github.com/toptal/chewy/pull/385): Sequel custom primary keys handling fix ([@okliv][]) * [#374](https://github.com/toptal/chewy/pull/374): Bulk import fixes ([@0x0badc0de][]) -## Version 0.8.4 +## 0.8.4 ### Changes @@ -169,7 +169,7 @@ * [#306](https://github.com/toptal/chewy/pull/306): Better errors handling in strategies ([@barthez][]) * [#303](https://github.com/toptal/chewy/pull/303): Assets strategies silencer fix for Rails 5 API mode ([@clupprich][]) -## Version 0.8.3 +## 0.8.3 ### Breaking changes: @@ -188,7 +188,7 @@ * Safe unsubscribe on import ([@marshall-lee][]) * Correct custom assets path silencer ([@davekaro][]) -## Version 0.8.2 +## 0.8.2 ### Changes @@ -206,13 +206,13 @@ * Fixed transport logger and tracer configuration -## Version 0.8.1 +## 0.8.1 ### Bugfixes * Added support of elasticsearch-ruby 1.0.10 -## Version 0.8.0 +## 0.8.0 ### Breaking changes: @@ -232,7 +232,7 @@ * Rails 4.2 migrations are not raising UndefinedUpdateStrategy anymore on data updates * Mongoid random failing specs fixes ([@marshall-lee][]) -## Version 0.7.0 +## 0.7.0 ### Breaking changes: @@ -314,7 +314,7 @@ * Chewy indexes eaged loading fixes ([@leemhenson][]) * `Chewy::Index.import nil` imports nothing instead of initial data -## Version 0.6.2 +## 0.6.2 ### Changes @@ -325,14 +325,14 @@ * Removed decay function defaults ([@Linuus][]) * Correct config file handling in case of empty file -## Version 0.6.1 +## 0.6.1 ### Changes * `min_score` query option support ([@jshirley][]) * `Chewy::Query#find` method for finding documents by id -## Version 0.6.0 +## 0.6.0 ### Changes @@ -345,7 +345,7 @@ * All the query chainable methods delegated to indexes and types (partially [@Linuus][]) -## Version 0.5.2 +## 0.5.2 ### Breaking changes: @@ -360,7 +360,7 @@ * Advanced type classes resolving ([@inbeom][]) * `import` ignores nil -## Version 0.5.1 +## 0.5.1 ### Changes: @@ -377,7 +377,7 @@ * Indexed eager-loading fix ([@leemhenson][]) * Field type deriving nested type support fix ([@rschellhorn][]) -## Version 0.5.0 +## 0.5.0 ### Breaking changes: @@ -407,7 +407,7 @@ * Correct waiting for status. After index creation, bulk import, and deletion. * [#23](https://github.com/toptal/chewy/pull/23): Fix "wrong constant name" with namespace models -## Version 0.4.0 +## 0.4.0 * Changed `update_index` matcher behavior. Now it compare array attributes position-independently. * Search aggregations API support ([@arion][]). @@ -418,18 +418,18 @@ * `import` now creates index before performing. * `Chewy.configuration[:wait_for_status]` option. Can be set to `red`, `yellow` or `green`. If set - chewy will wait for cluster status before creating, deleting index and import. Useful for specs. -## Version 0.3.0 +## 0.3.0 * Added `Chewy.configuration[:index]` config to setup common indexes options. * `Chewy.client_options` replaced with `Chewy.configuration` * Using source filtering instead of fields filter (http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-source-filtering.html). -## Version 0.2.3 +## 0.2.3 * `.import!` indexes method, raises import errors. * `.import!` types method, raises import errors. Useful for specs. -## Version 0.2.2 +## 0.2.2 * Support for `none` scope ([@undr][]). * Auto-resolved analyzers and analyzers repository ([@webgago][]): @@ -445,7 +445,7 @@ ``` `title_analyzer` here will be automatically resolved and passed to index mapping -## Version 0.2.0 +## 0.2.0 * Reworked import error handling. Now all the import errors from ElasticSearch are handled properly, also import method returns true of false depending on the import process success. * `Chewy::Index.import` now takes types hash as argument within options hash: @@ -463,7 +463,7 @@ `CitiesIndex.all.load(scope: {city: -> { include(:country) }})` `CitiesIndex.all.load(scope: ->{ include(:country) })` -## Version 0.1.0 +## 0.1.0 * Added filters simplified DSL. See [filters.rb](lib/chewy/query/filters.rb) for more details. * Queries and filters join system reworked. See [query.rb](lib/chewy/query.rb) for more details. @@ -500,7 +500,7 @@ * Implemented isolated adapters to simplify adding new ORMs * Query DLS chainable methods delegated to index class (no longer need to call MyIndex.search.query, just MyIndex.query) -## Version 0.0.1 +## 0.0.1 * Query DSL * Basic index handling From 3224501197c0017a092e33f9c2617004852c5010 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 10:20:33 +0200 Subject: [PATCH 04/15] Fold breaking changes under "Changes" --- CHANGELOG.md | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b5a3bfc02..55601be04 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,18 +4,15 @@ ## 6.0.0 (2021-02-11) -### Breaking changes - - * [#743](https://github.com/toptal/chewy/pull/743): Elasticsearch 6.x support added. See [migration guide](migration_guide.md) & ES [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html). Removed legacy DSL support. Removed support for ES < 5 ([@mrzasa][], [@konalegi][], [@rabotyaga][]) - ### Bug fixes - * [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) - * [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) - * [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) +* [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) +* [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) +* [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) ### Changes + * [#743](https://github.com/toptal/chewy/pull/743): **(Breaking)** Elasticsearch 6.x support added. See [migration guide](migration_guide.md) & ES [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html). Removed legacy DSL support. Removed support for ES < 5 ([@mrzasa][], [@konalegi][], [@rabotyaga][]) * [#751](https://github.com/toptal/chewy/pull/751): Add [Multi Search API](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-multi-search.html) support ([@mpeychich][], [@dalthon][]) * [#755](https://github.com/toptal/chewy/pull/755): `attribute_highlights` returns an array of highlights ([@musaffa][], [@dalthon][]) * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading ([@TikiTDO][], [@dalthon][]) @@ -39,28 +36,22 @@ ## 5.1.0 (2019-09-24) -### Breaking changes - - * [#657](https://github.com/toptal/chewy/pull/657): Add support for multiple indices in request ([@pyromaniac][]) - * [#647](https://github.com/toptal/chewy/pull/647): Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters ([@mattzollinhofer][]) - ### Changes + * [#657](https://github.com/toptal/chewy/pull/657): **(Breaking)** Add support for multiple indices in request ([@pyromaniac][]) + * [#647](https://github.com/toptal/chewy/pull/647): **(Breaking)** Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters ([@mattzollinhofer][]) * [#606](https://github.com/toptal/chewy/pull/606): Speed up imports when `bulk_size` is specified ([@yahooguntu][]) * [#682](https://github.com/toptal/chewy/pull/682): Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions` ([@dck][]) ## 5.0.0 (2018-02-13) -### Breaking changes - - * Try to align the gem version with the ElasticSearch version we support - * `Chewy.default_field_type` is `text` now. - * `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal` - * Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields. - * [#626](https://github.com/toptal/chewy/pull/626): Don't underscore suggested index name ([@dm1try][]) - ### Changes + * **(Breaking)** Try to align the gem version with the ElasticSearch version we support + * **(Breaking)** `Chewy.default_field_type` is `text` now. + * **(Breaking)** `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal` + * **(Breaking)** Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields. + * **(Breaking)** [#626](https://github.com/toptal/chewy/pull/626): Don't underscore suggested index name ([@dm1try][]) * [#598](https://github.com/toptal/chewy/pull/598): `pipeline` import option support ([@eManPrague][]) * [#625](https://github.com/toptal/chewy/pull/625): Proper Rails check ([@nattfodd][]) * [#623](https://github.com/toptal/chewy/pull/623): Bypass strategy performance improvements ([@DNNX][]) @@ -75,6 +66,8 @@ * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error ([@yahooguntu][]) * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method ([@heartfulbird][]) +----------------------------------------------------------------------------------- + ## 0.10.1 ### Changes From 7bea7ed4e795cc700e03e291f2b7c38ba60a3802 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 10:22:43 +0200 Subject: [PATCH 05/15] Make the changelog structure a bit more uniform --- CHANGELOG.md | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55601be04..7b5a41fd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,13 +2,13 @@ ## master (unreleased) -## 6.0.0 (2021-02-11) +### New Features -### Bug fixes +### Changes -* [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) -* [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) -* [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) +### Bugs Fixed + +## 6.0.0 (2021-02-11) ### Changes @@ -18,6 +18,12 @@ * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading ([@TikiTDO][], [@dalthon][]) * [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on rspec* gems after `rspec-mocks` 3.10.2 is released ([@rabotyaga][]) +### Bugs Fixed + +* [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) +* [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) +* [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) + ## 5.2.0 (2021-01-28) ### Changes @@ -61,7 +67,7 @@ * [#565](https://github.com/toptal/chewy/pull/565): Fixed some Sequel deprecation warnings ([@arturtr][]) * [#577](https://github.com/toptal/chewy/pull/577): Fixed some Sequel deprecation warnings ([@matchbookmac][]) -### Bugfixes +### Bugs Fixed * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error ([@yahooguntu][]) * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method ([@heartfulbird][]) @@ -74,7 +80,7 @@ * [#558](https://github.com/toptal/chewy/pull/558): Improved parallel worker titles -### Bugfixes +### Bugs Fixed * [#557](https://github.com/toptal/chewy/pull/557): Fixed request strategy initial debug message * [#556](https://github.com/toptal/chewy/pull/556): Fixed will objects paginated array initialization when pagination was not used @@ -129,7 +135,7 @@ * Witchcraft™ supports dynamically generated procs with variables from closure. * Added `Query#preference` for specifying shard replicas to query against. ([@menglewis][]) -### Bugfixes +### Bugs Fixed * [#415](https://github.com/toptal/chewy/pull/415): `.script_fields` method in the Index class ([@dmitry][]) * [#398](https://github.com/toptal/chewy/pull/398): Fix routing_missing_exception on delete with parent missing ([@guigs][]) @@ -154,7 +160,7 @@ * Accessing types with methods is deprecated. Use `MyIndex::MyType` constant reference instead of `MyIndex.my_type` method. * [#294](https://github.com/toptal/chewy/pull/294): Sequel adapter improvements ([@mrbrdo][]) -### Bugfixes +### Bugs Fixed * [#325](https://github.com/toptal/chewy/pull/325): Mongoid atomic strategy fix * [#324](https://github.com/toptal/chewy/pull/324): Method missing fix ([@jesjos][]) @@ -173,7 +179,7 @@ * Sequel support completely reworked to use common ORM implementations + better sequel specs covarage. -### Bugfixes +### Bugs Fixed * Sequel objects transactional destruction fix * Correct Rspec mocking framework checking ([@mainameiz][]) @@ -195,13 +201,13 @@ * Multiple grammar fixes ([@henrebotha][]) * Ability to pass a proc to `update_index` to define updating index dynamically ([@SeTeM][]) -### Bugfixes +### Bugs Fixed * Fixed transport logger and tracer configuration ## 0.8.1 -### Bugfixes +### Bugs Fixed * Added support of elasticsearch-ruby 1.0.10 @@ -220,7 +226,7 @@ * `:sidekiq` async strategy (inspired by [@sharkzp][]) * Added `Query#search_type` for `search_type` request option setup ([@marshall-lee][]) -### Bugfixes +### Bugs Fixed * Rails 4.2 migrations are not raising UndefinedUpdateStrategy anymore on data updates * Mongoid random failing specs fixes ([@marshall-lee][]) @@ -301,7 +307,7 @@ ``` * Implemented basic named scopes -### Bugfixes +### Bugs Fixed * `script_score` allow options ([@joeljunstrom][]) * Chewy indexes eaged loading fixes ([@leemhenson][]) @@ -313,7 +319,7 @@ * document root id custom value option ([@baronworks][]) -### Bugfixes +### Bugs Fixed * Removed decay function defaults ([@Linuus][]) * Correct config file handling in case of empty file @@ -334,7 +340,7 @@ * `timeout` and `timed_out` support ([@MarkMurphy][]) * will_paginate support ([@josecoelho][]) -### Bugfixes +### Bugs Fixed * All the query chainable methods delegated to indexes and types (partially [@Linuus][]) @@ -348,7 +354,7 @@ * `Chewy.massacre` aliased to `Chewy.delete_all` method deletes all the indexes with current prefix -### Bugfixes: +### Bugs Fixed: * Advanced type classes resolving ([@inbeom][]) * `import` ignores nil @@ -365,7 +371,7 @@ * Rspec 3 `update_index` matcher support ([@jimmybaker][]) * Implemented function scoring ([@averell23][]) -### Bugfixes: +### Bugs Fixed: * Indexed eager-loading fix ([@leemhenson][]) * Field type deriving nested type support fix ([@rschellhorn][]) @@ -392,7 +398,7 @@ * `highlight` and `rescore` query options support. * config/chewy.yml ERB support. -### Bugfixes: +### Bugs Fixed: * Fixed `missing` and `exists` filters DSL constructors. * Reworked index data composing. From da14877e4651265a27f352307ef6e5fe3567e28b Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 10:27:23 +0200 Subject: [PATCH 06/15] Polish recent changelog entries --- CHANGELOG.md | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b5a41fd4..e7d4dd0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,65 +12,65 @@ ### Changes - * [#743](https://github.com/toptal/chewy/pull/743): **(Breaking)** Elasticsearch 6.x support added. See [migration guide](migration_guide.md) & ES [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html). Removed legacy DSL support. Removed support for ES < 5 ([@mrzasa][], [@konalegi][], [@rabotyaga][]) - * [#751](https://github.com/toptal/chewy/pull/751): Add [Multi Search API](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-multi-search.html) support ([@mpeychich][], [@dalthon][]) - * [#755](https://github.com/toptal/chewy/pull/755): `attribute_highlights` returns an array of highlights ([@musaffa][], [@dalthon][]) - * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading ([@TikiTDO][], [@dalthon][]) - * [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on rspec* gems after `rspec-mocks` 3.10.2 is released ([@rabotyaga][]) + * [#743](https://github.com/toptal/chewy/pull/743): **(Breaking)** Elasticsearch 6.x support added. See the [migration guide](migration_guide.md) & ES [breaking changes](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html). Removed legacy DSL support. Removed support for ES < 5. ([@mrzasa][], [@konalegi][], [@rabotyaga][]) + * [#751](https://github.com/toptal/chewy/pull/751): Add [Multi Search API](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-multi-search.html) support. ([@mpeychich][], [@dalthon][]) + * [#755](https://github.com/toptal/chewy/pull/755): `attribute_highlights` returns an array of highlights. ([@musaffa][], [@dalthon][]) + * [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading. ([@TikiTDO][], [@dalthon][]) + * [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on `rspec-*` gems after `rspec-mocks` 3.10.2 is released. ([@rabotyaga][]) ### Bugs Fixed -* [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing scroll_batches ([@socialchorus][]) -* [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation ([@JF-Lalonde][], [@dalthon][]) -* [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft ([@taylor-au][]) +* [#695](https://github.com/toptal/chewy/pull/695): Clear the scroll by id after completing `scroll_batches`. ([@socialchorus][]) +* [#749](https://github.com/toptal/chewy/pull/749): Avoid importing everything when given an empty relation. ([@JF-Lalonde][], [@dalthon][]) +* [#736](https://github.com/toptal/chewy/pull/736): Fix nil children when using witchcraft. ([@taylor-au][]) ## 5.2.0 (2021-01-28) ### Changes - * [#734](https://github.com/toptal/chewy/pull/734): Add support for Ruby 3 ([@lowang][]) - * [#735](https://github.com/toptal/chewy/pull/735): Correct deprecation warning for Elasticsearch 5.6 to 6: empty query for`_delete_by_query`, delete by alias, `index_already_exists_exception` renaming ([@bhacaz][]) + * [#734](https://github.com/toptal/chewy/pull/734): Add support for Ruby 3. ([@lowang][]) + * [#735](https://github.com/toptal/chewy/pull/735): Correct deprecation warning for Elasticsearch 5.6 to 6: empty query for`_delete_by_query`, delete by alias, `index_already_exists_exception` renaming. ([@bhacaz][]) * [#733](https://github.com/toptal/chewy/pull/733): Update gemspec dependencies for Rails. Update CI gemfiles and matrix to tests against current LTS Rails versions. ([@bhacaz][]) - * Tweak some wording and formatting; add a note about compatibility; update copyright; remove broken logo; update the CI badge ([@bbatsov][]) - * [#714](https://github.com/toptal/chewy/pull/714): Update instructions for AWS ElasticSearch ([@olancheg][]) - * [#728](https://github.com/toptal/chewy/pull/728): Fix more ruby 2.7 keyword params deprecation warnings ([@aglushkov][]) - * [#715](https://github.com/toptal/chewy/pull/715): Fixed all deprecation warnings in Ruby 2.7 ([@gseddon][]) - * [#718](https://github.com/toptal/chewy/pull/718): Added Ruby 2.7 to CircleCI config ([@mrzasa][]) - * [#707](https://github.com/toptal/chewy/pull/707): Allow configuration of Active Job queue name ([@mrzasa][]) - * [#711](https://github.com/toptal/chewy/pull/711): Setup CI on CircleCI ([@mrzasa][]) - * [#710](https://github.com/toptal/chewy/pull/710): Fix deprecation warning for contructing new BigDecimal ([@AlexVPopov][]) + * Tweak some wording and formatting; add a note about compatibility; update copyright; remove broken logo; update the CI badge. ([@bbatsov][]) + * [#714](https://github.com/toptal/chewy/pull/714): Update instructions for AWS ElasticSearch. ([@olancheg][]) + * [#728](https://github.com/toptal/chewy/pull/728): Fix more ruby 2.7 keyword params deprecation warnings. ([@aglushkov][]) + * [#715](https://github.com/toptal/chewy/pull/715): Fixed all deprecation warnings in Ruby 2.7. ([@gseddon][]) + * [#718](https://github.com/toptal/chewy/pull/718): Added Ruby 2.7 to CircleCI config. ([@mrzasa][]) + * [#707](https://github.com/toptal/chewy/pull/707): Allow configuration of Active Job queue name. ([@mrzasa][]) + * [#711](https://github.com/toptal/chewy/pull/711): Setup CI on CircleCI. ([@mrzasa][]) + * [#710](https://github.com/toptal/chewy/pull/710): Fix deprecation warning for constructing new `BigDecimal`. ([@AlexVPopov][]) ## 5.1.0 (2019-09-24) ### Changes - * [#657](https://github.com/toptal/chewy/pull/657): **(Breaking)** Add support for multiple indices in request ([@pyromaniac][]) - * [#647](https://github.com/toptal/chewy/pull/647): **(Breaking)** Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters ([@mattzollinhofer][]) - * [#606](https://github.com/toptal/chewy/pull/606): Speed up imports when `bulk_size` is specified ([@yahooguntu][]) - * [#682](https://github.com/toptal/chewy/pull/682): Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions` ([@dck][]) + * [#657](https://github.com/toptal/chewy/pull/657): **(Breaking)** Add support for multiple indices in request. ([@pyromaniac][]) + * [#647](https://github.com/toptal/chewy/pull/647): **(Breaking)** Support `search_type`, `request_cache`, and `allow_partial_search_results` as query string parameters. ([@mattzollinhofer][]) + * [#606](https://github.com/toptal/chewy/pull/606): Speed up imports when `bulk_size` is specified. ([@yahooguntu][]) + * [#682](https://github.com/toptal/chewy/pull/682): Insert `RequestStrategy` middleware before `ActionDispatch::ShowExceptions`. ([@dck][]) ## 5.0.0 (2018-02-13) ### Changes - * **(Breaking)** Try to align the gem version with the ElasticSearch version we support + * **(Breaking)** Align the gem version with the most recent ElasticSearch version we support. * **(Breaking)** `Chewy.default_field_type` is `text` now. - * **(Breaking)** `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal` + * **(Breaking)** `Chewy::Stash` was split onto two indexes - `Chewy::Stash::Specification` and `Chewy::Stash::Journal`. * **(Breaking)** Data for journal and specification is stored in binary fields base64-encoded to bypass the limits of other fields. - * **(Breaking)** [#626](https://github.com/toptal/chewy/pull/626): Don't underscore suggested index name ([@dm1try][]) - * [#598](https://github.com/toptal/chewy/pull/598): `pipeline` import option support ([@eManPrague][]) - * [#625](https://github.com/toptal/chewy/pull/625): Proper Rails check ([@nattfodd][]) - * [#623](https://github.com/toptal/chewy/pull/623): Bypass strategy performance improvements ([@DNNX][]) - * [#620](https://github.com/toptal/chewy/pull/620): Avoid index update calls for empty data ([@robertasg][]) + * **(Breaking)** [#626](https://github.com/toptal/chewy/pull/626): Don't underscore suggested index name. ([@dm1try][]) + * [#598](https://github.com/toptal/chewy/pull/598): `pipeline` import option support. ([@eManPrague][]) + * [#625](https://github.com/toptal/chewy/pull/625): Proper Rails check. ([@nattfodd][]) + * [#623](https://github.com/toptal/chewy/pull/623): Bypass strategy performance improvements. ([@DNNX][]) + * [#620](https://github.com/toptal/chewy/pull/620): Avoid index update calls for empty data. ([@robertasg][]) * Do not underscore suggested index name on `Chewy::Index.index_name` call. * It is possible now to call `root` method several times inside a single type definition, the options will be merged. Also, the block isn't required anymore. - * [#565](https://github.com/toptal/chewy/pull/565): Fixed some Sequel deprecation warnings ([@arturtr][]) - * [#577](https://github.com/toptal/chewy/pull/577): Fixed some Sequel deprecation warnings ([@matchbookmac][]) + * [#565](https://github.com/toptal/chewy/pull/565): Fixed some Sequel deprecation warnings. ([@arturtr][]) + * [#577](https://github.com/toptal/chewy/pull/577): Fixed some Sequel deprecation warnings. ([@matchbookmac][]) ### Bugs Fixed - * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error ([@yahooguntu][]) - * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method ([@heartfulbird][]) + * [#593](https://github.com/toptal/chewy/pull/593): Fixed index settings logic error. ([@yahooguntu][]) + * [#567](https://github.com/toptal/chewy/pull/567): Missed check in higlight method. ([@heartfulbird][]) ----------------------------------------------------------------------------------- From bec5284b415a468a239df940b6f24f4baf659fe3 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 10:34:51 +0200 Subject: [PATCH 07/15] Tweak some wording --- migration_guide.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/migration_guide.md b/migration_guide.md index de44a6c6e..0ead18efc 100644 --- a/migration_guide.md +++ b/migration_guide.md @@ -1,18 +1,23 @@ # Migration guide -## Chewy 5 / ES 5 to Chewy 6 / ES 6 +This document outlines the steps you need to take when migrating between major versions of +Chewy and Elasticsearch. For simplicity's sake the guide will assume that you're using +Chewy alongside a matching Elasticsearch version. -In order to upgrade chewy5/ES5 to chewy6/ES6 in the most seamless manner you have to: -* Upgrade to the latest 5.x stable releases: Chewy 5.2, ES 5.6 +## Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6 + +In order to upgrade Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6 in the most seamless manner you have to: + +* Upgrade to the latest 5.x stable releases, namely Chewy 5.2, Elasticsearch 5.6 * [Migrate any multi-typed indexes into single-typed](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/removal-of-types.html) * Using [multi-index queries](https://github.com/toptal/chewy/pull/657) could be helpful - * Parent/Child [relationship is deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/removal-of-types.html#parent-child-mapping-types) in favor of the [join field](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/parent-join.html) + * Parent/Child [relationship is deprecated](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/removal-of-types.html#parent-child-mapping-types) in favor of the [join field](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/parent-join.html) * Handle deprecation of `string` type & `not_analyzed` value for the `index` mapping parameter: * replace fields with `{ type: 'string', index: 'not_analyzed'}` by `{type: 'keyword'}` * replace fields with `{ type: 'string', index: 'analyzed'}` by `{type: 'text'}` * `PathHierarchy` tokenizer' param `delimiter` now accepts only one argument, [others should be replaced by character filter ](https://discuss.elastic.co/t/multichar-delimiter-in-path-hierarchy-tokenizer/16203) -* Make sure you don't use any other of the [deprecated ES5 features](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html) -* Run your test suite on ES6 -* Run manual tests on ES6 +* Make sure you don't use any other of the [deprecated Elasticsearch 5 features](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html) +* Run your test suite on Elasticsearch 6 +* Run manual tests on Elasticsearch 6 * Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/rolling-upgrades.html) of Elasticsearch * Upgrade to Chewy 6 From 04979dbd58e4f11d8fcd3c5d6eb60598a00fd78a Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 14:27:15 +0200 Subject: [PATCH 08/15] Add code of conduct --- CODE_OF_CONDUCT.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 000000000..4282247b5 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,14 @@ +# The Chewy Community Code of Conduct + +**Note:** We have picked the following code of conduct based on [Ruby's own code of conduct](https://www.ruby-lang.org/en/conduct/). + +This document provides a few simple community guidelines for a safe, respectful, +productive, and collaborative place for any person who is willing to contribute +to the Chewy community. It applies to all "collaborative spaces", which are +defined as community communications channels (such as mailing lists, submitted +patches, commit comments, etc.). + +* Participants will be tolerant of opposing views. +* Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks. +* When interpreting the words and actions of others, participants should always assume good intentions. +* Behaviour which can be reasonably considered harassment will not be tolerated. From 9fcd922496c124ffdc5c1494dacebc06573f69a8 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 14:33:04 +0200 Subject: [PATCH 09/15] Add more detailed contribution guidelines --- CONTRIBUTING.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..f984c4d1d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,63 @@ +# Contributing + +If you discover issues, have ideas for improvements or new features, +please report them to the [issue tracker][1] of the repository or +submit a pull request. Please, try to follow these guidelines when you +do so. + +## Issue reporting + +* Check that the issue has not already been reported. +* Check that the issue has not already been fixed in the latest code + (a.k.a. `master`). +* Be clear, concise and precise in your description of the problem. +* Open an issue with a descriptive title and a summary in grammatically correct, + complete sentences. +* Include the versions of Chewy, Elasticsearch, Ruby, Rails, etc. +* Include any relevant code to the issue summary. + +## Pull requests + +* Read [how to properly contribute to open source projects on GitHub][2]. +* Fork the project. +* Use a topic/feature branch to easily amend a pull request later, if necessary. +* Write [good commit messages][3]. +* Use the same coding conventions as the rest of the project. +* Commit and push until you are happy with your contribution. +* If your change has a corresponding open GitHub issue, prefix the commit message with `[Fix #github-issue-number]`. +* Make sure to add tests for it. This is important so I don't break it + in a future version unintentionally. +* Add an entry to the [Changelog](CHANGELOG.md). +* Please try not to mess with the Rakefile, version, or history. If + you want to have your own version, or is otherwise necessary, that + is fine, but please isolate to its own commit so I can cherry-pick + around it. +* Make sure the test suite is passing and the code you wrote doesn't produce + RuboCop offenses. +* [Squash related commits together][5]. +* Open a [pull request][4] that relates to *only* one subject with a clear title + and description in grammatically correct, complete sentences. + +## Changelog entry format + +Here are a few examples: + +``` +* [#753](https://github.com/toptal/chewy/pull/753): Add support for direct_import parameter to skip objects reloading. ([@TikiTDO][], [@dalthon][]) +* [#739](https://github.com/toptal/chewy/pull/739): Remove explicit `main` branch dependencies on `rspec-*` gems after `rspec-mocks` 3.10.2 is released. ([@rabotyaga][]) +``` + +* Mark it up in [Markdown syntax][6]. +* The entry line should start with `* ` (an asterisk and a space). +* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#123](https://github.com/toptal/chewy/issues/123): `. +* Describe the brief of the change. The sentence should end with a punctuation. +* If this is a breaking change, mark it with `**(Breaking)**`. +* At the end of the entry, add an implicit link to your GitHub user page as `([@username][])`. +* If this is your first contribution to the project, add a link definition for the implicit link to the bottom of the changelog as `[@username]: https://github.com/username`. + +[1]: https://github.com/toptal/chewy/issues +[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request +[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[4]: https://help.github.com/articles/about-pull-requests +[5]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html +[6]: https://daringfireball.net/projects/markdown/syntax From 0772048c51eefb624c9f19d9ff0a3a51031eb69c Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 14:39:23 +0200 Subject: [PATCH 10/15] Add issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 39 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 000000000..d8acf9797 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,39 @@ +--- +name: Bug Report +about: Report an issue with Chewy you've discovered. +--- + +*Be clear, concise and precise in your description of the problem. +Open an issue with a descriptive title and a summary in grammatically correct, +complete sentences.* + +*Use the template below when reporting bugs. Please, make sure that +you're running the latest stable Chewy and that the problem you're reporting +hasn't been reported (and potentially fixed) already.* + +*Before filing the ticket you should replace all text above the horizontal +rule with your own words.* + +-------- + +## Expected behavior + +Describe here how you expected Chewy to behave in this particular situation. + +## Actual behavior + +Describe here what actually happened. + +## Steps to reproduce the problem + +This is extremely important! Providing us with a reliable way to reproduce +a problem will expedite its solution. + +## Version Information + +Share here essential version information such as: + +* Chewy version +* Elasticsearch version +* Ruby version +* Rails version diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 000000000..51524e507 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature Request +about: Suggest new Chewy features or improvements to existing features. +--- + +## Is your feature request related to a problem? Please describe. + +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +## Describe the solution you'd like + +A clear and concise description of what you want to happen. + +## Describe alternatives you've considered + +A clear and concise description of any alternative solutions or features you've considered. + +## Additional context + +Add any other context or screenshots about the feature request here. From bc84b4bf40c6834ea466717dfe1e813889e2c6e7 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Fri, 12 Feb 2021 14:41:39 +0200 Subject: [PATCH 11/15] Add a PR template --- .github/PULL_REQUEST_TEMPLATE.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..2648df3df --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +**Replace this text with a summary of the changes in your PR. +The more detailed you are, the better.** + +----------------- + +Before submitting the PR make sure the following are checked: + +* [ ] The PR relates to *only* one subject with a clear title and description in grammatically correct, complete sentences. +* [ ] Wrote [good commit messages][1]. +* [ ] Commit message starts with `[Fix #issue-number]` (if the related issue exists). +* [ ] Feature branch is up-to-date with `master` (if not - rebase it). +* [ ] Squashed related commits together. +* [ ] Added tests. +* [ ] Added an entry to the changelog if the new code introduces user-observable changes. See [changelog entry format](https://github.com/toptal/chewy/blob/master/CONTRIBUTING.md#changelog-entry-format) for details. + +[1]: https://chris.beams.io/posts/git-commit/ From b2c4d0c231e7ed0531be5808309f56f3ac2232fc Mon Sep 17 00:00:00 2001 From: Dalton Date: Fri, 12 Feb 2021 15:17:17 +0100 Subject: [PATCH 12/15] Avoid fetching scope data to check if it is blank --- CHANGELOG.md | 2 ++ lib/chewy/type/import.rb | 11 ++++++++++- spec/chewy/type/import_spec.rb | 9 +++++++++ spec/support/active_record.rb | 5 +++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7d4dd0d9..24ec3670f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ ### Changes + * [#761](https://github.com/toptal/chewy/pull/761): Avoid fetching scope data to check if it is blank ([@dalthon][]) + ### Bugs Fixed ## 6.0.0 (2021-02-11) diff --git a/lib/chewy/type/import.rb b/lib/chewy/type/import.rb index 310c8d8da..92ed1cecb 100644 --- a/lib/chewy/type/import.rb +++ b/lib/chewy/type/import.rb @@ -127,7 +127,8 @@ def compose(object, crutches = nil, fields: []) private def import_routine(*args) - return if args.first.blank? && !args.first.nil? + return if !args.first.nil? && empty_objects_or_scope?(args.first) + routine = Routine.new(self, **args.extract_options!) routine.create_indexes! @@ -138,6 +139,14 @@ def import_routine(*args) end end + def empty_objects_or_scope?(objects_or_scope) + if objects_or_scope.respond_to?(:empty?) + objects_or_scope.empty? + else + objects_or_scope.blank? + end + end + def import_linear(objects, routine) ActiveSupport::Notifications.instrument 'import_objects.chewy', type: self do |payload| adapter.import(*objects, routine.options) do |action_objects| diff --git a/spec/chewy/type/import_spec.rb b/spec/chewy/type/import_spec.rb index 30fe14ba9..833e671a8 100644 --- a/spec/chewy/type/import_spec.rb +++ b/spec/chewy/type/import_spec.rb @@ -158,6 +158,15 @@ def subscribe_notification specify do expect { import City.where(id: dummy_cities.first.id) }.to update_index(CitiesIndex::City).and_reindex(dummy_cities.first).only end + + specify do + allow(CitiesIndex::City).to receive(:import_linear).and_return(double(present?: false)) + allow(CitiesIndex::City).to receive(:import_parallel).and_return(double(present?: false)) + + expects_no_query(except: /SELECT\s+1\s+AS\s+one\s+FROM/) do + import City.where(id: dummy_cities.first.id) + end + end end end diff --git a/spec/support/active_record.rb b/spec/support/active_record.rb index 8a79b91c1..5bc56eb97 100644 --- a/spec/support/active_record.rb +++ b/spec/support/active_record.rb @@ -39,14 +39,15 @@ def expects_db_queries(&block) raise 'Expected some db queries, but none were made' unless have_queries end - def expects_no_query(&block) + def expects_no_query(except: nil, &block) queries = [] ActiveSupport::Notifications.subscribed( ->(*args) { queries << args[4][:sql] }, 'sql.active_record', &block ) - raise "Expected no DB queries, but the following ones were made: #{queries.join(', ')}" if queries.present? + ofending_queries = except ? queries.find_all { |query| !query.match(except) } : queries + raise "Expected no DB queries, but the following ones were made: #{ofending_queries.join(', ')}" if ofending_queries.present? end def stub_model(name, superclass = nil, &block) From 47ad295222212547e67683a0d762bd4f2b64e6b8 Mon Sep 17 00:00:00 2001 From: Dalton Pinto Date: Mon, 15 Feb 2021 08:52:46 +0100 Subject: [PATCH 13/15] Correctly report indices and aliases (#757) * Correctly report indices and aliases * Fix rubocop offense * Fix specs & Changelog * Add `include_type_name` parameter for ES 6.7-6.8 for `client.indices.get` request Co-authored-by: mpeychich Co-authored-by: Ivan Rabotyaga --- CHANGELOG.md | 1 + lib/chewy/index/actions.rb | 2 +- lib/chewy/index/aliases.rb | 21 ++++-- spec/chewy/index/actions_spec.rb | 125 +++++++++++++++++++++++-------- spec/chewy/index/aliases_spec.rb | 6 +- 5 files changed, 115 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24ec3670f..ee725cf46 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Changes + * [#757](https://github.com/toptal/chewy/pull/757): **(Breaking)** Fix `Chewy::Index.index` & `Chewy::Index.aliases` to correctly report indexes and aliases ([@mpeychich][], [@dalthon][]) * [#761](https://github.com/toptal/chewy/pull/761): Avoid fetching scope data to check if it is blank ([@dalthon][]) ### Bugs Fixed diff --git a/lib/chewy/index/actions.rb b/lib/chewy/index/actions.rb index 4e6e451d3..9183b8927 100644 --- a/lib/chewy/index/actions.rb +++ b/lib/chewy/index/actions.rb @@ -182,7 +182,7 @@ def #{method}(*args) def reset!(suffix = nil, apply_journal: true, journal: false, **import_options) result = if suffix.present? start_time = Time.now - indexes = self.indexes + indexes = self.indexes - [index_name] create! suffix, alias: false general_name = index_name diff --git a/lib/chewy/index/aliases.rb b/lib/chewy/index/aliases.rb index 6a8a93b1f..21feebf8d 100644 --- a/lib/chewy/index/aliases.rb +++ b/lib/chewy/index/aliases.rb @@ -5,14 +5,25 @@ module Aliases module ClassMethods def indexes - client.indices.get_alias(name: index_name).keys - rescue Elasticsearch::Transport::Transport::Errors::NotFound - [] + get_args = {index: index_name} + get_args[:include_type_name] = true if Runtime.version >= '6.7.0' + indexes = empty_if_not_found { client.indices.get(**get_args).keys } + indexes += empty_if_not_found { client.indices.get_alias(name: index_name).keys } + indexes.compact.uniq end def aliases - name = index_name - client.indices.get_alias(index: name, name: '*')[name].try(:[], 'aliases').try(:keys) || [] + empty_if_not_found do + client.indices.get_alias(index: index_name, name: '*').values.flat_map do |aliases| + aliases['aliases'].keys + end + end.compact.uniq + end + + private + + def empty_if_not_found + yield rescue Elasticsearch::Transport::Transport::Errors::NotFound [] end diff --git a/spec/chewy/index/actions_spec.rb b/spec/chewy/index/actions_spec.rb index 7fbbd822d..d8c50ac12 100644 --- a/spec/chewy/index/actions_spec.rb +++ b/spec/chewy/index/actions_spec.rb @@ -3,7 +3,10 @@ describe Chewy::Index::Actions do before { Chewy.massacre } - before { stub_index :dummies } + before do + stub_index :dummies + stub_index :dummies_suffixed + end describe '.exists?' do specify { expect(DummiesIndex.exists?).to eq(false) } @@ -25,26 +28,40 @@ end context do - before { DummiesIndex.create '2013' } + before do + DummiesIndex.create '2013' + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } specify { expect(DummiesIndex.create('2013')).to eq(false) } specify { expect(DummiesIndex.create('2014')['acknowledged']).to eq(true) } context do before { DummiesIndex.create '2014' } + specify { expect(DummiesIndex.indexes).to match_array(%w[dummies_2013 dummies_2014]) } end end context do - before { DummiesIndex.create '2013', alias: false } + before do + DummiesIndex.create '2013', alias: false + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } specify { expect(DummiesIndex.aliases).to eq([]) } specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.exists?).to eq(false) } + # Unfortunately, without alias we can't figure out that this dummies_2013 index is related to DummiesIndex + # it would be awesome to have the following specs passing + # specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } + # specify { expect(DummiesIndex.exists?).to eq(true) } end end @@ -53,7 +70,11 @@ specify { expect(DummiesIndex.create!('2013')['acknowledged']).to eq(true) } context do - before { DummiesIndex.create } + before do + DummiesIndex.create + DummiesSuffixedIndex.create 'should_not_appear' + end + specify do expect { DummiesIndex.create! }.to raise_error(Elasticsearch::Transport::Transport::Errors::BadRequest).with_message(/already exists.*dummies/) end @@ -61,10 +82,14 @@ end context do - before { DummiesIndex.create! '2013' } + before do + DummiesIndex.create! '2013' + DummiesSuffixedIndex.create! 'should_not_appear' + end + specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } specify do expect { DummiesIndex.create!('2013') }.to raise_error(Elasticsearch::Transport::Transport::Errors::BadRequest).with_message(/already exists.*dummies_2013/) @@ -73,16 +98,26 @@ context do before { DummiesIndex.create! '2014' } + specify { expect(DummiesIndex.indexes).to match_array(%w[dummies_2013 dummies_2014]) } end end context do - before { DummiesIndex.create! '2013', alias: false } + before do + DummiesIndex.create! '2013', alias: false + DummiesSuffixedIndex.create! 'should_not_appear' + end + specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } specify { expect(DummiesIndex.aliases).to eq([]) } specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.exists?).to eq(false) } + # Unfortunately, without alias we can't figure out that this dummies_2013 index is related to DummiesIndex + # it would be awesome to have the following specs passing + # specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } + # specify { expect(DummiesIndex.exists?).to eq(true) } end end @@ -91,27 +126,40 @@ specify { expect(DummiesIndex.delete('dummies_2013')).to eq(false) } context do - before { DummiesIndex.create } + before do + DummiesIndex.create + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(DummiesIndex.delete['acknowledged']).to eq(true) } context do before { DummiesIndex.delete } specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end end context do - before { DummiesIndex.create '2013' } + before do + DummiesIndex.create '2013' + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(DummiesIndex.delete('2013')['acknowledged']).to eq(true) } context do before { DummiesIndex.delete('2013') } specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end context do - before { DummiesIndex.create '2014' } + before do + DummiesIndex.create '2014' + end + specify { expect(DummiesIndex.delete['acknowledged']).to eq(true) } context do @@ -119,6 +167,7 @@ specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2014')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end context do @@ -126,6 +175,7 @@ specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2014')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end end end @@ -136,27 +186,38 @@ specify { expect { DummiesIndex.delete!('2013') }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound) } context do - before { DummiesIndex.create } + before do + DummiesIndex.create + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(DummiesIndex.delete!['acknowledged']).to eq(true) } context do before { DummiesIndex.delete! } specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end end context do - before { DummiesIndex.create '2013' } + before do + DummiesIndex.create '2013' + DummiesSuffixedIndex.create 'should_not_appear' + end + specify { expect(DummiesIndex.delete!('2013')['acknowledged']).to eq(true) } context do before { DummiesIndex.delete!('2013') } specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end context do before { DummiesIndex.create '2014' } + specify { expect(DummiesIndex.delete!['acknowledged']).to eq(true) } context do @@ -164,6 +225,7 @@ specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(false) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2014')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end context do @@ -171,6 +233,7 @@ specify { expect(Chewy.client.indices.exists(index: 'dummies')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2013')).to eq(true) } specify { expect(Chewy.client.indices.exists(index: 'dummies_2014')).to eq(false) } + specify { expect(Chewy.client.indices.exists(index: 'dummies_suffixed')).to eq(true) } end end end @@ -184,19 +247,19 @@ before { DummiesIndex.purge } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } context do before { DummiesIndex.purge } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do before { DummiesIndex.purge('2013') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } end end @@ -204,20 +267,20 @@ context do before { DummiesIndex.purge('2013') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } context do before { DummiesIndex.purge } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do before { DummiesIndex.purge('2014') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2014']) } end end @@ -231,19 +294,19 @@ before { DummiesIndex.purge! } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } context do before { DummiesIndex.purge! } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do before { DummiesIndex.purge!('2013') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } end end @@ -251,20 +314,20 @@ context do before { DummiesIndex.purge!('2013') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2013']) } context do before { DummiesIndex.purge! } specify { expect(DummiesIndex).to be_exists } specify { expect(DummiesIndex.aliases).to eq([]) } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do before { DummiesIndex.purge!('2014') } specify { expect(DummiesIndex).to be_exists } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } specify { expect(DummiesIndex.indexes).to eq(['dummies_2014']) } end end @@ -361,13 +424,13 @@ specify { expect(CitiesIndex.all).to have(1).item } specify { expect(CitiesIndex.aliases).to eq([]) } - specify { expect(CitiesIndex.indexes).to eq([]) } + specify { expect(CitiesIndex.indexes).to eq(['cities']) } context do before { CitiesIndex.reset!('2013') } specify { expect(CitiesIndex.all).to have(1).item } - specify { expect(CitiesIndex.aliases).to eq([]) } + specify { expect(CitiesIndex.aliases).to eq(['cities']) } specify { expect(CitiesIndex.indexes).to eq(['cities_2013']) } end @@ -376,7 +439,7 @@ specify { expect(CitiesIndex.all).to have(1).item } specify { expect(CitiesIndex.aliases).to eq([]) } - specify { expect(CitiesIndex.indexes).to eq([]) } + specify { expect(CitiesIndex.indexes).to eq(['cities']) } end end @@ -384,14 +447,14 @@ before { CitiesIndex.reset!('2013') } specify { expect(CitiesIndex.all).to have(1).item } - specify { expect(CitiesIndex.aliases).to eq([]) } + specify { expect(CitiesIndex.aliases).to eq(['cities']) } specify { expect(CitiesIndex.indexes).to eq(['cities_2013']) } context do before { CitiesIndex.reset!('2014') } specify { expect(CitiesIndex.all).to have(1).item } - specify { expect(CitiesIndex.aliases).to eq([]) } + specify { expect(CitiesIndex.aliases).to eq(['cities']) } specify { expect(CitiesIndex.indexes).to eq(['cities_2014']) } specify { expect(Chewy.client.indices.exists(index: 'cities_2013')).to eq(false) } end @@ -401,7 +464,7 @@ specify { expect(CitiesIndex.all).to have(1).item } specify { expect(CitiesIndex.aliases).to eq([]) } - specify { expect(CitiesIndex.indexes).to eq([]) } + specify { expect(CitiesIndex.indexes).to eq(['cities']) } specify { expect(Chewy.client.indices.exists(index: 'cities_2013')).to eq(false) } end end diff --git a/spec/chewy/index/aliases_spec.rb b/spec/chewy/index/aliases_spec.rb index 6c654481d..dc29e1189 100644 --- a/spec/chewy/index/aliases_spec.rb +++ b/spec/chewy/index/aliases_spec.rb @@ -10,13 +10,13 @@ context do before { DummiesIndex.create! } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do before { DummiesIndex.create! } before { Chewy.client.indices.put_alias index: 'dummies', name: 'dummies_2013' } - specify { expect(DummiesIndex.indexes).to eq([]) } + specify { expect(DummiesIndex.indexes).to eq(['dummies']) } end context do @@ -43,7 +43,7 @@ context do before { DummiesIndex.create! '2013' } - specify { expect(DummiesIndex.aliases).to eq([]) } + specify { expect(DummiesIndex.aliases).to eq(['dummies']) } end end end From 3ba07cc0f73c72cf2422194c582386fbacf74d83 Mon Sep 17 00:00:00 2001 From: Ivan Rabotyaga Date: Mon, 22 Feb 2021 09:36:41 +0000 Subject: [PATCH 14/15] Add ES7 support, prepare 7.0.0 release (#763) --- .circleci/config.yml | 18 +++++++++--------- CHANGELOG.md | 12 ++++++++++-- README.md | 12 +++++++----- lib/chewy/search/request.rb | 1 + lib/chewy/stash.rb | 2 +- lib/chewy/version.rb | 2 +- migration_guide.md | 17 ++++++++++++++--- spec/chewy/runtime_spec.rb | 4 ++-- spec/chewy/search/request_spec.rb | 4 +++- spec/chewy/search/scrolling_spec.rb | 5 +++-- 10 files changed, 51 insertions(+), 26 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3b27311bb..03f9a6a7f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -108,7 +108,7 @@ jobs: rspec-ruby-26-activerecord52: docker: - image: circleci/ruby:2.6 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -120,7 +120,7 @@ jobs: rspec-ruby-26-activerecord60: docker: - image: circleci/ruby:2.6 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -132,7 +132,7 @@ jobs: rspec-ruby-26-activerecord61: docker: - image: circleci/ruby:2.6 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -145,7 +145,7 @@ jobs: docker: - image: circleci/ruby:2.6 - image: circleci/mongo:4.2.5 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -157,7 +157,7 @@ jobs: rspec-ruby-27-activerecord52: docker: - image: circleci/ruby:2.7 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -169,7 +169,7 @@ jobs: rspec-ruby-27-activerecord60: docker: - image: circleci/ruby:2.7 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -181,7 +181,7 @@ jobs: rspec-ruby-27-activerecord61: docker: - image: circleci/ruby:2.7 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -194,7 +194,7 @@ jobs: docker: - image: circleci/ruby:2.7 - image: circleci/mongo:4.2.5 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo @@ -206,7 +206,7 @@ jobs: rspec-ruby-30-activerecord61: docker: - image: circleci/ruby:3.0 - - image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 + - image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1 environment: <<: *es-env working_directory: ~/repo diff --git a/CHANGELOG.md b/CHANGELOG.md index ee725cf46..7c4b0324f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,13 +4,21 @@ ### New Features +### Changes + +### Bugs Fixed + +## 7.0.0 (2021-02-22) + +### New Features + + * [#763](https://github.com/toptal/chewy/pull/763): Added support for Elasticsearch 7 ([@rabotyaga][]) + ### Changes * [#757](https://github.com/toptal/chewy/pull/757): **(Breaking)** Fix `Chewy::Index.index` & `Chewy::Index.aliases` to correctly report indexes and aliases ([@mpeychich][], [@dalthon][]) * [#761](https://github.com/toptal/chewy/pull/761): Avoid fetching scope data to check if it is blank ([@dalthon][]) -### Bugs Fixed - ## 6.0.0 (2021-02-11) ### Changes diff --git a/README.md b/README.md index b15485bf2..3a31309ac 100644 --- a/README.md +++ b/README.md @@ -95,13 +95,15 @@ Chewy is compatible with MRI 2.5-3.0¹. > ¹ Ruby 3 is only supported with Rails 6.1 -### Elasticsearch +### Elasticsearch compatibility matrix -Chewy 5 is compatible with Elasticsearch 5. +| Chewy version | Elasticsearch version | +| ------------- | ---------------------------------- | +| 7.0.0 | 6.8, 7.x | +| 6.0.0 | 5.x, 6.x | +| 5.x | 5.x, limited support for 1.x & 2.x | -Chewy 6 is compatible with Elasticsearch 6. See [Migration guide](migration_guide.md). - -Future versions of Chewy will support Elasticsearch 7. +See [Migration guide](migration_guide.md). ## Usage diff --git a/lib/chewy/search/request.rb b/lib/chewy/search/request.rb index 9221cca49..440f92f1f 100644 --- a/lib/chewy/search/request.rb +++ b/lib/chewy/search/request.rb @@ -990,6 +990,7 @@ def reset def perform(additional = {}) request_body = render.merge(additional) + request_body[:rest_total_hits_as_int] = true if Runtime.version >= '7.0.0' ActiveSupport::Notifications.instrument 'search_query.chewy', notification_payload(request: request_body) do begin diff --git a/lib/chewy/stash.rb b/lib/chewy/stash.rb index 4fae155a5..fc3b5fc24 100644 --- a/lib/chewy/stash.rb +++ b/lib/chewy/stash.rb @@ -24,7 +24,7 @@ class Journal < Chewy::Index # @param since_time [Time, DateTime] a timestamp from which we load a journal # @param only [Chewy::Index, Array] journal entries related to these indices will be loaded only def self.entries(since_time, only: []) - self.for(only).filter(range: {created_at: {gt: since_time}}) + self.for(only).filter(range: {created_at: {gt: since_time}}).filter.minimum_should_match(1) end # Cleans up all the journal entries until the specified time. If nothing is diff --git a/lib/chewy/version.rb b/lib/chewy/version.rb index 861e14c6f..30bb3335a 100644 --- a/lib/chewy/version.rb +++ b/lib/chewy/version.rb @@ -1,3 +1,3 @@ module Chewy - VERSION = '6.0.0'.freeze + VERSION = '7.0.0'.freeze end diff --git a/migration_guide.md b/migration_guide.md index 0ead18efc..7f1cf48f0 100644 --- a/migration_guide.md +++ b/migration_guide.md @@ -4,6 +4,17 @@ This document outlines the steps you need to take when migrating between major v Chewy and Elasticsearch. For simplicity's sake the guide will assume that you're using Chewy alongside a matching Elasticsearch version. +## Chewy 6/Elasticsearch 6 to Chewy 7/Elasticsearch 7 + +In order to upgrade Chewy 6/Elasticsearch 6 to Chewy 7/Elasticsearch 7 in the most seamless manner you have to: + +* Upgrade to the latest 6.x stable releases, namely Chewy 6.0, Elasticsearch 6.8 +* Study carefully [Breaking changes in 7.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.htmll), make sure your application conforms. +* Run your test suite on Chewy 7 / Elasticsearch 7 +* Run manual tests on Chewy 7 / Elasticsearch 7 +* Upgrade to Chewy 7 +* Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference//rolling-upgrades.html) of Elasticsearch + ## Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6 In order to upgrade Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6 in the most seamless manner you have to: @@ -17,7 +28,7 @@ In order to upgrade Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6 in the mo * replace fields with `{ type: 'string', index: 'analyzed'}` by `{type: 'text'}` * `PathHierarchy` tokenizer' param `delimiter` now accepts only one argument, [others should be replaced by character filter ](https://discuss.elastic.co/t/multichar-delimiter-in-path-hierarchy-tokenizer/16203) * Make sure you don't use any other of the [deprecated Elasticsearch 5 features](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/breaking-changes-6.0.html) -* Run your test suite on Elasticsearch 6 -* Run manual tests on Elasticsearch 6 -* Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/rolling-upgrades.html) of Elasticsearch +* Run your test suite on Chewy 6 / Elasticsearch 6 +* Run manual tests on Chewy 6 / Elasticsearch 6 * Upgrade to Chewy 6 +* Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference/6.8/rolling-upgrades.html) of Elasticsearch diff --git a/spec/chewy/runtime_spec.rb b/spec/chewy/runtime_spec.rb index 7126fd8fc..bc21bcacc 100644 --- a/spec/chewy/runtime_spec.rb +++ b/spec/chewy/runtime_spec.rb @@ -3,7 +3,7 @@ describe Chewy::Runtime do describe '.version' do specify { expect(described_class.version).to be_a(described_class::Version) } - specify { expect(described_class.version).to be >= '5.6' } - specify { expect(described_class.version).to be < '7.0' } + specify { expect(described_class.version).to be >= '6.8' } + specify { expect(described_class.version).to be < '8.0' } end end diff --git a/spec/chewy/search/request_spec.rb b/spec/chewy/search/request_spec.rb index 17abd68ff..e75b4b941 100644 --- a/spec/chewy/search/request_spec.rb +++ b/spec/chewy/search/request_spec.rb @@ -420,10 +420,12 @@ outer_payload = payload end subject.query(match: {name: 'name3'}).to_a + request = {index: ['products'], type: %w[product], body: {query: {match: {name: 'name3'}}}} + request[:rest_total_hits_as_int] = true if Chewy::Runtime.version >= '7.0.0' expect(outer_payload).to eq( index: ProductsIndex, indexes: [ProductsIndex], - request: {index: ['products'], type: %w[product], body: {query: {match: {name: 'name3'}}}}, + request: request, type: ProductsIndex::Product, types: [ProductsIndex::Product] ) diff --git a/spec/chewy/search/scrolling_spec.rb b/spec/chewy/search/scrolling_spec.rb index 2ed049892..8e21f4e6c 100644 --- a/spec/chewy/search/scrolling_spec.rb +++ b/spec/chewy/search/scrolling_spec.rb @@ -119,12 +119,13 @@ outer_payload << payload end request.scroll_batches(batch_size: 3).to_a - + request = {index: %w[cities countries], type: %w[city country], body: {sort: ['rating']}, size: 3, scroll: '1m'} + request[:rest_total_hits_as_int] = true if Chewy::Runtime.version >= '7.0.0' expect(outer_payload).to match_array([ hash_including( index: [CitiesIndex, CountriesIndex], indexes: [CitiesIndex, CountriesIndex], - request: {index: %w[cities countries], type: %w[city country], body: {sort: ['rating']}, size: 3, scroll: '1m'}, + request: request, type: [CitiesIndex::City, CountriesIndex::Country], types: [CitiesIndex::City, CountriesIndex::Country] ), From a9b390cff605bff1665000674914c47dec5e93c7 Mon Sep 17 00:00:00 2001 From: Ivan Rabotyaga Date: Mon, 3 May 2021 12:32:03 +0300 Subject: [PATCH 15/15] Prepare 7.0.1 release with skipped ES cluster version memoization for search requests --- .github/workflows/ruby.yml | 94 +++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 7 +++ lib/chewy/search/request.rb | 2 +- lib/chewy/version.rb | 2 +- migration_guide.md | 28 +++++++++-- 5 files changed, 128 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 000000000..bb79ea3de --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,94 @@ +name: CI + +on: [push] + +jobs: + tests: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: [2.6, 2.7] + gemfile: [rails.5.2.activerecord, rails.6.0.activerecord, rails.6.1.activerecord] + name: ${{ matrix.ruby }}-${{ matrix.gemfile }} + + env: + BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile + + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Run Elasticsearch + uses: elastic/elastic-github-actions/elasticsearch@master + with: + stack-version: 7.10.1 + port: 9250 + - name: Tests + run: bundle exec rspec + + ruby-3-0-activerecord-6-1: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run Elasticsearch + uses: elastic/elastic-github-actions/elasticsearch@master + with: + stack-version: 7.10.1 + port: 9250 + - name: Tests + run: bundle exec rspec + + ruby-3-0-activerecord-6-1-es6: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - name: Run Elasticsearch + uses: elastic/elastic-github-actions/elasticsearch@master + with: + stack-version: 6.8.15 + port: 9250 + - name: Tests + run: bundle exec rspec + + ruby-2-7-activerecord-6-1-es6: + runs-on: ubuntu-latest + env: + BUNDLE_GEMFILE: gemfiles/rails.6.1.activerecord.gemfile + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - name: Run Elasticsearch + uses: elastic/elastic-github-actions/elasticsearch@master + with: + stack-version: 6.8.15 + port: 9250 + - name: Tests + run: bundle exec rspec + + rubocop: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7 + bundler-cache: true + - run: bundle exec rubocop --format simple diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c4b0324f..3bd25e130 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ ### Bugs Fixed +## 7.0.1 (2021-05-03) + +### Changes + + * [#792](https://github.com/toptal/chewy/pull/792): Skip ES version memoization for search requests ([@rabotyaga][]) + * See the Migration Guide for details + ## 7.0.0 (2021-02-22) ### New Features diff --git a/lib/chewy/search/request.rb b/lib/chewy/search/request.rb index 440f92f1f..482e6e25b 100644 --- a/lib/chewy/search/request.rb +++ b/lib/chewy/search/request.rb @@ -990,7 +990,7 @@ def reset def perform(additional = {}) request_body = render.merge(additional) - request_body[:rest_total_hits_as_int] = true if Runtime.version >= '7.0.0' + request_body[:rest_total_hits_as_int] = true if Chewy::Runtime::Version.new(Chewy.client.info['version']['number']) >= '7.0.0' ActiveSupport::Notifications.instrument 'search_query.chewy', notification_payload(request: request_body) do begin diff --git a/lib/chewy/version.rb b/lib/chewy/version.rb index 30bb3335a..9b5a23866 100644 --- a/lib/chewy/version.rb +++ b/lib/chewy/version.rb @@ -1,3 +1,3 @@ module Chewy - VERSION = '7.0.0'.freeze + VERSION = '7.0.1'.freeze end diff --git a/migration_guide.md b/migration_guide.md index 7f1cf48f0..d89088653 100644 --- a/migration_guide.md +++ b/migration_guide.md @@ -10,10 +10,32 @@ In order to upgrade Chewy 6/Elasticsearch 6 to Chewy 7/Elasticsearch 7 in the mo * Upgrade to the latest 6.x stable releases, namely Chewy 6.0, Elasticsearch 6.8 * Study carefully [Breaking changes in 7.0](https://www.elastic.co/guide/en/elasticsearch/reference/current/breaking-changes-7.0.htmll), make sure your application conforms. -* Run your test suite on Chewy 7 / Elasticsearch 7 -* Run manual tests on Chewy 7 / Elasticsearch 7 -* Upgrade to Chewy 7 +* Run your test suite on Chewy 7.0 / Elasticsearch 7 +* Run manual tests on Chewy 7.0 / Elasticsearch 7 +* Upgrade to Chewy 7.0 + * 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. + To handle that we have 2 versions of Chewy for this stage of the upgrade: 7.0.0 and 7.0.1. Version 7.0.0 does the memoization and version 7.0.1 requests the current version on every search request. + * You can use the 7.0.0 version if it's fine for you to have an application restart immediately after ES cluster upgrade. + * If you're using the 7.0.1 version you might be interested in keeping the timeframe between this step and the last one as small as possible, as version 7.0.1 skips ES version memoization for search requests to help dynamically detect ES version. This leads to an extra version request on each search request, i.e. could affect the overall performance/latency of the search and a load of ES cluster. * Perform a [rolling upgrade](https://www.elastic.co/guide/en/elasticsearch/reference//rolling-upgrades.html) of Elasticsearch +* Run your test suite on Chewy 7.1 / Elasticsearch 7 +* Run manual tests on Chewy 7.1 / Elasticsearch 7 +* Upgrade to Chewy 7.1 +* Upgrade to Chewy 7.2: + * Remove all the the `Chewy::Type` class usages, e.g. remove `CitiesIndex::City` / `CitiesIndex.city` + * `CitiesIndex::City.import! ...` becomes `CitiesIndex.import! ...` + * Update indexes with simplified DSL: + * `define_type` block -> `index_scope` clause + * it can be omitted completely, if you don't need to specify the scope or options, e.g. `name` + * Remove type names from string representations: + * in `update_index` ActiveRecord helper and RSpec matcher, e.g. + * `update_index('cities#city')` -> `update_index('cities')` + * `update_index(UsersIndex::User)` -> `update_index(UsersIndex)` + * in rake tasks (e.g. `rake chewy:update[cities#city]` -> `rake chewy:update[cities]`) + * rake tasks output is also changed (e.g. `Imported CitiesIndex::City in 1s, stats: index 3` -> `Imported CitiesIndex in 1s, stats: index 3`) + * Use index name instead of type name in loader additional scope + * e.g. `CitiesIndex.filter(...).load(city: {scope: City.where(...)})` -> `CitiesIndex.filter(...).load(cities: {scope: City.where(...)})` ## Chewy 5/Elasticsearch 5 to Chewy 6/Elasticsearch 6