Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package org.opensearch.indexmanagement.snapshotmanagement.model

import org.opensearch.Version
import org.opensearch.core.common.io.stream.StreamInput
import org.opensearch.core.common.io.stream.StreamOutput
import org.opensearch.core.common.io.stream.Writeable
Expand Down Expand Up @@ -36,10 +37,15 @@ data class ExplainSMPolicy(
override fun toXContent(builder: XContentBuilder, params: ToXContent.Params): XContentBuilder {
metadata?.let {
builder
.field(SMMetadata.CREATION_FIELD, it.creation)
.optionalField(SMMetadata.DELETION_FIELD, it.deletion)
.field(SMMetadata.POLICY_SEQ_NO_FIELD, it.policySeqNo)
.field(SMMetadata.POLICY_PRIMARY_TERM_FIELD, it.policyPrimaryTerm)

if (Version.CURRENT > Version.V_3_3_0) {
builder.optionalField(SMMetadata.CREATION_FIELD, it.creation)
} else {
builder.field(SMMetadata.CREATION_FIELD, it.creation)
}
}
return builder.field(SMPolicy.ENABLED_FIELD, enabled)
}
Expand Down