title: User authentication in Elasticsearch query using python
body: <p>I'm using elastisearch using Python. My code looks somewhat like this:-</p>
  <pre><code>from elasticsearch import Elasticsearch
  
  if __name__ == '__main__': 
      index=&quot;IndexPosition&quot;
      es=Elasticsearch(['https://localhost:8080'])
      res = es.search(index='{0}'.format(index), doc_type=&quot;log&quot;,size=1000, from_=0, body={ &quot;query&quot;: {
      &quot;match&quot;: {
        
          ...Match condition
        }
      }
    }})
  </code></pre>
  <p>Now, due to changes in architecture user authentication has been added in the elasticsearch.Let's assume username-user and password-pass.How do I pass the username and password in the query..?</p>