@SpringBootTest
public class MyTest{
//注入RestHighLevelClient对象
@Autowired
private RestHighLevelClient restHighLevelClient;
@Test
public void test() throws IOException {
//创建DeleteIndexRequest请求对象,并指定索引库名
DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(索引库名);
//发送请求
restHighLevelClient.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
}
}