Skip to content
A simple framework to learn and play with elasticsearch.
Find file
Pull request Compare This branch is even with UXScripts:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
config
examples
.gitignore
Brewfile
Gemfile
Procfile
README.md
Rakefile
VERSION

README.md

elasticsearch by example

elasticsearch by example is a simple framework to learn and play with elasticsearch.

It will help you get started in elasticsearch and provide a sandbox for experimentation and comparison of features.

Each example contains a info file with the key information on the feature, sample data, a mapping file and a search query. You can see the output directly into the console.

It is important that the program is kept as simple as possible. A elasticsearch beginner should easily understand each step.

I have deliberately used raw JSON structures to facilitate communication with elasticsearch using the REST API to make it clear.

Requirements

Installation

Clone the project repository from GitHub:

git clone git://github.com/rmoszczynski/elasticsearch-by-example.git
cd elasticsearch-by-example
bundle install

If you have already installed elasticsearch local or on a remote machine you're done.

To install elasticsearch on Mac with Homebrew type:

brewdle install

Configuration

elasticsearch by example uses its own elasticsearch configuration file stored in config/elasticsearch.yml.

To use a remote elasticsearch installation please customize the host and port values in the config/settings.yml script.

Usage

If you have not yet run a elasticsearch instance, you can start one:

bundle exec foreman start

To run an example:

rake run[queries/text]

As you can see the run task takes one parameter, a path to a selected example directory relative to the examples directory in the root of this project.

You can list all examples by using the list task:

rake list

To run only the query without create a new index, apply mapping and index documents use the run:query task:

rake run:query[queries/text]

To see all Rake tasks:

rake -T

Links

Feedback

You can send feedback via GitHub Issues.

License

elasticsearch by example.

All files in this project are licensed under the following license:

Copyright (c) 2012, Robert Moszczynski. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Robert Moszczynski GitHub

Something went wrong with that request. Please try again.