Project

rubberband

0.09
No commit activity in last 3 years
No release in over 3 years
An ElasticSearch client with ThriftClient-like failover handling.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.9.0
>= 0
~> 2.0
>= 0.3.8

Runtime

~> 0.8.0
 Project Readme

RubberBand is deprecated and will not be maintained. Consider the official ElasticSearch Ruby client at https://github.com/elasticsearch/elasticsearch-ruby.

RubberBand

Build Status Code Climate

An ElasticSearch client with ThriftClient-like failover handling.

License

Copyright 2010-2012 Grant Rodgers. 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:

  client = ElasticSearch::Client.new('127.0.0.1:9200') do |conn|
    conn.response :logger
    conn.adapter Faraday.default_adapter
  end

API:

  client.default_index = "test_index"
  client.default_type  = "test_type"
  client.index({:body => "elasticsearch is cool"}, :id => 1)  
  client.get("1")  
  client.search("body:elasticsearch")  

TODO

See TODO file.

Contributing

http://github.com/grantr/rubberband

Fork, code, send pull request