Facing issue while reindexing document using elasticsearch-7.9.0.jar to Elasticsearch

Hi Team,

We are using Elasticsearch 7.9.0 having single node cluster. We have developed a plugin which is sitting inside plugins folder of Elasticsearch. We are using Elasticsearch SDK (org.Elasticsearch:Elasticsearch:7.9.0) and mustache client (org.Elasticsearch.plugin:lang-mustache-client:7.9.0) and couple of other jars. We have exposed couple of REST endpoints which our client services will consume instead of standard Elasticsearch URLs in order to perform CRUD operations on documents.

We observed when we try to re-index the documents, often certain fields of the documents are not getting updated. This behavior is not at all consistent; completely random in nature. We are really not sure which field will be updated and which wont. This issue doesn't happen for all the documents of the particular index in a consistent manner. We really don't know which document will have this issue.

Few important code snippets for reindexing the document along with log statement as below;

org.elasticsearch.action.update.UpdateRequestBuilder updateRequestBuilder = ((Client) client.getClient()).prepareUpdate();

updateRequestBuilder.setDocAsUpsert(true); 

updateRequestBuilder.setRetryOnConflict(1);

UpdateResponse updateResponse = updateRequestBuilder.get();

logger.info("Response after updating the document: {} " , updateResponse);

I have attached one of the logs as below;

Sample response after updating the document as below: UpdateResponse[index=client_2_sprint20sanity_616d2c81737fc26067d9d220_transaction,type=_doc,id=STZ_8411,version=39,seqNo=3955,primaryTerm=6,result=updated,shards=ShardInfo{total=2, successful=1, failures=}]

When we identify the document is not updated properly in Elasticsearch and introspect the log; we usually observe the log as above. Here the log always return the result=updated and successful=1 despite certain fields are not getting updated.

Please note, this issue is not consistent. The happens very randomly.

Kindly help us on this!