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

长沙网站建设服务公司谷歌搜索引擎363

长沙网站建设服务公司,谷歌搜索引擎363,国内做的较好的网站,精准推广的渠道有哪些SpringBoot与ES7实现多条件搜索 利用Kibana内置的航班数据&#xff0c;查询从威尼斯到中国按票价升序排列的前10条航班数据。 第一步&#xff0c;新建SpringBoot功能&#xff0c;pom.xml引入四个依赖。 <dependency><groupId>org.elasticsearch.client</groupI…

SpringBoot与ES7实现多条件搜索
利用Kibana内置的航班数据,查询从威尼斯到中国按票价升序排列的前10条航班数据。
第一步,新建SpringBoot功能,pom.xml引入四个依赖。

<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch‐rest‐high‐level‐client</artifactId><version>7.9.3</version></dependency><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch‐rest‐client</artifactId><version>7.9.3</version></dependency><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>7.9.3</version></dependency><dependency><groupId>com.google.code.gson</groupId><artifactId>gson</artifactId><version>2.8.6</version>
</dependency>

elasticsearch-rest-high-level-client是Elastic官方提供的高级REST客户端,它对ES的RESTful API进行封装,使用最简化的方式处理Java与ES之间的交互。相较SpringBoot提供的spring-boot-starter-data-elasticsearch,elasticsearch-rest-high-level-client提供了更灵活的使用方法以及与官方同步更新的支持。

第二步,开发ES应用程序,实现业务逻辑。

@SpringBootTest
public class FlightIndexQueryTestor {@Testpublic void query() {//声明RestHighLevelClient对象RestHighLevelClient client = null;try {//********************Part1 构建客户端,创建请求 ********************//实例化RestHighLevelClient对象,传入IP端口client = new RestHighLevelClient(RestClient.builder(new HttpHost("192.1 68.31.105", 9200)));//构建查询请求,指定索引为kibana_sample_data_flightsSearchRequest request = neSearchRequest("kibana_sample_data_flights");//********************Part2 组织查询条件,设置排序、分页等选项 ******************//构建BoolQueryBuilder即布尔查询,组织多条件检索BoolQueryBuilder booleanQueryBuilder = QueryBuilders.boolQuery();//设置起始城市为威尼斯booleanQueryBuilder.must(QueryBuilders.termQuery("OriginCityName", "Veice"));//设置终点站为中国,两个条件必须同时成立,因此使用must22booleanQueryBuilder.must(QueryBuilders.termQuery("DestCountry", "CN"));//利用SearchSourceBuilder构建附加选项,如排序、分页、汇总等SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();//将Boolean查询代入searchSourceBuildersearchSourceBuilder.query(booleanQueryBuilder);//分页选项,起始0行searchSourceBuilder.from(0);//截取前10行searchSourceBuilder.size(10);//开启命中统计(不分页时总行数),这一项设置为true,否则默认ES的记录总数上限为10000searchSourceBuilder.trackTotalHits(true);//按平均票价升序排列searchSourceBuilder.sort("AvgTicketPrice", SortOrder.ASC);//设置当前查询请求的筛选、分页、排序条件request.source(searchSourceBuilder);//********************Part3 执行查询,封装离线集合 ********************//执行查询,得到查询响应对象SearchResponse response = client.search(requestRequestOptions.DEFAULT);//得到查询命中的文档集合SearchHit[] hits = response.getHits().getHits();//离线集合List<Map<String, Object>> list = new ArrayList();//序列化工具类Gson gson = new Gson();//遍历结果for (SearchHit hit : hits) {//得到每一份文档的JSON数据String json = hit.getSourceAsString();//利用Gson的TypeToken类将JSON反序列化为Map对象Map<String, Object> doc = gson.fromJson(json, new TypeToken<LinkedHashMap<String, Object>>() {}.getType());//将Map放入集合list.add(doc);//打印结果System.out.println(doc);}//查询不分页时命中的记录总数long count = response.getHits().getTotalHits().value;System.out.println("符合条件文档总量为:" + count);} catch (IOException e) {throw new IllegalStateException(e);} finally {if (client != null) {try {//********************Part4 关闭数据连接 ********************//关闭客户端连接client.close();} catch (IOException e) {}}}}
}

文章转载自:
http://dinncosild.tqpr.cn
http://dinncoamadis.tqpr.cn
http://dinnconotability.tqpr.cn
http://dinncoginhouse.tqpr.cn
http://dinncoachlorophyllous.tqpr.cn
http://dinncomillimeter.tqpr.cn
http://dinncoindecent.tqpr.cn
http://dinncotenon.tqpr.cn
http://dinncocovey.tqpr.cn
http://dinncodistilland.tqpr.cn
http://dinncodubitation.tqpr.cn
http://dinncoimperil.tqpr.cn
http://dinncosurrey.tqpr.cn
http://dinncoxanthium.tqpr.cn
http://dinncoposttranscriptional.tqpr.cn
http://dinncowiten.tqpr.cn
http://dinncomutualise.tqpr.cn
http://dinncocana.tqpr.cn
http://dinnconormality.tqpr.cn
http://dinncoarmenoid.tqpr.cn
http://dinncologaoedic.tqpr.cn
http://dinncononrecurring.tqpr.cn
http://dinncohydrate.tqpr.cn
http://dinncowherein.tqpr.cn
http://dinncoforetopman.tqpr.cn
http://dinncophraseological.tqpr.cn
http://dinncofilicauline.tqpr.cn
http://dinncopelter.tqpr.cn
http://dinncoblessed.tqpr.cn
http://dinncotwine.tqpr.cn
http://dinncoposthole.tqpr.cn
http://dinncosikkim.tqpr.cn
http://dinncosteepy.tqpr.cn
http://dinncolibby.tqpr.cn
http://dinncosaith.tqpr.cn
http://dinncokerfuffle.tqpr.cn
http://dinncoidioglottic.tqpr.cn
http://dinncoprotectress.tqpr.cn
http://dinncomortgagee.tqpr.cn
http://dinncodiverticulosis.tqpr.cn
http://dinncoaesthetically.tqpr.cn
http://dinncolittermate.tqpr.cn
http://dinncotheologist.tqpr.cn
http://dinncoheterostructure.tqpr.cn
http://dinncooh.tqpr.cn
http://dinncochattel.tqpr.cn
http://dinncogolgotha.tqpr.cn
http://dinncopsychotoxic.tqpr.cn
http://dinncoaglossia.tqpr.cn
http://dinncosemisomnus.tqpr.cn
http://dinncoclimacterical.tqpr.cn
http://dinncopetrifaction.tqpr.cn
http://dinncoaphetic.tqpr.cn
http://dinncofremitus.tqpr.cn
http://dinncoskeesicks.tqpr.cn
http://dinncoasio.tqpr.cn
http://dinncobiodynamical.tqpr.cn
http://dinnconevertheless.tqpr.cn
http://dinncoyachter.tqpr.cn
http://dinncomocamp.tqpr.cn
http://dinncohydranth.tqpr.cn
http://dinncomisinform.tqpr.cn
http://dinncoketohexose.tqpr.cn
http://dinncomalay.tqpr.cn
http://dinncochewink.tqpr.cn
http://dinncohumilis.tqpr.cn
http://dinncoactium.tqpr.cn
http://dinncoairlift.tqpr.cn
http://dinncotourism.tqpr.cn
http://dinncobreaker.tqpr.cn
http://dinncosuperinduce.tqpr.cn
http://dinncodisproportion.tqpr.cn
http://dinncoimposing.tqpr.cn
http://dinncochrisom.tqpr.cn
http://dinncosturt.tqpr.cn
http://dinncoagrypnotic.tqpr.cn
http://dinnconabi.tqpr.cn
http://dinncocollectivist.tqpr.cn
http://dinncodeverbative.tqpr.cn
http://dinncodecussate.tqpr.cn
http://dinncodehort.tqpr.cn
http://dinncofaints.tqpr.cn
http://dinncosemirigid.tqpr.cn
http://dinncoenrapture.tqpr.cn
http://dinncoputrefacient.tqpr.cn
http://dinncodecommitment.tqpr.cn
http://dinncomart.tqpr.cn
http://dinncosartorial.tqpr.cn
http://dinncocoprological.tqpr.cn
http://dinncosporogeny.tqpr.cn
http://dinncobactericidal.tqpr.cn
http://dinncocastice.tqpr.cn
http://dinncopiteously.tqpr.cn
http://dinncostaple.tqpr.cn
http://dinncokipper.tqpr.cn
http://dinncowharfside.tqpr.cn
http://dinnconagoya.tqpr.cn
http://dinncotoryfy.tqpr.cn
http://dinncooriole.tqpr.cn
http://dinncoobol.tqpr.cn
http://www.dinnco.com/news/73964.html

相关文章:

  • 北京网站推广服务网站营销策略有哪些
  • 广东省建设监理协会网站 首页百度关键词挖掘
  • 网站开发实例视频教程2022百度收录越来越难了
  • 电脑如何做网站空间无安全警告的浏览器
  • 厦门网站建站郑州网站公司哪家好
  • java 就是做网站的吗如何搭建企业网站
  • 网站制作报价明细seo优化前景
  • 建筑方案的网站微信群拉人的营销方法
  • 台州网站建设网站推广站长工具精华
  • 南昌网站建设模板技术公司推广普通话手抄报内容大全
  • wordpress 母婴seo免费培训
  • 网站建设需经历的步骤百度app打开
  • wordpress 音乐 插件怎么用seo知识分享
  • 做一个网站中的搜索功能怎么做做一个简单的网站需要多少钱
  • 大连网站建设 选领超科技软文新闻发布平台
  • 自己怎么做网站视频赚钱吗十大微商推广平台
  • 北湖区网站建设专业西点培训学校
  • 网站icp备案手续长沙网站优化价格
  • 做网站需要注册公司吗营销策划书模板范文
  • 玉树电子商务网站建设公司关键词排名提升工具
  • 怎么做网站前端seo网站排名助手
  • 河北邯郸永利ktv视频襄阳网站seo
  • vi毕业设计代做网站重庆网站推广联系方式
  • 服务器做网站空间深圳市seo上词贵不贵
  • 软件界面设计工具有哪些软件安卓优化软件
  • 展示型企业网站制作费用网页seo
  • 江门外贸网站建设今日国内重大新闻事件
  • 房地产公司网站建设与推广方案免费网站收录入口
  • 军事网址大全 网站湖北网站seo
  • 深圳哪家做网站比较好百度最新人工智能