README.md in elasticsearch-transport-0.4.0 vs README.md in elasticsearch-transport-0.4.1
- old
+ new
@@ -1,13 +1,13 @@
-# Elasticsearch::Client
+# Elasticsearch::Transport
**This library is part of the [`elasticsearch-ruby`](https://github.com/elasticsearch/elasticsearch-ruby/) package;
please refer to it, unless you want to use this library standalone.**
----
-The `elasticsearch-client` library provides a Ruby client for connecting
+The `elasticsearch-transport` library provides a low-level Ruby client for connecting
to an [Elasticsearch](http://elasticsearch.org) cluster.
It handles connecting to multiple nodes in the cluster, rotating across connections,
logging and tracing requests and responses, maintaining failed connections,
discovering nodes in the cluster, and provides an abstraction for
@@ -29,34 +29,36 @@
## Installation
Install the package from [Rubygems](https://rubygems.org):
- gem install elasticsearch-client
+ gem install elasticsearch-transport
To use an unreleased version, either add it to your `Gemfile` for [Bundler](http://gembundler.com):
- gem 'elasticsearch-client', git: 'git://github.com/elasticsearch/elasticsearch-ruby.git'
+ gem 'elasticsearch-transport', 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-client
+ cd elasticsearch-ruby/elasticsearch-transport
bundle install
rake install
## Example Usage
In the simplest form, connect to Elasticsearch running on <http://localhost:9200>
without any configuration:
- require 'elasticsearch/client'
+ require 'elasticsearch/transport'
client = Elasticsearch::Client.new
response = client.perform_request 'GET', '_cluster/health'
# => #<Elasticsearch::Transport::Transport::Response:0x007fc5d506ce38 @status=200, @body={ ... } >
+Full documentation is available at <http://rubydoc.info/gems/elasticsearch-transport>.
+
## Configuration
The client supports many configurations options for setting up and managing connections,
configuring logging, customizing the transport library, etc.
@@ -76,10 +78,14 @@
Instead of Strings, you can pass host information as an array of Hashes:
Elasticsearch::Client.new hosts: [ { host: 'myhost1', port: 8080 }, { host: 'myhost2', port: 8080 } ]
+Scheme, HTTP authentication credentials and URL prefixes are handled automatically:
+
+ Elasticsearch::Client.new url: 'https://myserver:4430/search'
+
### Logging
To log requests and responses to standard output with the default logger (an instance of Ruby's {::Logger}) class):
Elasticsearch::Client.new log: true
@@ -206,9 +212,20 @@
transport = Elasticsearch::Transport::Transport::HTTP::Curb.new \
hosts: [ { host: 'localhost', port: '9200' } ],
&configuration
client = Elasticsearch::Client.new transport: transport
+
+Instead of passing the transport to the constructor, you can inject it at run time:
+
+ faraday_client = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
+ hosts: [ { host: '33.33.33.10', port: '443', user: 'USERNAME', password: 'PASSWORD', scheme: 'https' } ],
+ & lambda { |f| f.instance_variable_set :@ssl, { verify: false }
+ f.options[:ssl] = { verify: false }
+ f.adapter :excon }
+
+ client = Elasticsearch::Client.new
+ client.transport = faraday_client
You can write your own transport implementation easily, by including the
{Elasticsearch::Transport::Transport::Base} module, implementing the required contract,
and passing it to the client as the `transport_class` parameter. All the arguments
passed to client will be passed as the `:options` parameter to the transport constructor.