fix(core): update

This commit is contained in:
Philipp Kunz 2023-08-29 11:48:32 +02:00
parent bd154089c3
commit e44365b674
2 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@apiclient.xyz/elasticsearch', name: '@apiclient.xyz/elasticsearch',
version: '2.0.11', version: '2.0.12',
description: 'log to elasticsearch in a kibana compatible format' description: 'log to elasticsearch in a kibana compatible format'
} }

View File

@ -26,6 +26,7 @@ export class ElasticDoc {
private indexInitialized: boolean = false; private indexInitialized: boolean = false;
private latestTimestamp: string | null = null; // Store the latest timestamp private latestTimestamp: string | null = null; // Store the latest timestamp
private onlyNew: boolean = false; // Whether to only pipe new docs private onlyNew: boolean = false; // Whether to only pipe new docs
public fastForward: boolean = false; // Whether to fast forward to the latest timestamp
private BATCH_SIZE = 1000; private BATCH_SIZE = 1000;
@ -106,8 +107,9 @@ export class ElasticDoc {
// If 'onlyNew' is true, compare the document timestamp with the latest timestamp // If 'onlyNew' is true, compare the document timestamp with the latest timestamp
if (this.onlyNew) { if (this.onlyNew) {
if (this.latestTimestamp && optionsArg.timestamp <= this.latestTimestamp) { if (this.latestTimestamp && optionsArg.timestamp <= this.latestTimestamp) {
// Omit the document this.fastForward = true;
} else { } else {
this.fastForward = false;
await this.client.index({ await this.client.index({
index: this.index, index: this.index,
id: optionsArg.docId, id: optionsArg.docId,