simple code (java)
public void run(){
int count = 0;
BulkRequest buklRequest = new BulkRequest();
while(rs.next()){
IndexRequest indexRequest = new IndexRequest(index, type, id);
buklRequest.add(indexRequest);
count++;
if(count == 1000){
count = 0;
insertBulkLog(buklRequest); <---- true
buklRequest = new BulkRequest();
}
}
insertBulkLog(buklRequest); <-----false, error
}
public boolean insertBulkLog(BulkRequest bulkRequest){
RestHighLevelClient client = new RestHighLevelClient();
BulkResponse bulkResponse = client.bulk(buklRequest, RequstOption.Default); <----error
client.close();
}
org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: no requests added
An error message is generated, but the log is processed normally.