Skip to content

Commit 1ccd0c1

Browse files
committed
Make reindexing more reliable by sniffing the cluster
1 parent 4b41694 commit 1ccd0c1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bin/elasticsearch-reindex.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ if (cluster.isMaster) {
148148
}
149149

150150
function createClient(uri) {
151+
if (!/\w+:\/\//.test(uri)) {
152+
uri = 'http://' + uri;
153+
}
154+
151155
var uri = uri.lastIndexOf('/') === uri.length -1 ? uri.substr(0, uri.length -1) : uri;
152156
tokens = uri.split('/');
153157
var res = {};
@@ -159,7 +163,9 @@ if (cluster.isMaster) {
159163
var config = {
160164
requestTimeout: cli.request_timeout,
161165
apiVersion: cli.api_ver,
162-
suggestCompression: cli.compress
166+
suggestCompression: cli.compress,
167+
sniffOnStart: true,
168+
sniffOnConnectionFault: true
163169
};
164170

165171
if (cli.access_key && cli.secret_key && cli.region && /\.amazonaws\./.test(uri)) {
@@ -222,7 +228,7 @@ if (cluster.isMaster) {
222228
if (err) {
223229
logger.fatal(err);
224230
if (err.message.indexOf('parse') > -1) {
225-
throw new Error("Scroll body parsing error, query_size param is possiblly too high.");
231+
throw new Error("Scroll body parsing error, query_size param is possibly too high.");
226232
} else {
227233
throw new Error("Scroll error: " + err);
228234
}

0 commit comments

Comments
 (0)