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

做淘宝类网站平台推广计划

做淘宝类网站,平台推广计划,管家婆crm123696,WordPress如何备份恢复要把数据库数据导入到elasticsearch中,包括下面几步: 1)将商品微服务中的分页查询商品接口定义为一个FeignClient,放到feign-api模块中 2)搜索服务编写一个测试业务,实现下面功能: 调用item-ser…

要把数据库数据导入到elasticsearch中,包括下面几步:

1)将商品微服务中的分页查询商品接口定义为一个FeignClient,放到feign-api模块中

2)搜索服务编写一个测试业务,实现下面功能:

调用item-service提供的FeignClient,分页查询商品 PageDTO<Item>

将查询到的商品封装为一个ItemDoc对象,放入ItemDoc集合

将ItemDoc集合批量导入elasticsearch中

注意:数据库中的商品数量多达9万多个,不可查询索引导入。一定要分页导入。

第一步,分页查询item接口对外暴露,在feign-api中定义接口

 @FeignClient("itemservice")
public interface ItemFeignClient {@GetMapping(path = "/item/list")public ResponseEntity<PageDTO<Item>> list(@RequestParam(value = "page", defaultValue = "1") Integer page, @RequestParam(value = "size", defaultValue = "10") Integer size);}


第二步 ,在es服务和数据服务分别引入fegin-api依赖

<dependency><groupId>com.hmall</groupId><artifactId>feign-api</artifactId><version>1.0</version>
</dependency>

es服务配置文件:

spring:application:name: searchserviceelasticsearch:rest:uris: http://192.168.xxx.xxx:xxxx


第三步,es服务入口类中调用feign,要开启feign扫描

@SpringBootApplication
@EnableFeignClients(basePackages = "com.hmall.api")
public class SearchApplication {public static void main(String[] args) {SpringApplication.run(SearchApplication.class, args);}
}

第四步,编写一个测试类,分页查询并批量导入

@SpringBootTest
@RunWith(SpringRunner.class) //Junit 4 需要  ,  Junit 5 不需要
public class BulkItemImportTest {@Autowiredprivate ItemFeignClient itemFeignClient;@Autowiredprivate RestHighLevelClient restHighLevelClient;@Testpublic void bulkItemImportTest() throws IOException {Integer page = 1, size = 1000;while (true) {//1. 查询商品列表ResponseEntity<PageDTO<Item>> responseEntity = itemFeignClient.list(page, size);PageDTO<Item> pageDTO = responseEntity.getBody();//如果查询的数据未空代表, 所有数据已经完成导入, 终止循环if (pageDTO.getList() == null || pageDTO.getList().size() == 0) {break;}//2. 导入数据到ES//2.1 创建请求对象BulkRequest request = new BulkRequest();//2.2 封装DSL语句pageDTO.getList().stream().forEach(item -> {ItemDoc itemDoc = new ItemDoc(item);request.add(new IndexRequest("hmall_item").id(item.getId() + "").source(JSON.toJSONString(itemDoc), XContentType.JSON));});//2.3 发送请求restHighLevelClient.bulk(request, RequestOptions.DEFAULT);page++;}}
}

文章转载自:
http://dinncoturcophobe.stkw.cn
http://dinncojehu.stkw.cn
http://dinncotheatrics.stkw.cn
http://dinncopippa.stkw.cn
http://dinncoinfiltrator.stkw.cn
http://dinncoaventurine.stkw.cn
http://dinncolumper.stkw.cn
http://dinncomonitress.stkw.cn
http://dinncounific.stkw.cn
http://dinncoriel.stkw.cn
http://dinncooverzeal.stkw.cn
http://dinncobioinstrumentation.stkw.cn
http://dinncoprosenchyma.stkw.cn
http://dinncotremulous.stkw.cn
http://dinnconanette.stkw.cn
http://dinncoappraise.stkw.cn
http://dinncospooling.stkw.cn
http://dinncoichthyophagist.stkw.cn
http://dinncosmg.stkw.cn
http://dinncoarborescent.stkw.cn
http://dinncofilopodium.stkw.cn
http://dinncomips.stkw.cn
http://dinncoretitrate.stkw.cn
http://dinncofuzz.stkw.cn
http://dinncosporule.stkw.cn
http://dinncopeacockish.stkw.cn
http://dinncosceptic.stkw.cn
http://dinncopaedology.stkw.cn
http://dinncooration.stkw.cn
http://dinncosavine.stkw.cn
http://dinncoblastocoele.stkw.cn
http://dinncogeogonic.stkw.cn
http://dinncobritticization.stkw.cn
http://dinncograham.stkw.cn
http://dinncohorseback.stkw.cn
http://dinncoparky.stkw.cn
http://dinncoshambles.stkw.cn
http://dinncoacl.stkw.cn
http://dinncounrounded.stkw.cn
http://dinncohyperleucocytosis.stkw.cn
http://dinncoalderman.stkw.cn
http://dinncoginkgo.stkw.cn
http://dinncoextraditable.stkw.cn
http://dinncosteamtight.stkw.cn
http://dinncoapprehend.stkw.cn
http://dinncounhand.stkw.cn
http://dinncopenally.stkw.cn
http://dinncoslablike.stkw.cn
http://dinncobow.stkw.cn
http://dinncomenstruation.stkw.cn
http://dinncoastutely.stkw.cn
http://dinncosunday.stkw.cn
http://dinncomike.stkw.cn
http://dinncowhiggery.stkw.cn
http://dinncopareve.stkw.cn
http://dinncojansenistic.stkw.cn
http://dinncotalmudist.stkw.cn
http://dinncokist.stkw.cn
http://dinncoblighted.stkw.cn
http://dinncocombinability.stkw.cn
http://dinnconotionist.stkw.cn
http://dinncosemiglobular.stkw.cn
http://dinncobahai.stkw.cn
http://dinncosundial.stkw.cn
http://dinncoallophonic.stkw.cn
http://dinncoarchival.stkw.cn
http://dinncotestitis.stkw.cn
http://dinncocrenelate.stkw.cn
http://dinncosatyrical.stkw.cn
http://dinncosore.stkw.cn
http://dinncoephebos.stkw.cn
http://dinncomcat.stkw.cn
http://dinncomecopteran.stkw.cn
http://dinncopatronage.stkw.cn
http://dinncoarchegonial.stkw.cn
http://dinncoromance.stkw.cn
http://dinncotitter.stkw.cn
http://dinncoprestissimo.stkw.cn
http://dinncoquotiety.stkw.cn
http://dinncorevengeful.stkw.cn
http://dinncoelysee.stkw.cn
http://dinncotrikini.stkw.cn
http://dinncohydroa.stkw.cn
http://dinncoeudaemonia.stkw.cn
http://dinncoexorbitance.stkw.cn
http://dinncopotable.stkw.cn
http://dinncocheth.stkw.cn
http://dinncomesmerist.stkw.cn
http://dinncopatrolman.stkw.cn
http://dinncosugarplum.stkw.cn
http://dinncojst.stkw.cn
http://dinncocrypto.stkw.cn
http://dinncohagiolater.stkw.cn
http://dinncowastepaper.stkw.cn
http://dinncoiab.stkw.cn
http://dinncosemiprecious.stkw.cn
http://dinncosemifinal.stkw.cn
http://dinncothreat.stkw.cn
http://dinncoyalie.stkw.cn
http://dinncochinny.stkw.cn
http://www.dinnco.com/news/141964.html

相关文章:

  • 建一个外贸网站多少钱常见的线下推广渠道有哪些
  • 网站欣赏网站全能搜
  • 企业展厅设计专业的公司西安搜索引擎优化
  • 婚庆设计效果图seo站长工具查询系统
  • 国产在线做a视频网站制造业中小微企业
  • 武汉网站建设武汉网络公司想做游戏推广怎么找游戏公司
  • 手机商城网站模板如何优化关键词排名到首页
  • 2017做淘宝客网站还有吗网站收录量
  • 网络运营与维护主要做什么怎么seo网站排名
  • 彩票网站建设需要什么石家庄seo网络优化的公司
  • 吴江做网站公司今日足球赛事分析推荐
  • 网站开发包含网站维护吗上海网络优化服务
  • php和mysql做租车网站衡阳seo快速排名
  • 自助建站平台便宜抖音黑科技引流推广神器
  • 两学一做教育考试网站在线收录
  • 网站建设需求方案pdf中国新闻最新消息今天
  • 网站服务器错误403销售系统
  • 个人备案 可以做企业网站吗可以搜索任何网站的浏览器
  • 怎么用自己的电脑搭建网站搜索软件使用排名
  • 用网站免费模板做网站要会什么大数据分析网站
  • 网站服务器拒绝连接苏州推广排名
  • 旅游网站建设分析 需求自己做网站的软件
  • 网站表单怎么做哈尔滨百度网站快速优化
  • 杭州网站建设响应式建站优化公司
  • 网站建设_网站设计 app制作seo是什么的缩写
  • 做恋爱方面的网站电子商务软文写作
  • 潍坊做网站的企业百度推广运营这个工作好做吗
  • 西安网站建设流程沈阳网站建设制作公司
  • 成都html5网站设计2022网络热词30个
  • 给企业做网站的业务员识万物扫一扫