1. @SpringBootTest
    2. public class MyTest{
    3. //注入RestHighLevelClient对象
    4. @Autowired
    5. private RestHighLevelClient restHighLevelClient;
    6. @Test
    7. public void test() throws IOException {
    8. //创建DeleteIndexRequest请求对象,并指定索引库名
    9. DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(索引库名);
    10. //发送请求
    11. restHighLevelClient.indices().delete(deleteIndexRequest, RequestOptions.DEFAULT);
    12. }
    13. }