Elasticsearch Java API update document GetResult is always null

I am trying to update a document through Java Update API.

I am using UpdateRequest to send a request for update.

UpdateRequest updateRequest = new UpdateRequest(index, type, id).script(
            new Script("ctx._source.'Test Status' = newtestStatus", ScriptType.INLINE, null, updateRequestParams));
updateResponse = client.update(updateRequest).get();
GetResult getResult = updateResponse.getGetResult();
if (getResult.isExists() & getResult.getVersion() == updateResponse.getVersion()) {
    testStatusUpdated = true;
}

Here, I always get java.lang.NullPointerException at getResult.isExists() and this because GetResult getResult = updateResponse.getGetResult(); is null.

When I checked the result manually, it is getting updated as required. "Test Status": "STOPPED" in the document.

getResult is always returned null due to which I am not able to check programmatically if the document is updated.

Also, is there any other way to check if document is updated?

It should throw an exception if it isn't updated. It looks like getGetResult only has a thing in it is fields has fields in it or if you delete the document.

GetResult getResult = updateResponse.getGetResult() is always null and because of this, i cannot use any of it's methods like getResult.getFields()

updateRequest.fields("cat") should make GetResult come back. The thing you are doing to check the result isn't needed though .get will throw an exception if Elasticsearch failed to perform the update.