title: Elasticsearch SocketError (getaddrinfo: Name or service not known)
body: <p>I'm using the Tire gem in Ruby on Rails to use Elasticsearch for searching. On my local machine it works great.</p>
  
  <p>On my staging server I (randomly?) get this error:
  <code>SocketError (getaddrinfo: Name or service not known)</code></p>
  
  <p>Sometimes it works great and is very fast, and sometimes it just throws that error.</p>
  
  <p>Elasticsearch is running on the same server and the url it uses is:
  <code>http://localhost:9200</code></p>
  
  <p>I have this in my hosts file:</p>
  
  <pre><code>127.0.0.1   staging-server.mydomain.com staging-server
  </code></pre>
  
  <p>Where subdomain and domain are set correctly.</p>
  
  <p>What could be the cause of the errors and why does it only happen sometimes?</p>