This application is an example of integrating the {Elasticsearch}[http://www.elasticsearch.org] search engine with the {Ruby On Rails}[http://rubyonrails.org] web framework.
It has been generated by application templates available at https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-rails/lib/rails/templates.
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.'
The pretty
template builds on the basic
version and brings couple of improvements:
- Using the Bootstrap 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
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 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
The dsl
template refactors the search definition in SearchController#index
to use the elasticsearch-dsl
Rubygem for better expresivity and readability of the code.
The settings-files
template refactors the Searchable
module to load the index settings
from an external file.