Skip to content

Commit

Permalink
[DOCS] Reviews troubleshooting docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
szabosteve authored and picandocodigo committed Feb 19, 2024
1 parent fc5c65d commit 7b8d4f6
Showing 1 changed file with 48 additions and 12 deletions.
60 changes: 48 additions & 12 deletions docs/troubleshooting.asciidoc
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
[[troubleshooting]]
== Troubleshooting

The client provides several options for logging that can help when things go wrong. Check out the extensive documentation on <<logging>>.
Use the information in this section to troubleshoot common problems and find
answers for frequently asked questions.

If you are having trouble sending a request to {es} with the client, we suggest enabling `tracing` on the client and testing the cURL command that appears in your terminal:

[discrete]
[[ruby-ts-logging]]
=== Logging

The client provides several options for logging that can help when things go
wrong. Check out the extensive documentation on <<logging>>.

If you are having trouble sending a request to {es} with the client, we suggest
enabling `tracing` on the client and testing the cURL command that appears in
your terminal:

[source,rb]
----------------------------
Expand All @@ -13,25 +24,43 @@ curl -X GET -H 'x-elastic-client-meta: es=8.9.0,rb=3.2.2,t=8.2.1,fd=2.7.4,nh=0.3
ransport-ruby/8.2.1 (RUBY_VERSION: 3.2.2; linux x86_64; Faraday v2.7.4), Content-Type: application/json' 'http://localhost:9200//?pretty'
----------------------------

Testing the cURL command can help find out if there's a connection issue or if the issue is in the client code.
Testing the cURL command can help find out if there's a connection issue or if
the issue is in the client code.


[discrete]
=== Connection
When working with multiple hosts, you might want to enable the `retry_on_failure` or `retry_on_status` options to perform a failed request on another node (refer to <<retry-failures>>).
[[ruby-ts-connection]]
=== Troubleshooting connection issues

When working with multiple hosts, you might want to enable the
`retry_on_failure` or `retry_on_status` options to perform a failed request on
another node (refer to <<retry-failures>>).

For optimal performance, use a HTTP library which supports persistent
("keep-alive") connections, such as https://github.com/toland/patron[patron] or
https://github.com/typhoeus/typhoeus[Typhoeus]. Require the library
(`require 'patron'`) in your code for Faraday 1.x or the adapter
(`require 'faraday/patron'`) for Faraday 2.x, and it will be automatically used.

For optimal performance, use a HTTP library which supports persistent ("keep-alive") connections, such as https://github.com/toland/patron[patron] or https://github.com/typhoeus/typhoeus[Typhoeus]. Require the library (`require 'patron'`) in your code for Faraday 1.x or the adapter (`require 'faraday/patron'`) for Faraday 2.x, and it will be automatically used.

[discrete]
[[ruby-ts-adapter]]
=== Adapter is not registered on Faraday

If you see a message like:
```
:adapter is not registered on Faraday::Adapter (Faraday::Error)
```

Then you probably need to include the adapter library in your Gemfile and require it. You might get this error when migrating from Faraday v1 to Faraday v2. The main change when using Faraday v2 is all adapters, except for the default `net_http` one, have been moved out into separate gems. This means if you're not using the default adapter and you migrate to Faraday v2, you'll need to add the adapter gems to your Gemfile.
Then you might need to include the adapter library in your Gemfile and require
it. You might get this error when migrating from Faraday v1 to Faraday v2. The
main change when using Faraday v2 is all adapters, except for the default
`net_http` one, have been moved out into separate gems. This means if you're not
using the default adapter and you migrate to Faraday v2, you'll need to add the
adapter gems to your Gemfile.

These are the gems required for the different adapters with Faraday 2, instead of the libraries on which they were based:
These are the gems required for the different adapters with Faraday 2, instead
of the libraries on which they were based:

[source,ruby]
------------------------------------
Expand All @@ -48,14 +77,21 @@ gem 'faraday-patron'
gem 'faraday-typhoeus'
------------------------------------

Things should work fine if you migrate to Faraday 2 as long as you include the adapter (unless you're using the default one `net-http`), but worst case scenario, you can always lock the version of Faraday in your project to 1.x:
Migrating to Faraday 2 solves the issue as long as the adapter is included
(unless you're using the default one `net-http`). Alternatively, you can lock
the version of Faraday in your project to 1.x:
`gem 'faraday', '~> 1'`

Be aware if migrating to Faraday v2 that it requires at least Ruby `2.6`, unlike Faraday v1 which requires `2.4`.
IMPORTANT: Migrating to Faraday v2 requires at least Ruby `2.6`. Faraday v1
requires `2.4`.

[discrete]
=== More Help

If you need more help, you can hop on our https://discuss.elastic.co/[Elastic community forums] and get answers from the experts in the community, including people from Elastic.
If you need more help, visit the
https://discuss.elastic.co/[Elastic community forums] and get answers from the
experts in the community, including people from Elastic.

If you find a bug, have feedback, or find any other issue using the client, please https://github.com/elastic/elasticsearch-ruby/issues/new/choose[submit an issue] on GitHub.
If you find a bug, have feedback, or find any other issue using the client,
https://github.com/elastic/elasticsearch-ruby/issues/new/choose[submit an issue]
on GitHub.

0 comments on commit 7b8d4f6

Please sign in to comment.