README.md in elasticsearch-transport-0.4.1 vs README.md in elasticsearch-transport-0.4.2

- old
+ new

@@ -80,15 +80,15 @@ 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' + Elasticsearch::Client.new url: 'https://username:password@api.server.org:4430/search' ### Logging -To log requests and responses to standard output with the default logger (an instance of Ruby's {::Logger}) class): +To log requests and responses to standard output with the default logger (an instance of Ruby's {::Logger} class): Elasticsearch::Client.new log: true To trace requests and responses in the `curl` format: @@ -167,11 +167,11 @@ class RackIdSelector include Elasticsearch::Transport::Transport::Connections::Selector::Base def select(options={}) - connections.reject do |c| + connections.select do |c| # Try selecting the nodes with a `rack_id:x1` attribute first c.host[:attributes] && c.host[:attributes][:rack_id] == 'x1' end.sample || connections.to_a.sample end end @@ -205,28 +205,30 @@ client = Elasticsearch::Client.new transport_class: Elasticsearch::Transport::Transport::HTTP::Curb It's possible to customize the _Curb_ instance by passing a block to the constructor as well: - configuration = lambda { |c| c.verbose = true } + configuration = lambda do |c| + c.verbose = true + end 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 } + 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 + 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. @@ -243,12 +245,12 @@ ## Development and Community For local development, clone the repository and run `bundle install`. See `rake -T` for a list of available Rake tasks for running tests, generating documentation, starting a testing cluster, etc. -Bug fixes and features must be accompanying by unit tests. Integration tests are written in Ruby 1.9 syntax. +Bug fixes and features must be covered by unit tests. Integration tests are written in Ruby 1.9 syntax. -Github's pull requests and issues are used to send code contributions and bug reports. +Github's pull requests and issues are used to communicate, send bug reports and code contributions. ## The Architecture * {Elasticsearch::Transport::Client} is composed of {Elasticsearch::Transport::Transport}