No living connection error

I'm trying to write a js client and having issue connecting to my index. I can query the index from curl so I know that is up. When I run the following code I get the no living connection error.

var client = jQuery.es.Client({ host: '24.51.59.167:9200', log: 'trace' }); client.ping( { requestTimeout: 30000, // undocumented params are appended to the query string hello: "elasticsearch" }, function (error) { if (error) { alert('elasticsearch cluster is down!' + error); } else { alert('All is well'); } });

Here's my code

< script src="scripts/jquerymin.js">
< script src="scripts/elasticsearch.jquery.min.js">
< script src="scripts/elasticsearch.jquery.js">

< script type = "text/javascript">
var client = jQuery.es.Client({
host: '24.51.59.167:9200',
log: 'trace'
});

client.ping(
{
requestTimeout: 30000,
// undocumented params are appended to the query string
hello: "elasticsearch"
}, function (error) {
if (error) {
alert('elasticsearch cluster is down!' + error);
} else {
alert('All is well');
}
});
< /script>

just out of guessing, the curl execution and the javascript execution on the same box? if not, it might be firewall issue. check also the cross domain in firebug if you have one. also exposing es over the public internet is not recommended though, you might not want to expose es in the javascript.

hth

1 Like