I am setting up a simple Node.js REST service to interface with Elasticsearch, using the official Javascript client. I'm running this code locally, but the cluster is located remotely. When I go trough the browser, with the _head
plugin, I can connect ES and query with no problem. However, doing so via the Javascript client times out all requests. I set up the ElasticSearch object, but sending any request to it simply doesn't work. I don't think it's a network issue, because I can access ES trough the browser. This is how I request something, a very basic get:
var elasticsearch = require("elasticsearch");
var es = new elasticsearch.Client({
host: "https://my-address:9200/", // also tried without protocol part and trailing slashes
log: "error",
sniffOnStart: true
});
es.get({
index: "things",
type: "someThing",
id: "42"
}).then(doSomeStuff, handleStuffFailed);
This fails with a simple error message Errror: Request timeout after 30000ms.
Am I missing something here? I've read trough the client docs, and this seems like the basic "hello world" for the client.
// also tried without protocol part and trailing slashes
, and tried normal HTTP too – Forefend