py-elasticsearch stop printing errors
<p>I am using a py-elasticsearch to query elasticsearch:</p>

<pre><code>try:
  res = es.get(index='unique_names', doc_type='name', id=token, ignore=['404'])
except elasticsearch.exceptions.NotFoundError:
  continue
</code></pre>

<p>As you  can see I use an exception for if the index does not exist, however the errors still get printed to the terminal like this:</p>

<blockquote>
  <p>GET /unique_names/name/%E4%BD%8F%E6%B0%91%E3%82%89%E9%81%BF%E9%9B%A3
  [status:404 request:0.000s]   GET
  /unique_names/name/%E6%95%91%E5%8A%A9%E6%9C%AC%E6%A0%BC%E5%8C%96
  [status:404 request:0.000s]   GET /unique_names/name/%E3%80%81
  [status:404 request:0.000s]                                       GET
  /unique_names/name/%E5%81%9C%E9%9B%BB%E3%82%82 [status:404
  request:0.000s]                     GET /unique_names/name/%E3%80%82
  [status:404 request:0.000s]</p>
</blockquote>

<p>I would like it to not print anything, because my terminal gets flooded.                                 </p>

<p>The reason this gets printed out is because of <a href="https://github.com/elastic/elasticsearch-py/blob/d4efb81b0695f3d9f64784a35891b732823a9c32/elasticsearch/connection/base.py#L64-L67" rel="nofollow">these lines</a> in the <code>base.py</code> code.</p>

<p>Basically, you're ignoring 404 status codes, so the request gets logged as if it had succeeded.</p>

<p>If you want to get rid of those lines, you need to increase the logging level to WARN instead of INFO.</p>

python python-3.x elasticsearch pyelasticsearch