<commit_before># RubberBand
[![Build Status](https://secure.travis-ci.org/grantr/rubberband.png?branch=master)](http://travis-ci.org/grantr/rubberband)

An ElasticSearch client with ThriftClient-like failover handling.

## License

Copyright 2010-2012 <NAME>. See included LICENSE file.

## Features

* Automatic failover, retry, and peer discovery
* Support for multiple transports (HTTP, Thrift, Memcached TODO)
* Support for multiple encodings (JSON (Yajl), Smile TODO)

## Supported Rubies

Tested on 1.8.7, 1.9.2, 1.9.3, and Rubinius in 1.8 and 1.9 mode. Ruby 1.8.6 is NOT supported due to missing String#bytesize.

## Usage

Instantiate a client:

    client = ElasticSearch.new('http://127.0.0.1:9200', :index => "twitter", :type => "tweet")

Instantiate a client with multiple servers:
  
    client = ElasticSearch.new(['127.0.0.1:9200', '127.0.0.1:9201'])

Instantiate a client using a Heroku URL (this sets the default index):

    client = ElasticSearch.new(ENV['ELASTICSEARCH_URL'])

Connect using the thrift transport (requires the thrift gem and elasticsearch thrift plugin to be installed):

    client = ElasticSearch.new('127.0.0.1:9500', :transport => ElasticSearch::Transport::Thrift)

Pass a block to Faraday to configure middleware and options:

```ruby<commit_msg>Update readme to mention multi_json and faraday<commit_after># RubberBand
[![Build Status](https://secure.travis-ci.org/grantr/rubberband.png?branch=master)](http://travis-ci.org/grantr/rubberband)

An ElasticSearch client with ThriftClient-like failover handling.

## License

Copyright 2010-2012 <NAME>. See included LICENSE file.

## Features

* Automatic failover, retry, and peer discovery
* Support for multiple transports (HTTP, Thrift, Memcached)
* Support for multiple encodings (JSON, Smile TODO)

Rubberband uses MultiJson for JSON encoding and decoding and supports all JSON backends that MultiJson supports.

The HTTP transport uses Faraday, which also supports a number of http backends. Choose the one that works best for you.

## Supported Rubies

Tested on 1.8.7, 1.9.2, 1.9.3, and Rubinius in 1.8 and 1.9 mode. Ruby 1.8.6 is NOT supported due to missing String#bytesize.

## Usage

Instantiate a client:

    client = ElasticSearch.new('http://127.0.0.1:9200', :index => "twitter", :type => "tweet")

Instantiate a client with multiple servers:
  
    client = ElasticSearch.new(['127.0.0.1:9200', '127.0.0.1:9201'])

Instantiate a client using a Heroku URL (this sets the default index):

    client = ElasticSearch.new(ENV['ELASTICSEARCH_URL'])

Connect using the thrift transport (requires the thrift gem and elasticsearch thrift plugin to be installed):

    client = ElasticSearch.new('127.0.0.1:9500', :transport => ElasticSearch::Transport::Thrift)

Pass a block to Faraday to configure middleware and options:

```ruby
{'fraction_non_alphanumeric': 0.11232779936418227, 'fraction_numerical': 0.04521370540445072, 'mean_word_length': 4.652694610778443, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '431159', 'n_tokens_mistral': 974, 'n_tokens_neox': 891, 'n_words': 298}