added a warning about reusing config objects to the config docs and to the Client constructor

This commit is contained in:
Spencer Alger
2014-03-27 12:54:11 -07:00
parent 0f158381b3
commit db51f0ebaf
2 changed files with 12 additions and 2 deletions

View File

@ -32,6 +32,13 @@ var _ = require('./utils');
function Client(config) {
config = config || {};
if (config.__reused) {
throw new Error('Do not reuse objects to configure the elasticsearch Client class: ' +
'https://github.com/elasticsearch/elasticsearch-js/issues/33');
} else {
config.__reused = true;
}
function EsApiClient() {
// our client will log minimally by default
if (!config.hasOwnProperty('log')) {