Chewy extends the Elasticsearch-Ruby, Making it more Powerful and Providing Tighter Integration with Rails.
Elasticsearch provides a powerful, RESTful HTTP interface for indexing and querying data, built on top of the Apache Lucene library. it provides scalable, efficient, and robust search, with UTF-8 support. It’s a powerful tool for indexing and querying massive amounts of structured data.
Despite Elasticsearch’s scalability and efficiency, integration it with Rails didn’t end up to be quite as straightforward as anticipated. And thus, the Chewy gem was born.
A few notably noteworthy options of Chewy include:
1. Each index is discernible by all the connected models:
Most indexed models square measure associated with one another. And generally, it’s necessary to denormalize this connected information and bind it to a similar object (e.g., if you wish to index associate degree array of tags beside their associated article). Chewy permits you to specify associate degree updatable index for each model, thus corresponding articles are going to be re-indexed whenever a relevant tag is updated.
2. Index categories square measure freelance from ORM/ODM models:
With this improvement, implementing cross-model auto-completion, as an example, is far easier. you'll simply outline associate degree index and work with it in object-oriented fashion. not like alternative shoppers, the Chewy gem removes the requirement to manually implement index categories, information import callbacks, and alternative elements.
3. Bulk import is everywhere:
Chewy utilizes the majority Elasticsearch API for full re-indexing and index updates. It additionally utilizes the conception of atomic updates, aggregation modified objects among associate degree atomic block and change all of them right away.
4. Chewy provides associate degree AR-style question DSL.
By being chainable, mergable, and lazy, this improvement permits queries to be created in a very additional economical manner.