springboot 整合Es : Validation Failed: 1: no requests added;

saveAll() 数据为空时 ,会报  Validation Failed: 1: no requests added; 错误

在springboot中,可以封装一层接口,或者判断数据不为空时存入

···

/**
 * saveAll 封装一层
 *  存入null或 空数组会报错 Validation Failed: 1: no requests added;
 * @param list
 */
private void saveAll(List list){
    if (list != null && list.size() > 0){
        esRepository.saveAll(list);
    }
}

···

你可能感兴趣的:(Es)