Skip to content

Client modifies configuration object such that it cannot be used again #33

Closed
@jvonniedapn

Description

@jvonniedapn

When passing a config object to new elasticsearch.Client(), the Client modifies the passed in config object in such a way that it cannot be used to create a second client.

Example:

var elasticsearch = require('elasticsearch');

var config = {
    log : "warning"
};

console.dir(config);
var es1 = new elasticsearch.Client(config);
console.dir(config);
var es2 = new elasticsearch.Client(config);
> node es-config-bug.js 
{ log: 'warning' }
{ log: 
   { _events: 
      { closing: [Object],
        error: [Function: bound],
        warning: [Function: bound] } },
  host: 'http://localhost:9200',
  hosts: 'http://localhost:9200',
  maxSockets: 10,
  maxKeepAliveRequests: 0,
  maxKeepAliveTime: 300000 }

/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/log.js:44
      throw new TypeError('Invalid logging output config. Expected either a lo
            ^
TypeError: Invalid logging output config. Expected either a log level, array of log levels, a logger config object, or an array of logger config objects.
    at new Log (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/log.js:44:13)
    at new Transport (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/transport.js:17:27)
    at Object.EsApiClient (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/client.js:49:22)
    at new Client (/Users/jvonnieda/Desktop/test/node_modules/elasticsearch/src/lib/client.js:60:10)
    at Object.<anonymous> (/Users/jvonnieda/Desktop/test/es-config-bug.js:10:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions