@SpringBootTest
public class MyTest{
//注入RestHighLevelClient对象
@Autowired
private RestHighLevelClient restHighLevelClient;
@Test
public void test() throws IOException {
//准备DeleteRequest请求对象,并指定索引库名和文档id
DeleteRequest deleteRequest = new DeleteRequest(索引库名, 文档id);
//发送请求
restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT);
}
}