summaryrefslogtreecommitdiff
path: root/docs/ruby/index.asciidoc
blob: 553b931cab2729a232bdcd9bd5565c3ec7d5406f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
= elasticsearch-ruby

== Overview

There's a suite of official Ruby libraries for Elasticsearch, which provide a client for connecting
to Elasticsearch clusters, Ruby interface to the REST API, and more.

See the full documentation at http://github.com/elasticsearch/elasticsearch-ruby.

=== Elasticsearch Version Compatibility

The Ruby libraries are compatible with both Elasticsearch 0.90.x and 1.0.x versions,
but you have to install a matching http://rubygems.org/gems/elasticsearch/versions[gem version]:

[cols="<,<",options="header",]
|=========================================
| Elasticsearch version | Ruby gem version
| 0.90.x                | 0.4.x
| 1.0.x                 | 1.x
|=========================================

=== Installation

Install the Ruby gem for Elasticsearch *1.x*:

[source,sh]
------------------------------------
gem install elasticsearch
------------------------------------

...or add it do your Gemfile:

[source,ruby]
------------------------------------
gem 'elasticsearch'
------------------------------------

Install the Ruby gem for Elasticsearch *0.90.x*:

[source,sh]
------------------------------------
gem install elasticsearch -v 0.4.10
------------------------------------

...or add it do your Gemfile:

[source,ruby]
------------------------------------
gem 'elasticsearch', '~> 0.4'
------------------------------------

=== Example Usage

[source,ruby]
------------------------------------
require 'elasticsearch'

client = Elasticsearch::Client.new log: true

client.cluster.health

client.index index: 'my-index', type: 'my-document', id: 1, body: { title: 'Test' }

client.indices.refresh index: 'my-index'

client.search index: 'my-index', body: { query: { match: { title: 'test' } } }
------------------------------------


=== Features at a Glance

* Pluggable logging and tracing
* Plugabble connection selection strategies (round-robin, random, custom)
* Pluggable transport implementation, customizable and extendable
* Pluggable serializer implementation
* Request retries and dead connections handling
* Node reloading (based on cluster state) on errors or on demand
* Modular API implementation
* 100% REST API coverage


== Copyright and License

This software is Copyright (c) 2013 by Elasticsearch BV.

This is free software, licensed under The Apache License Version 2.0.