当前位置: 首页> 教育> 就业 > 徐州推广网络营销公司_平面设计的创意手法有哪些_明天上海封控16个区_做一个官网要多少钱

徐州推广网络营销公司_平面设计的创意手法有哪些_明天上海封控16个区_做一个官网要多少钱

时间:2025/7/13 11:48:51来源:https://blog.csdn.net/HAN_789/article/details/143862154 浏览次数:0次
徐州推广网络营销公司_平面设计的创意手法有哪些_明天上海封控16个区_做一个官网要多少钱

1)TCP 

        spring-data-elasticsearch:transport-api.jar;

        springboot版本不同,transport-api.jar不同,不能适配es版本, 7.x已经不建议使用,8以后就要废弃 

2)、9200:HTTP

         JestClient:非官方,更新慢

         RestTemplate:模拟发HTTP请求,ES很多操作需要自己封装,麻烦

         HttpClient:同上

         Elasticsearch-Rest-Client:官方RestClient,封装了ES操作,API层次分明,上手简单

        最终选择Elasticsearch-Rest-Client(elasticsearch-rest-high-level-client) https://www.elastic.co/guide/en/elasticsearch/client/java-rest/current/java-rest-high.html

1、SpringBoot整合

<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.4.2</version></dependency>

2、配置

@Bean RestHighLevelClientclient(){ RestClientBuilder builder = RestClient.builder(newHttpHost("192.168.56.10", 9200, "http")); return new RestHighLevelClient(builder); 
}

3、使用 参照官方文档

@Testvoid test1() throwsIOException{Product product=new Product();product.setSpuName("华为");product.setId(10L);IndexRequest request=new IndexRequest("product").id("20").source("spuName","华为","id",20L);
try{IndexResponse response=client.index(request,RequestOptions.DEFAULT);System.out.println(request.toString());IndexResponse response2 = client.index(request, RequestOptions.DEFAULT);} catch (ElasticsearchException e) {if (e.status() == RestStatus.CONFLICT) {}}}

关键字:徐州推广网络营销公司_平面设计的创意手法有哪些_明天上海封控16个区_做一个官网要多少钱

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: