|
1 | 1 | # Elasticsearch::Rails
|
2 | 2 |
|
3 |
| -Ruby On Rails Integrations for Elasticsearch |
| 3 | +The `elasticsearch-rails` library is a companion for the |
| 4 | +the [`elasticsearch-model`](https://github.com/elasticsearch/elasticsearch-rails/tree/master/elasticsearch-model) |
| 5 | +library, providing features suitable for Ruby on Rails applications. |
4 | 6 |
|
| 7 | +## Installation |
| 8 | + |
| 9 | +Install the package from [Rubygems](https://rubygems.org): |
| 10 | + |
| 11 | + gem install elasticsearch-rails |
| 12 | + |
| 13 | +To use an unreleased version, either add it to your `Gemfile` for [Bundler](http://bundler.io): |
| 14 | + |
| 15 | + gem 'elasticsearch-rails', git: 'git://github.com/elasticsearch/elasticsearch-rails.git' |
| 16 | + |
| 17 | +or install it from a source code checkout: |
| 18 | + |
| 19 | + git clone https://github.com/elasticsearch/elasticsearch-rails.git |
| 20 | + cd elasticsearch-rails/elasticsearch-rails |
| 21 | + bundle install |
| 22 | + rake install |
| 23 | + |
| 24 | +## Usage |
| 25 | + |
| 26 | +You can generate a fully working example Ruby on Rails application, with an `Article` model and a search form, |
| 27 | +to play with (it even downloads _Elasticsearch_ itself, generates the application skeleton and leaves you with |
| 28 | +a _Git_ repository to explore the steps and the code): |
| 29 | + |
| 30 | +```bash |
| 31 | +rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/01-basic.rb |
| 32 | +``` |
| 33 | + |
| 34 | +Run the same command with the `02-pretty` template to add features such as a custom `Article.search` method, |
| 35 | +result highlighting and [_Bootstrap_](http://getbootstrap.com) integration: |
| 36 | + |
| 37 | +```bash |
| 38 | +rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/02-pretty.rb |
| 39 | +``` |
| 40 | + |
| 41 | +NOTE: A third, much more complex template, demonstrating other features such as faceted navigation or |
| 42 | + query suggestions is being worked on. |
| 43 | + |
| 44 | +## TODO |
| 45 | + |
| 46 | +This is an initial release of the `elasticsearch-rails` library. Many more features are planned and/or |
| 47 | +being worked on, such as: |
| 48 | + |
| 49 | +* Rake tasks for convenient (re)indexing your models from the command line |
| 50 | +* Hooking into Rails' notification system to display Elasticsearch related statistics in the application log |
| 51 | +* Instrumentation support for NewRelic integration |
| 52 | + |
| 53 | +## License |
| 54 | + |
| 55 | +This software is licensed under the Apache 2 license, quoted below. |
| 56 | + |
| 57 | + Copyright (c) 2014 Elasticsearch <http://www.elasticsearch.org> |
| 58 | + |
| 59 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 60 | + you may not use this file except in compliance with the License. |
| 61 | + You may obtain a copy of the License at |
| 62 | + |
| 63 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 64 | + |
| 65 | + Unless required by applicable law or agreed to in writing, software |
| 66 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 67 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 68 | + See the License for the specific language governing permissions and |
| 69 | + limitations under the License. |
0 commit comments