elasticsearch
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -17,5 +17,9 @@ var utils = require('./utils'), | ||
this.server_config = { | ||
auth : opts.auth || '', | ||
host : opts.host || utils.default_config.host, | ||
port : opts.port || utils.default_config.port | ||
port : opts.port || utils.default_config.port, | ||
rejectUnauthorized : typeof opts.rejectUnauthorized === 'boolean' ? opts.rejectUnauthorized : true, | ||
secure : opts.secure || false | ||
} | ||
if (!(this.index.name && this.index.name[0] == '_')) { | ||
@@ -151,3 +155,3 @@ var self = this; | ||
var def = { | ||
method: 'PUT', | ||
method: 'PUT', | ||
path: '/_river/'+name+'/_meta' | ||
@@ -165,3 +169,3 @@ }; | ||
var def = { | ||
method: 'GET', | ||
method: 'GET', | ||
path: '/_river/'+name+'/_meta' | ||
@@ -168,0 +172,0 @@ }; |
var http = require('http'); | ||
var https = require('https'); | ||
@@ -7,2 +8,3 @@ var default_config = module.exports.default_config = { | ||
}; | ||
var _request = module.exports.request = function(opts, data, cb) { | ||
@@ -13,3 +15,4 @@ if (data && !cb && typeof(data) == 'function') { | ||
} | ||
var req = http.request(opts, function(res) { | ||
var callback = function(res) { | ||
var statusCode = res.statusCode; | ||
@@ -34,3 +37,3 @@ var chunks = [], | ||
//TODO: figure out a better way to do this, not sure it's possible with inconsistent messages from ES... | ||
//TODO: figure out a better way to do this, not sure it's possible with inconsistent messages from ES... | ||
var res_json = {}; | ||
@@ -56,4 +59,11 @@ try { | ||
}); | ||
}); | ||
}; | ||
var req; | ||
if (opts.secure) { | ||
req = https.request(opts, callback); | ||
} else { | ||
req = http.request(opts, callback); | ||
} | ||
if (data) { | ||
@@ -60,0 +70,0 @@ req.write(JSON.stringify(data)); |
@@ -5,3 +5,3 @@ { | ||
"main": "index.js", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"author": "Nick Campbell (http://github.com/ncb000gt)", | ||
@@ -8,0 +8,0 @@ "engines": { |
@@ -33,8 +33,11 @@ node-elasticsearch | ||
-------------------------------- | ||
Returns a new client object. | ||
Returns a new client object. | ||
Options: | ||
* `index`: The name of the index to act upon. | ||
* `auth`: Basic authentication for elasticsearch in 'username:password' format | ||
* `index`: The name of the index to act upon | ||
* `host`: The hostname of the elasticsearch server (defaults to localhost) | ||
* `port`: The port of the elasticsearch server (defaults to 9200) | ||
* `rejectUnauthorized`: If specifying secure this may be set to false to bypass certificate validation | ||
* `secure`: Specify true if the elasticsearch server requires TLS/SSL | ||
@@ -120,3 +123,3 @@ We'll call the returned client `es`. | ||
----------------------------- | ||
Returns a new index object. | ||
Returns a new index object. | ||
@@ -146,3 +149,3 @@ Options: | ||
--------------------------- | ||
Returns a new cluster object. | ||
Returns a new cluster object. | ||
@@ -172,3 +175,3 @@ We'll call the returned cluster `cluster`. | ||
npm test | ||
``` | ||
``` | ||
@@ -175,0 +178,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22435
541
187
2