From 555d8ba02ae594729fc9694a187df3afa2e7ac3e Mon Sep 17 00:00:00 2001 From: Arpit Bandejiya Date: Sat, 26 Nov 2022 14:48:08 +0530 Subject: [PATCH] change in update pit response --- .../action/search/UpdatePitResponse.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/action/search/UpdatePitResponse.java b/server/src/main/java/org/opensearch/action/search/UpdatePitResponse.java index 6350385c9a048..13af5adf9bd3c 100644 --- a/server/src/main/java/org/opensearch/action/search/UpdatePitResponse.java +++ b/server/src/main/java/org/opensearch/action/search/UpdatePitResponse.java @@ -20,6 +20,7 @@ import java.io.IOException; +import static org.opensearch.common.xcontent.XContentParserUtils.ensureExpectedToken; import static org.opensearch.rest.RestStatus.OK; public class UpdatePitResponse extends ActionResponse implements StatusToXContentObject { @@ -27,7 +28,6 @@ public class UpdatePitResponse extends ActionResponse implements StatusToXConten private static final ParseField ID = new ParseField("pit_id"); private static final ParseField CREATION_TIME = new ParseField("creation_time"); private static final ParseField EXPIRY_TIME = new ParseField("expiry_time"); - private static final ParseField SUCCESS_FULL = new ParseField("successfull"); private final String id; private final int totalShards; @@ -78,11 +78,28 @@ public UpdatePitResponse( this.shardFailures = shardFailures; } + public static CreatePitResponse fromXContent(XContentParser parser) throws IOException{ + ensureExpectedToken(XContentParser.Token.START_OBJECT, parser.nextToken(), parser); + parser.nextToken(); + return innerFromXContent(parser); + } + + public static CreatePitResponse innerFromXContent(XContentParser parser) throws IOException { + + } @Override public void writeTo(StreamOutput out) throws IOException{ out.writeString(id); + out.writeVInt(totalShards); + out.writeVInt(successfulShards); + out.writeVInt(failedShards); + out.writeVInt(skippedShards); out.writeLong(creationTime); out.writeLong(expiryTime); + out.writeVInt(shardFailures.length); + for (ShardSearchFailure shardSearchFailure : shardFailures) { + shardSearchFailure.writeTo(out); + } } @Override @@ -98,6 +115,8 @@ public XContentBuilder toXContent(XContentBuilder builder, Params params) throws getFailedShards(), getShardFailures() ); + builder.field(CREATION_TIME.getPreferredName(), creationTime); + builder.field(EXPIRY_TIME.getPreferredName(), expiryTime); builder.endObject(); return builder; }