title: Ruby On Rails: ElasticSearch authentication (Tire and ElasticSearch-rails)
body: <p>I have a Ruby On Rails app deployed on Heroku, Im using the ElasticSearch add-on, my elastic search clusters were working normally but recently ElasticSearch add-on required all clusters to enforce authentication to protect the data that is inside of the hosted cluster, now on every request we try to make we receive the following exception:</p>
  <pre><code>Tire::Search::SearchRequestFailed (401 : {&quot;error&quot;:{&quot;root_cause&quot;:[{&quot;type&quot;:&quot;security_exception&quot;,&quot;reason&quot;:&quot;action [indices:data/read/search] requires authentication&quot;,&quot;header&quot;:{&quot;WWW-Authenticate&quot;:&quot;Basic realm=\&quot;shield\&quot; charset=\&quot;UTF-8\&quot;&quot;}}],&quot;type&quot;:&quot;security_exception&quot;,&quot;reason&quot;:&quot;action [indices:data/read/search] requires authentication&quot;,&quot;header&quot;:{&quot;WWW-Authenticate&quot;:&quot;Basic realm=\&quot;shield\&quot; charset=\&quot;UTF-8\&quot;&quot;}},&quot;status&quot;:401}):
  </code></pre>
  <p>We configured some users from the <a href="https://www.elastic.co/products/x-pack/security" rel="nofollow noreferrer">Shield</a> plugin that comes with Elasticsearch, however Im not sure how can I enter this authentication from my ruby On Rails application, Im using Tire to integrate elastic search in my Ruby On Rails app, but I can't find were can I put this information in order to authenticate my app and solve this issue.</p>
  <p>We would like to know how to authenticate using these two gems:
  <a href="https://github.com/elastic/elasticsearch-rails" rel="nofollow noreferrer">ElasticSearch-rails</a> and <a href="https://github.com/karmi/retire" rel="nofollow noreferrer">Tire</a></p>