Skip to content

Commit

Permalink
Changed to use field instead of humanReadableField for GET_TIME in JS…
Browse files Browse the repository at this point in the history
…ON response

Replaced the use of builder.humanReadableField for the GET_TIME field with builder.field(Fields.GET_TIME, Objects.toString(getTime())). This prevents the duplication of the time_in_millis field.

Signed-off-by: hye-on <ain0103@naver.com>
  • Loading branch information
hye-on committed Jan 15, 2025
1 parent 492767f commit b18d415
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/src/main/java/org/opensearch/index/get/GetStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.opensearch.core.xcontent.XContentBuilder;

import java.io.IOException;
import java.util.Objects;

/**
* Stats for a search get
Expand Down Expand Up @@ -137,7 +138,7 @@ public long current() {
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.GET);
builder.field(Fields.TOTAL, getCount());
builder.humanReadableField(Fields.TIME_IN_MILLIS, Fields.GET_TIME, getTime());
builder.field( Fields.GET_TIME, Objects.toString(getTime()));
builder.humanReadableField(Fields.TIME_IN_MILLIS, Fields.TIME, getTime());
builder.field(Fields.EXISTS_TOTAL, existsCount);
builder.humanReadableField(Fields.EXISTS_TIME_IN_MILLIS, Fields.EXISTS_TIME, getExistsTime());
Expand Down

0 comments on commit b18d415

Please sign in to comment.