diff --git a/src/datasource.ts b/src/datasource.ts index 36af503..1221bfc 100644 --- a/src/datasource.ts +++ b/src/datasource.ts @@ -104,12 +104,15 @@ export class QuickwitDataSource message: 'Cannot save datasource, `index` is required', }; } + + // todo #37 /describe will give you the timeField if (this.timeField === '' ) { return { status: 'error', message: 'Cannot save datasource, `timeField` is required', }; } + return lastValueFrom( from(this.getResource('indexes/' + this.index)).pipe( mergeMap((indexMetadata) => { @@ -150,9 +153,12 @@ export class QuickwitDataSource if (timestampField === undefined) { return `No field named '${this.timeField}' found in the doc mapping. This should never happen.`; } + + // todo #37: no need anymore, will take the timestampField.field_mapping.output_format anyway if (timestampField.field_mapping.output_format !== this.timeOutputFormat) { return `Timestamp output format is declared as '${timestampField.field_mapping.output_format}' in the doc mapping, not '${this.timeOutputFormat}'.`; } + const supportedTimestampOutputFormats = ['unix_timestamp_secs', 'unix_timestamp_millis', 'unix_timestamp_micros', 'unix_timestamp_nanos', 'iso8601', 'rfc3339']; if (!supportedTimestampOutputFormats.includes(this.timeOutputFormat)) { return `Timestamp output format '${this.timeOutputFormat} is not yet supported.`;