I've run elasticsearch.bat and queried this in browser with localhost:9200. JSON object returned as follows, so all ok so far.
{
"status" : 200,
"name" : "hwils_01_dev",
"cluster_name" : "elasticsearch_hwils_dev",
"version" : {
"number" : "1.7.2",
"build_hash" : "e43676b1385b8125d647f593f7202acbd816e8ec",
"build_timestamp" : "2015-09-14T09:49:53Z",
"build_snapshot" : false,
"lucene_version" : "4.10.4"
},
"tagline" : "You Know, for Search"
}
I've downloaded and linked via tag to my index.html the elasticsearch.js
<script src="elasticsearch-js/elasticsearch.js"></script>
(incidentally there's more than 1 .js in the download - do I need to link them all?)
I've then run added to another tag the code
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
});
and output this to console - JSON object returned so again, presumably all ok up to this point.
If I then run
client.ping({
requestTimeout: 30000,
// undocumented params are appended to the query string
hello: 'elasticsearch'
}, function (error) {
if (error) {
console.error('elasticsearch cluster is down!');
} else {
console.log('All is well');
}
});
I get the error message returned. And I don't know why.
Incidentally
var elasticsearch = require('elasticsearch');
returns "Uncaught reference error: require is not defined" which would suggest I'm missing at least one other .js file with that function?