Elasticsearch

The elasticsearch library provides a Ruby client and API for Elasticsearch.

Features overview:

(For integration with Ruby models and Rails applications, see the github.com/elasticsearch/elasticsearch-rails project.)

Compatibility

The Elasticsearch client for Ruby is compatible with Ruby 1.9 and higher.

The client's API is compatible with Elasticsearch's API versions from 0.90 till current, just use a release matching major version of Elasticsearch.

| Ruby | | Elasticsearch | |:————-:|:-:| :———–: | | 0.90 | → | 0.90 | | 1.x | → | 1.x | | 2.x | → | 2.x | | 5.x | → | 5.x | | 6.x | → | 6.x | | 7.x | → | 7.x | | master | → | master |

Installation

Install the package from Rubygems:

gem install elasticsearch

To use an unreleased version, either add it to your Gemfile for Bundler:

gem 'elasticsearch', git: 'git://github.com/elasticsearch/elasticsearch-ruby.git'

or install it from a source code checkout:

git clone https://github.com/elasticsearch/elasticsearch-ruby.git
cd elasticsearch-ruby/elasticsearch
bundle install
rake install

Usage

This library is a wrapper for two separate libraries:

Install the elasticsearch package and use the API directly:

require 'elasticsearch'

client = Elasticsearch::Client.new log: true

client.cluster.health

client.transport.reload_connections!

client.search q: 'test'

# etc.

Please refer to the specific library documentation for details:

Development

You can run rake -T to check the test tasks. Use COVERAGE=true before running a test task to check the coverage with Simplecov.

License

This software is licensed under the Apache 2 license.