refresh the index after adding job
makes the job searchable after the creation event emits
This commit is contained in:
@@ -58,7 +58,13 @@ export default class Job extends events.EventEmitter {
|
|||||||
version: doc._version,
|
version: doc._version,
|
||||||
};
|
};
|
||||||
this.debug(`Job created in index ${this.index}`);
|
this.debug(`Job created in index ${this.index}`);
|
||||||
|
|
||||||
|
return this.client.indices.refresh({
|
||||||
|
index: this.index
|
||||||
|
}).then(() => {
|
||||||
|
this.debug(`Job index refreshed ${this.index}`);
|
||||||
this.emit(contstants.EVENT_JOB_CREATED, this.document);
|
this.emit(contstants.EVENT_JOB_CREATED, this.document);
|
||||||
|
});
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
this.debug('Job creation failed', err);
|
this.debug('Job creation failed', err);
|
||||||
|
|||||||
Reference in New Issue
Block a user