根据功能补全缺失部分:
利用ElasticsearchRestTemplate实现索引操作
@Test
void indexExists() {
IndexOperations operations = template.indexOps(IndexCoordinates.of("zut_zy"));
boolean b = operations.【 】
;
if (b) {
//索引存在删除,不存在创建
boolean delete = operations.【 】
;
} else {
boolean result = operations.【 】
;
}
}
参考如下:
@Test
void indexExists() {
IndexOperations operations = template.indexOps(IndexCoordinates.of("zut_zy"));
boolean b = operations.exists();
if (b) {
//索引存在删除,不存在创建
boolean delete = operations.delete();
} else {
boolean result = operations.create();
}
}