当前位置: 首页 > news >正文

做毕设好的网站wix做网站步骤

做毕设好的网站,wix做网站步骤,怎样把一个网站建设的更好,WordPress整站搬家插件目录 12.5 RestClient操作索引库 12.5.1创建库 12.5.2 删除索引库 12.5.3 判断是否存在 12.6 RestClient操作文档 12.6.1 新增文档 12.6.2 查询文档 12.6.3 修改文档 12.6.4 删除文档 12.6.5 批量导入文档 12.5 RestClient操作索引库 酒店mapping映射 ​PUT /hotel{mappings: {properties: {id: {type: keyword,copy_to: all},name: {type: text,analyzer: ik_max_word},address: {type: keyword,index: false},price: {type: integer},score: {type: integer},brand: {type: keyword,copy_to: all},city: {type: keyword},starName: {type: keyword},business: {type: keyword},location: {type: geo_point},pic: {type: keyword,index: false},all: {type: text,analyzer: ik_max_word}}}} 导入依赖 !--elasticSearch依赖--dependencygroupIdorg.elasticsearch.client/groupIdartifactIdelasticsearch-rest-high-level-client/artifactIdversion7.12.1/version/dependency propertiesjava.version1.8/java.versionelasticsearch.version7.12.1/elasticsearch.version/properties 创建对象 SpringBootTestclass HotelIndexTest {private RestHighLevelClient client;​// 客户端初始化BeforeEachvoid setUp(){this.client new RestHighLevelClient(RestClient.builder(HttpHost.create(http://192.168.142.129:9200)));}​Testvoid tetsInit(){System.out.println(client);}​// 客户端销毁AfterEachvoid tearDown() throws IOException {this.client.close();}} client.indices()包含了操作索引库的所有方法 12.5.1创建库 Testvoid testCreateHotelIndex() throws IOException {// 1. 创建Request对象CreateIndexRequest request new CreateIndexRequest(hotel);// 2. 准备请求的参数request.source(MAPPING_TEMPLATE,XContentType.JSON);// 3. 发送请求   client.indices()的返回值包含了索引库额所有操作client.indices().create(request,RequestOptions.DEFAULT);} MAPPING_TEMPLATE是自定义的常量也就是上面创建索引库的语句 12.5.2 删除索引库 Testvoid testDeleteIndex() throws IOException {// 1. 创建request对象DeleteIndexRequest request new DeleteIndexRequest(hotel);// 2. 发送请求client.indices().delete(request,RequestOptions.DEFAULT);} 12.5.3 判断是否存在 Testvoid testExistIndex() throws IOException {// 1. 创建request对象GetIndexRequest request new GetIndexRequest(hotel);// 2. 发送请求boolean exists client.indices().exists(request, RequestOptions.DEFAULT);// 3. 输出System.out.println(exists ? 索引库存在 : 索引库不存在);} 12.6 RestClient操作文档 12.6.1 新增文档 Testvoid testIndexDocument() throws IOException {// 在数据库查到数据Hotel hotel iHotelService.getById(61083L);HotelDoc hotelDoc new HotelDoc(hotel); // 经度 纬度 拼接之后的对象 ,即索引库需要的类型// 1. 创建请求对象IndexRequest request new IndexRequest(hotel).id(hotel.getId().toString());// 2. 准备json文档 把查到的对象转换成json对象request.source(JSON.toJSONString(hotelDoc),XContentType.JSON);// 3. 发送请求client.index(request,RequestOptions.DEFAULT);} 12.6.2 查询文档 Testvoid testGetDocumentById() throws IOException {// 1. 准备requestGetRequest request new GetRequest(hotel, 61083);// 2. 发送请求GetResponse response client.get(request, RequestOptions.DEFAULT);// 3. 从响应中解析对象String json response.getSourceAsString();// 4. 把json转成HotelDoc对象HotelDoc hotelDoc JSON.parseObject(json, HotelDoc.class);System.out.println(hotelDoc);} 12.6.3 修改文档 第二种更新方式即局部更新的代码 : Testvoid testUpdateDocumentById() throws IOException {// 1. 准备RequestUpdateRequest request new UpdateRequest(hotel, 61083);// 2. 准备请求参数request.doc(age, 18,name,Rose);// 3. 发送请求client.update(request,RequestOptions.DEFAULT);} 12.6.4 删除文档 Testvoid testDeleteDocumentById() throws IOException {// 1. 准备requestDeleteRequest request new DeleteRequest(hotel,61083);// 2. 发送请求client.delete(request,RequestOptions.DEFAULT);} 12.6.5 批量导入文档 Testvoid testBulk() throws IOException {// 批量查询酒店数据ListHotel hotels iHotelService.list();// 1. 创建Bulk请求BulkRequest request new BulkRequest();// 2. 准备参数 添加多个新增的requestfor (Hotel hotel : hotels) {// 把hotel转成hotelDoc对象HotelDoc hotelDoc new HotelDoc(hotel);request.add(new IndexRequest(hotel).id(hotelDoc.getId().toString()).source(JSON.toJSONString(hotelDoc),XContentType.JSON));}​// 3. 发送请求client.bulk(request,RequestOptions.DEFAULT);}
http://www.hkea.cn/news/14586452/

相关文章:

  • dnf交易网站建设怎么建立自己网站 asp
  • 红河网页设计临沂网站seo
  • 哪个网站能接效果图做360做的网站首页
  • jsp做网站案例重庆网站建设选夹夹虫
  • 做网站百度云wordpress设置自定义主页
  • 自己搭建环境建设网站如何做网站的教程二维码
  • 网站建设费 大创湘西 网站 建设 公司
  • 上海推广刷关键词排名seo软件软件
  • 网页制作与网站建设...台州卓远做网站好不好
  • wix怎样做网站有没有正规的毕设代做网站
  • 假发网站是怎么做的微商城平台排行榜前十名
  • 企业网站建设费用记入长春长春网站建设公司
  • 邵阳网站推广怎么制作图片相册
  • 四川专做餐饮的网站wordpress添加模板后台显示
  • 高端网站建设找哪个公司网站建设含意
  • 深圳宝安商城网站建设公司wordpress判断浏览器
  • 苏州建站模板展示手机创建网页快捷方式
  • 全能医院网站管理系统ai画作拍卖在上海拍出110万高价
  • 网站到首页排名阜阳网站开发公司
  • 网站代码制作天津高自考网站建设与实践2017
  • 上海川沙网站建设国内商务网络公司排名
  • 长春网站建设公司排名珠海工程建设信息网站
  • 手机怎么样自己做网站成都自动seo
  • 个人网站服务器一年多少钱简单的html页面
  • 注册网站英语wordpress 打赏可见
  • 网站空间国外那个好嘉定公司网站设计
  • APP做网站太古楼角原网站建设
  • 网站推广策划思路的内容长沙网站se0推广优化公司
  • 全国分类信息网站排名嘉定网站设计公司
  • 网站代码设计网站做的漂亮的企业