You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -77,9 +77,7 @@ Both of these libraries are extensively documented.
77
77
and the [`elasticsearch-api`](http://rubydoc.info/gems/elasticsearch-api) documentation carefully.**
78
78
79
79
_Keep in mind, that for optimal performance, you should use a HTTP library which supports persistent
80
-
("keep-alive") connections, e.g. [Patron](https://github.com/toland/patron) or
81
-
[Typhoeus](https://github.com/typhoeus/typhoeus)._ These libraries are not dependencies of the elasticsearch gems, so
82
-
be sure to define a dependency in your own application.
80
+
("keep-alive") connections, e.g. [Patron](https://github.com/toland/patron)._ These libraries are not dependencies of the elasticsearch gems, so be sure to define a dependency in your own application.
83
81
84
82
This repository contains these additional Ruby libraries:
**Note on [Typhoeus](https://github.com/typhoeus/typhoeus)**: Typhoeus is compatible and will be automatically detected too. However, the latest release (v1.3.1 at the moment of writing this) is not compatible with Faraday 1.0. [It still uses the deprecated `Faraday::Error` namespace](https://github.com/typhoeus/typhoeus/blob/v1.3.1/lib/typhoeus/adapters/faraday.rb#L100). If you want to use it with this gem, we suggest getting `master` from GitHub, since this has been fixed for v1.4.0. We'll update this if/when v1.4.0 is released.a
37
41
38
42
For detailed information, see example configurations [below](#transport-implementations).
39
43
@@ -366,34 +370,35 @@ constructor, use the `transport_options` key:
366
370
367
371
To configure the _Faraday_ instance directly, use a block:
368
372
369
-
require 'typhoeus'
370
-
require 'typhoeus/adapters/faraday'
373
+
require 'patron'
371
374
372
375
client = Elasticsearch::Client.new(host: 'localhost', port: '9200') do |f|
373
376
f.response :logger
374
-
f.adapter :typhoeus
377
+
f.adapter :patron
375
378
end
376
379
377
380
You can use any standard Faraday middleware and plugins in the configuration block, for example sign the requests for the [AWS Elasticsearch service](https://aws.amazon.com/elasticsearch-service/). See [the AWS documentation](https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-request-signing.html#es-request-signing-ruby) for an example.
378
381
379
382
You can also initialize the transport class yourself, and pass it to the client constructor
380
383
as the `transport` argument:
381
384
382
-
require 'typhoeus'
383
-
require 'typhoeus/adapters/faraday'
385
+
```ruby
386
+
require'patron'
384
387
385
-
transport_configuration = lambda do |f|
386
-
f.response :logger
387
-
f.adapter :typhoeus
388
-
end
388
+
transport_configuration =lambdado |f|
389
+
f.response :logger
390
+
f.adapter :patron
391
+
end
389
392
390
-
transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
391
-
hosts: [ { host: 'localhost', port: '9200' } ],
392
-
&transport_configuration
393
+
transport =Elasticsearch::Transport::Transport::HTTP::Faraday.new \
394
+
hosts: [ { host:'localhost', port:'9200' } ],
395
+
&transport_configuration
396
+
397
+
# Pass the transport to the client
398
+
#
399
+
client =Elasticsearch::Client.newtransport: transport
400
+
```
393
401
394
-
# Pass the transport to the client
395
-
#
396
-
client = Elasticsearch::Client.new transport: transport
397
402
398
403
Instead of passing the transport to the constructor, you can inject it at run time:
0 commit comments