Skip to content

Commit a35a219

Browse files
committed
bugfix: pass meta to existsIndexTemplate method from OS API
Signed-off-by: Jared Barranco <[email protected]>
1 parent 22ff869 commit a35a219

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

bulk_writer.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,14 @@ const BulkWriter = function BulkWriter(transport, client, options) {
1919
this.bulk = []; // bulk to be flushed
2020
this.running = false;
2121
this.timer = false;
22+
this.connected = false;
2223
debug('created', this);
2324
};
2425

2526
BulkWriter.prototype.start = function start() {
26-
this.checkEsConnection(this.retryLimit);
27+
this.checkEsConnection(this.retryLimit).finally(() => {
28+
this.connected = true;
29+
});
2730
debug('started');
2831
};
2932

@@ -104,7 +107,7 @@ BulkWriter.prototype.append = function append(index, doc) {
104107
attempts: 0,
105108
});
106109
// resume the buffering process
107-
if (!this.running) {
110+
if (!this.running && this.connected) {
108111
this.running = true;
109112
this.tick();
110113
}
@@ -251,7 +254,7 @@ BulkWriter.prototype.ensureIndexTemplate = function ensureIndexTemplate(fulfill,
251254
name: 'template_' + templateName,
252255
};
253256
debug('Checking tpl name', tmplCheckMessage);
254-
thiz.client.indices.existsIndexTemplate(tmplCheckMessage).then(
257+
thiz.client.indices.existsIndexTemplate(tmplCheckMessage, { meta: true }).then(
255258
(res) => {
256259
if (res.statusCode && res.statusCode === 404) {
257260
const tmplMessage = {

0 commit comments

Comments
 (0)