USE JAVA API operation the update method does not work

Hello all
Recently, my progarm uesd Elasticsearch update method always fail,code just like this

public <T extends BaseEntity> void updateDoc(T t, String docIndex) throws IOException {
        //update by id
        UpdateRequest updateRequest = new UpdateRequest(docIndex, String.valueOf(t.getId()));
        //set the update time
        String updateJson = JSON.toJSONString(t);
        UpdateResponse update = restHighLevelClient.update(updateRequest, RequestOptions.DEFAULT);
        try {
        }catch (Exception e){
            throw new RuntimeException(e.getMessage());
        }"the status:{}:",update.status());

it did not has updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
and try catch at first,so this method always fail,the question is there is an object that has a field of type List about the business object,when i want to update the field into the Elasticsearch,its failed,in Elasticsearch the field always empty,i think the field of type List has lot of data,so i found some solutions,first one is add updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);,but its not work,and then the second is used try catch,its working,but 2s my leader disagree,so i want to find some better solutions.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.