index.asciidoc 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. = elasticsearch-ruby
  2. == Overview
  3. There's a suite of official Ruby libraries for Elasticsearch, which provide a client for connecting
  4. to Elasticsearch clusters, Ruby interface to the REST API, and more.
  5. See the full documentation at http://github.com/elasticsearch/elasticsearch-ruby.
  6. === Elasticsearch Version Compatibility
  7. The Ruby libraries are compatible with both Elasticsearch 0.90.x and 1.0.x versions,
  8. but you have to install a matching http://rubygems.org/gems/elasticsearch/versions[gem version]:
  9. [cols="<,<",options="header",]
  10. |=========================================
  11. | Elasticsearch version | Ruby gem version
  12. | 0.90.x | 0.4.x
  13. | 1.0.x | 1.x
  14. |=========================================
  15. === Installation
  16. Install the Ruby gem for Elasticsearch *1.x*:
  17. [source,sh]
  18. ------------------------------------
  19. gem install elasticsearch
  20. ------------------------------------
  21. ...or add it do your Gemfile:
  22. [source,ruby]
  23. ------------------------------------
  24. gem 'elasticsearch'
  25. ------------------------------------
  26. Install the Ruby gem for Elasticsearch *0.90.x*:
  27. [source,sh]
  28. ------------------------------------
  29. gem install elasticsearch -v 0.4.10
  30. ------------------------------------
  31. ...or add it do your Gemfile:
  32. [source,ruby]
  33. ------------------------------------
  34. gem 'elasticsearch', '~> 0.4'
  35. ------------------------------------
  36. === Example Usage
  37. [source,ruby]
  38. ------------------------------------
  39. require 'elasticsearch'
  40. client = Elasticsearch::Client.new log: true
  41. client.cluster.health
  42. client.index index: 'my-index', type: 'my-document', id: 1, body: { title: 'Test' }
  43. client.indices.refresh index: 'my-index'
  44. client.search index: 'my-index', body: { query: { match: { title: 'test' } } }
  45. ------------------------------------
  46. === Features at a Glance
  47. * Pluggable logging and tracing
  48. * Plugabble connection selection strategies (round-robin, random, custom)
  49. * Pluggable transport implementation, customizable and extendable
  50. * Pluggable serializer implementation
  51. * Request retries and dead connections handling
  52. * Node reloading (based on cluster state) on errors or on demand
  53. * Modular API implementation
  54. * 100% REST API coverage
  55. == Copyright and License
  56. This software is Copyright (c) 2013 by Elasticsearch BV.
  57. This is free software, licensed under The Apache License Version 2.0.