SSL certificate error with elasticsearch gem on ruby 2.2.2

I don't know exactly why but with Ruby 2.2.2p95 on OSX I get the following error when I try to use the elasticsearch gem:

Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

To fix it, just try to avoid using rubys build in Net::HTTP lib and switch to another one (for example typheous). Just add it to your Gemfile, let Bundler run and the elasticsearch gem will use it by itself:

gem 'typhoeus', require: 'typhoeus/adapters/faraday'