feat(新增): 删除文档
This commit is contained in:
parent
83268e5e36
commit
f78044ec40
|
@ -5,6 +5,7 @@ import cn.itcast.hotel.pojo.HotelDoc;
|
|||
import cn.itcast.hotel.service.IHotelService;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
|
@ -76,9 +77,18 @@ public class HotelDocumentTest {
|
|||
// 准备请求参数
|
||||
request.doc(
|
||||
"price", "666",
|
||||
"startName", "四钻"
|
||||
"starName", "四钻"
|
||||
);
|
||||
// 发送请求
|
||||
client.update(request, RequestOptions.DEFAULT);
|
||||
}
|
||||
|
||||
// 删除文档
|
||||
@Test
|
||||
void testDeleteDocument() throws IOException {
|
||||
// 准备Request
|
||||
DeleteRequest request = new DeleteRequest("hotel", "61083");
|
||||
// 发送请求
|
||||
client.delete(request, RequestOptions.DEFAULT);
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue