目录
接上篇
https://blog.youkuaiyun.com/Delicious_Life/article/details/106590692
连接ES服务器
新建配置类,通过ip+端口连接ES
@Configuration
public class ElasticSearchClientConfig {
@Bean
public RestHighLevelClient restHighLevelClient(){
RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("127.0.0.1",9200,"http")));
return client;
}
}
编写Service

本文介绍如何在SpringBoot应用中连接 Elasticsearch 服务器,编写Service和Controller,将爬取的数据存入ES索引库,并进行测试验证。通过配置类建立连接,通过Controller调用Service实现数据存储,经测试数据成功存入ES的dj_goods索引库。
最低0.47元/天 解锁文章
1208

被折叠的 条评论
为什么被折叠?



