in src/main/java/org/opensearch/search/asynchronous/response/AsynchronousSearchResponse.java [236:271]
public static AsynchronousSearchResponse innerFromXContent(XContentParser parser) throws IOException {
ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.currentToken(), parser);
String id = null;
AsynchronousSearchState status = null;
long startTimeMillis = -1;
long expirationTimeMillis = -1;
SearchResponse searchResponse = null;
OpenSearchException error = null;
String currentFieldName = null;
for (XContentParser.Token token = parser.nextToken(); token != XContentParser.Token.END_OBJECT; token = parser.nextToken()) {
currentFieldName = parser.currentName();
if (RESPONSE.match(currentFieldName, parser.getDeprecationHandler())) {
if (token == XContentParser.Token.START_OBJECT) {
ensureExpectedToken(XContentParser.Token.FIELD_NAME, parser.nextToken(), parser);
searchResponse = SearchResponse.innerFromXContent(parser);
}
} else if (ERROR.match(currentFieldName, parser.getDeprecationHandler())) {
parser.nextToken();
error = OpenSearchException.fromXContent(parser);
} else if (token.isValue()) {
if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
id = parser.text();
} else if (START_TIME_IN_MILLIS.match(currentFieldName, parser.getDeprecationHandler())) {
startTimeMillis = parser.longValue();
} else if (EXPIRATION_TIME_IN_MILLIS.match(currentFieldName, parser.getDeprecationHandler())) {
expirationTimeMillis = parser.longValue();
} else if (STATE.match(currentFieldName, parser.getDeprecationHandler())) {
status = AsynchronousSearchState.valueOf(parser.text());
} else {
parser.skipChildren();
}
}
}
return new AsynchronousSearchResponse(id, status, startTimeMillis, expirationTimeMillis, searchResponse, error);
}