Skip to content

Commit

Permalink
output only old fields in get config API
Browse files Browse the repository at this point in the history
Signed-off-by: Bhavana Ramaram <[email protected]>
  • Loading branch information
rbhavna committed Sep 5, 2024
1 parent 33a7c96 commit 4ffacb7
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions common/src/main/java/org/opensearch/ml/common/MLConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,26 +121,17 @@ public void writeTo(StreamOutput out) throws IOException {
@Override
public XContentBuilder toXContent(XContentBuilder xContentBuilder, Params params) throws IOException {
XContentBuilder builder = xContentBuilder.startObject();
if (type != null) {
builder.field(TYPE_FIELD, type);
if (configType != null || type != null) {
builder.field(TYPE_FIELD, configType == null ? type : configType);
}
if (configType != null) {
builder.field(CONFIG_TYPE_FIELD, configType);
}
if (configuration != null) {
builder.field(CONFIGURATION_FIELD, configuration);
}
if (mlConfiguration != null) {
builder.field(ML_CONFIGURATION_FIELD, mlConfiguration);
if (configuration != null || mlConfiguration != null) {
builder.field(CONFIGURATION_FIELD, mlConfiguration == null ? configuration : mlConfiguration);
}
if (createTime != null) {
builder.field(CREATE_TIME_FIELD, createTime.toEpochMilli());
}
if (lastUpdateTime != null) {
builder.field(LAST_UPDATE_TIME_FIELD, lastUpdateTime.toEpochMilli());
}
if (lastUpdatedTime != null) {
builder.field(LAST_UPDATED_TIME_FIELD, lastUpdatedTime.toEpochMilli());
if (lastUpdateTime != null || lastUpdatedTime != null) {
builder.field(LAST_UPDATE_TIME_FIELD, lastUpdatedTime == null ? lastUpdateTime.toEpochMilli() : lastUpdatedTime.toEpochMilli());
}
return builder.endObject();
}
Expand Down

0 comments on commit 4ffacb7

Please sign in to comment.