I am doing a migration from version 7 which is deprecated to version 8 java api client , but there is no documentation regarding upsert in version 8 , i have to write a updateRequest to update a document if it exists and if not create the document ,
like in my code i am using these for deprecated version
UpdateRequest()).index(this.Instance.getName())).id(entity.getId()).upsert(this.objectMapper.writeValueAsString(entity), XContentType.JSON).doc(updateFields).retryOnConflict(3);