# elasticsearch.Client is not a constructor (JavaScript client)

**URL:** <https://discuss.elastic.co/t/elasticsearch-client-is-not-a-constructor-javascript-client/71111>\
**Category:** Elasticsearch\
**Created:** [January 10, 2017, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-client-is-not-a-constructor-javascript-client/71111 "2017-01-10T15:50:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_McAfee1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_mcafee1/32/47236_2.png) [@John\_McAfee1](https://discuss.elastic.co/u/John_McAfee1)\
**Post date:** [January 10, 2017, 3:50pm UTC](https://discuss.elastic.co/t/elasticsearch-client-is-not-a-constructor-javascript-client/71111/1 "2017-01-10T15:50:48Z")

</div>

Hello,

I read a previous topic(#392) and the documentation concerning the javascript client.  
First, I followed the documentation and created a basic client like this:  
var elasticsearch = require('elasticsearch');  
var client = new elasticsearch.Client({  
host: 'localhost:9205'  
});  
Which gave me the elasticsearch.Client is not a constructor error

Then as suggested in topic(#392), I tried the following way:  
function config() {  
return {  
log: "warning"  
};  
}

var es1 = new elasticsearch.Client(config());  
var es2 = new elasticsearch.Client(config());

Which also gave the elasticsearch.Client is not a constructor error.

Currently, I am using elasticsearch 2.4.3. Am I missing something?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 7, 2017, 3:51pm UTC](https://discuss.elastic.co/t/elasticsearch-client-is-not-a-constructor-javascript-client/71111/2 "2017-02-07T15:51:51Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
