Skip to content

Update README for generating app with template #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,20 @@ Article.import
```

You can generate a simple Ruby on Rails application with a single command
(see the [other available templates](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-rails#rails-application-templates)):
(see the [other available templates](https://github.com/elastic/elasticsearch-rails/tree/master/elasticsearch-rails#rails-application-templates)). You'll need to have an Elasticsearch cluster running on your system before generating the app. The easiest way of getting this set up is by running it with Docker with this command:

```bash
docker run \
--name elasticsearch-rails-searchapp \
--publish 9200:9200 \
--env "discovery.type=single-node" \
--env "cluster.name=elasticsearch-rails" \
--env "cluster.routing.allocation.disk.threshold_enabled=false" \
--rm \
docker.elastic.co/elasticsearch/elasticsearch-oss:7.6.0
```

Once Elasticsearch is running, you can generate the simple app with this command:

```bash
rails new searchapp --skip --skip-bundle --template https://raw.github.com/elasticsearch/elasticsearch-rails/master/elasticsearch-rails/lib/rails/templates/01-basic.rb
Expand Down
5 changes: 3 additions & 2 deletions elasticsearch-rails/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ is compatible with the Elasticsearch `master` branch, therefore, with the next m
| 2.x | → | 2.x |
| 5.x | → | 5.x |
| 6.x | → | 6.x |
| 7.x | → | 7.x |
| master | → | master |

## Installation
Expand Down Expand Up @@ -98,8 +99,8 @@ You should see the duration of the request to Elasticsearch as part of each log
### Rails Application Templates

You can generate a fully working example Ruby on Rails application, with an `Article` model and a search form,
to play with (it even downloads _Elasticsearch_ itself, generates the application skeleton and leaves you with
a _Git_ repository to explore the steps and the code) with the
to play with (it generates the application skeleton and leaves you with a _Git_ repository to explore the
steps and the code) with the
[`01-basic.rb`](https://github.com/elastic/elasticsearch-rails/blob/master/elasticsearch-rails/lib/rails/templates/01-basic.rb) template:

```bash
Expand Down
4 changes: 2 additions & 2 deletions elasticsearch-rails/lib/rails/templates/01-basic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

# ----- Check for Elasticsearch -------------------------------------------------------------------

required_elasticsearch_version = '6'
required_elasticsearch_version = '7'

docker_command =<<-CMD.gsub(/\s{1,}/, ' ').strip
docker run \
Expand All @@ -54,7 +54,7 @@
--env "cluster.name=elasticsearch-rails" \
--env "cluster.routing.allocation.disk.threshold_enabled=false" \
--rm \
docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.0
docker.elastic.co/elasticsearch/elasticsearch-oss:7.6.0
CMD

begin
Expand Down