How do I turn logging off for Elasticsearch in Node.js?

elasticsearch, logging, node.js

Solution

var client = new elasticsearch.Client({
  log : [{
    type: 'stdio',
    levels: ['error', 'warning'] // change these options
  }]
});

So if you just wanted errors showing up it would be.

var client = new elasticsearch.Client({
  log : [{
    type: 'stdio',
    levels: ['error'] // change these options
  }]
});

More can be found on config page. Different logging levels are found here (old link dead).

UPDATE: ES 7.x - logging has been removed: Breaking changes, Observability

Problem

I'm using the `elasticsearch` npm module. I get annoying yellow warnings because my elasticsearch server is currently off. How can I make it so that it doesn't log anything?

Original source