use of org.springframework.data.elasticsearch.core.query.IndexQuery in project IT-Demo by yanghaiji.
the class EsRestTemplateImpl method insertItemDocBulk.
/**
* <p>
* 批量信息
* </p>
*
* @param
* @return void
* @version 1.0.0
* @author hai ji
* @since 2022/2/9
*/
public void insertItemDocBulk() {
List<IndexQuery> list = new ArrayList<>();
list.add(new IndexQueryBuilder().withObject(UserEntity.builder().id(System.currentTimeMillis()).brand("javayh").images("es.png").price(2020.29).title("Java有货").build()).build());
list.add(new IndexQueryBuilder().withObject(UserEntity.builder().id(System.currentTimeMillis() + 1).brand("javayh").images("es.png").price(2020.29).title("Java有货").build()).build());
elasticsearchTemplate.bulkIndex(list, IndexCoordinates.of("sys_user"));
}
Aggregations