Troubleshooting
editTroubleshooting
editThe 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 Elasticsearch with the client, we suggest enabling tracing
on the client and testing the cURL command that appears in your terminal:
client = Elasticsearch::Client.new(trace: true) client.info 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.2, User-Agent: elastic-t 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.
Connection
editWhen 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 Retrying on Failures).
For optimal performance, use a HTTP library which supports persistent ("keep-alive") connections, such as patron or 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.
More Help
editIf you need more help, you can hop on our 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 submit an issue on GitHub.