feat(新增): 删除索引库
This commit is contained in:
parent
025867af16
commit
2d01f995c8
|
@ -2,6 +2,7 @@ package cn.itcast.hotel;
|
|||
|
||||
import cn.itcast.hotel.constants.HotelConstants;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
|
@ -48,4 +49,15 @@ public class HotelIndexTest {
|
|||
// 3. 发送请求
|
||||
client.indices().create(request, RequestOptions.DEFAULT);
|
||||
}
|
||||
|
||||
// 删除索引库
|
||||
@Test
|
||||
void deleteHotelIndex() throws IOException {
|
||||
// 1. 创建Request对象
|
||||
DeleteIndexRequest request = new DeleteIndexRequest("hotel");
|
||||
// 2. 删除索引库
|
||||
client.indices().delete(request, RequestOptions.DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue