# Can't success to setup es jquery client connection

**URL:** <https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588>\
**Category:** Elasticsearch\
**Created:** [November 3, 2015, 2:14am UTC](https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588 "2015-11-03T02:14:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomQi](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@TomQi](https://discuss.elastic.co/u/TomQi)\
**Post date:** [November 3, 2015, 2:14am UTC](https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588/1 "2015-11-03T02:14:39Z")

</div>

here is my javascript code

var client; $(document).ready(function () { client = new $.es.Client({ hosts: [{ host: "app.biglog.cn", auth: "defender:AU0XvPWYFZihVQi1YYcA" }] //auth: 'defender:AU0XvPWYFZihVQi1YYcA', //auth: "huliant:biglog.org" }); }); function query\_data(){ client.cluster.health(function (err, resp) { if (err) { alert(err.message); } else { alert(resp); } }); } I have set user/password to client configuration, but it always show 401 error when I start to query data. the whole url is http://app.biglog.cn:9200/, who can help me to see what mistake I made? thanks & best regards! Tom

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 3, 2015, 6:01am UTC](https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588/2 "2015-11-03T06:01:14Z")

</div>

> [@TomQi](#):
>
> here is my javascript code

Where?

---

<div class="post-metadata">

**Author:** ![TomQi](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@TomQi](https://discuss.elastic.co/u/TomQi)\
**Post date:** [November 3, 2015, 8:41am UTC](https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588/4 "2015-11-03T08:41:46Z")

</div>

sorry for fail pasting the js code, I wonder whether there is a version gap with jquery and server.

var client;  
$(document).ready(function () {   
client = new $.es.Client({  
hosts: [  
{  
host: "app.biglog.cn",  
auth: "defender:AU0XvPWYFZihVQi1YYcA"  
}  
]  
//auth: 'defender:AU0XvPWYFZihVQi1YYcA',  
//auth: "huliant:biglog.org"  
});  
});

function query\_data(){  
client.cluster.health(function (err, resp) {  
if (err) {  
alert(err.message);  
} else {  
alert(resp);  
}  
});  
}

---

<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:** [July 5, 2017, 11:41pm UTC](https://discuss.elastic.co/t/cant-success-to-setup-es-jquery-client-connection/33588/5 "2017-07-05T23:41:01Z")

</div>


