diff --git a/build.gradle b/build.gradle index d26722b3..a08f9368 100644 --- a/build.gradle +++ b/build.gradle @@ -68,11 +68,11 @@ apply plugin: 'opensearch.java-agent' configurations { ktlint { - resolutionStrategy { - force "ch.qos.logback:logback-classic:1.5.16" - force "ch.qos.logback:logback-core:1.5.16" - } - } + resolutionStrategy { + force "ch.qos.logback:logback-classic:1.5.16" + force "ch.qos.logback:logback-core:1.5.16" + } + } } dependencies { @@ -232,4 +232,4 @@ task updateVersion { // Include the required files that needs to be updated with new Version ant.replaceregexp(file:'build.gradle', match: '"opensearch.version", "\\d.*"', replace: '"opensearch.version", "' + newVersion.tokenize('-')[0] + '-SNAPSHOT"', flags:'g', byline:true) } -} +} \ No newline at end of file diff --git a/src/main/kotlin/org/opensearch/commons/alerting/util/IndexUtils.kt b/src/main/kotlin/org/opensearch/commons/alerting/util/IndexUtils.kt index 887e8430..0ea1d3cc 100644 --- a/src/main/kotlin/org/opensearch/commons/alerting/util/IndexUtils.kt +++ b/src/main/kotlin/org/opensearch/commons/alerting/util/IndexUtils.kt @@ -66,6 +66,10 @@ fun XContentBuilder.optionalUsernameField(name: String, user: User?): XContentBu return this.field(name, user.name) } +fun XContentBuilder.nonOptionalTimeField(name: String, instant: Instant): XContentBuilder { + return this.timeField(name, "${name}_in_millis", instant.toEpochMilli()) +} + fun XContentBuilder.optionalTimeField(name: String, instant: Instant?): XContentBuilder { if (instant == null) { return nullField(name)