Can't success to setup es jquery client connection


(Tom Qi) #1

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

(Mark Walkom) #2

Where?


(Tom Qi) #4

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);
}
});
}


(system) #5