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
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -72,9 +72,7 @@ Both of these libraries are extensively documented.
72
72
and the [`elasticsearch-api`](http://rubydoc.info/gems/elasticsearch-api) documentation carefully.**
73
73
74
74
_Keep in mind, that for optimal performance, you should use a HTTP library which supports persistent
75
-
("keep-alive") connections, e.g. [Patron](https://github.com/toland/patron) or
76
-
[Typhoeus](https://github.com/typhoeus/typhoeus)._ These libraries are not dependencies of the elasticsearch gems, so
77
-
be sure to define a dependency in your own application.
75
+
("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.
78
76
79
77
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
@@ -351,34 +355,35 @@ constructor, use the `transport_options` key:
351
355
352
356
To configure the _Faraday_ instance directly, use a block:
353
357
354
-
require 'typhoeus'
355
-
require 'typhoeus/adapters/faraday'
358
+
require 'patron'
356
359
357
360
client = Elasticsearch::Client.new(host: 'localhost', port: '9200') do |f|
358
361
f.response :logger
359
-
f.adapter :typhoeus
362
+
f.adapter :patron
360
363
end
361
364
362
365
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.
363
366
364
367
You can also initialize the transport class yourself, and pass it to the client constructor
365
368
as the `transport` argument:
366
369
367
-
require 'typhoeus'
368
-
require 'typhoeus/adapters/faraday'
370
+
```ruby
371
+
require'patron'
369
372
370
-
transport_configuration = lambda do |f|
371
-
f.response :logger
372
-
f.adapter :typhoeus
373
-
end
373
+
transport_configuration =lambdado |f|
374
+
f.response :logger
375
+
f.adapter :patron
376
+
end
374
377
375
-
transport = Elasticsearch::Transport::Transport::HTTP::Faraday.new \
376
-
hosts: [ { host: 'localhost', port: '9200' } ],
377
-
&transport_configuration
378
+
transport =Elasticsearch::Transport::Transport::HTTP::Faraday.new \
379
+
hosts: [ { host:'localhost', port:'9200' } ],
380
+
&transport_configuration
381
+
382
+
# Pass the transport to the client
383
+
#
384
+
client =Elasticsearch::Client.newtransport: transport
385
+
```
378
386
379
-
# Pass the transport to the client
380
-
#
381
-
client = Elasticsearch::Client.new transport: transport
382
387
383
388
Instead of passing the transport to the constructor, you can inject it at run time:
0 commit comments