Skip to content

Latest commit

 

History

History
39 lines (26 loc) · 1.71 KB

README.rdoc

File metadata and controls

39 lines (26 loc) · 1.71 KB

Ruby on Rails and Elasticsearch: Example application

This application is an example of integrating the Elasticsearch search engine with the Ruby On Rails web framework.

It has been generated by application templates available at github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-rails/lib/rails/templates.

[1] Basic

The ‘basic` version provides a simple integration for a simple Rails model, `Article`, showing how to include the search engine support in your model, automatically index changes to records, and use a form to perform simple search require ’requests.‘

[2] Pretty

The ‘pretty` template builds on the `basic` version and brings couple of improvements:

  • Using the [Bootstrap](getbootstrap.com) framework to enhance the visual style of the application

  • Using an ‘Article.search` class method to customize the default search definition

  • Highlighting matching phrases in search results

  • Paginating results with Kaminari

[3] Expert

The ‘expert` template changes to a complex database schema with model relationships: article belongs to a category, has many authors and comments.

  • The Elasticsearch integration is refactored into the ‘Searchable` concern

  • A complex mapping for the index is defined

  • A custom serialization is defined in ‘Article#as_indexed_json`

  • The ‘search` method is amended with facets and suggestions

  • A [Sidekiq](sidekiq.org) worker for handling index updates in background is added

  • A custom ‘SearchController` with associated view is added

  • A Rails initializer is added to customize the Elasticsearch client configuration

  • Seed script and example data from New York Times is added