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

网站作弊长沙网站推广seo

网站作弊,长沙网站推广seo,用啥网站做首页,辽宁网络推广公司文章目录 三、RestClient操作索引库与文档3.1 操作索引库3.2 操作文档结束语 三、RestClient操作索引库与文档 ES官方提供了各种不同语言的客户端,用来操作ES。这些客户端的本质就是组装DSL语句,通过http请求发送给ES。 官方文档地址: https://www.ela…

文章目录

  • 三、`RestClient`操作索引库与文档
    • 3.1 操作索引库
    • 3.2 操作文档
    • 结束语

三、RestClient操作索引库与文档

ES官方提供了各种不同语言的客户端,用来操作ES。这些客户端的本质就是组装DSL语句,通过http请求发送给ES

官方文档地址: https://www.elastic.co/guide/en/elasticsearch/client/index.html

数据库文件:视频里展示的数据库表可以使用自己有的其他数据替代,不一定非要一致。

自己手敲了个工程项目(包含SQL文件):测试RestClient项目文件

3.1 操作索引库

设计数据表对应的mappings

PUT /movie
{"mappings": {"properties": {"all":{"type": "text","analyzer": "ik_max_word"},"movieId":{"type": "keyword"},"movieTitle":{"type": "text","analyzer": "ik_max_word", "copy_to": "all"},"movieIntroduction":{"type": "text","analyzer": "ik_max_word", "copy_to": "all"},"movieRating":{"type": "float"},"movieReleaseDate":{"type": "keyword", "copy_to": "all"}}}
}

引入依赖

<properties><java.version>1.8</java.version><elasticsearch.version>7.12.1</elasticsearch.version><mybatis-plus-boot.version>3.4.2</mybatis-plus-boot.version>
</properties><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.12.1</version>
</dependency>

初始化

public class MovieIndexTest {private RestHighLevelClient client;@Testvoid testInit(){System.out.println(client);}@BeforeEachvoid setUp(){this.client = new RestHighLevelClient(RestClient.builder(HttpHost.create("http://10.120.54.174:9200")));}@AfterEachvoid close() throws IOException {this.client.close();}
}

创建movie索引,CREATE_MOVIE 为上面的 mappings

public class MovieIndexTest {// ...........@Testvoid testCreateMovieIndex() throws IOException {// 创建RequestCreateIndexRequest request = new CreateIndexRequest("movie");// 准备请求数据request.source(CREATE_MOVIE, XContentType.JSON);// 发送请求client.indices().create(request, RequestOptions.DEFAULT);}// ...........
}

删除、获取,判断是否存在

public class MovieIndexTest {@Testvoid testDelete() throws IOException {DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest("movie");client.indices().delete(deleteIndexRequest,RequestOptions.DEFAULT);}@Testvoid testExists() throws IOException {GetIndexRequest getIndexRequest = new GetIndexRequest("movie");boolean exists = client.indices().exists(getIndexRequest, RequestOptions.DEFAULT);System.out.println(exists);}@Testvoid testGet() throws IOException {GetIndexRequest getIndexRequest = new GetIndexRequest("movie");GetIndexResponse getIndexResponse = client.indices().get(getIndexRequest, RequestOptions.DEFAULT);System.out.println(getIndexResponse);}
}

3.2 操作文档

【TODO】

结束语

上一篇:二、ElasticSearch中索引库与文档操作

http://www.hkea.cn/news/799230/

相关文章:

  • 给男票做网站表白的软件产品市场推广计划书
  • 西安网站制作定制怎么制作自己的个人网站
  • wordpress 如何移动端盐城seo优化
  • asp.net 制作网站开发百度竞价排名软件
  • 百度爱采购推广平台天津网络推广seo
  • 福州市闽侯县建设局网站推广引流吸引人的文案
  • wordpress目录 读写权限泰安短视频seo
  • 东莞建设网站流程澎湃新闻
  • 萧县住房和城乡建设局网站seo排名推广工具
  • 企业网站php模板下载百度百科官网首页
  • 做愛視頻网站在线网页制作网站
  • 织梦pc怎么做手机网站搜索引擎优化的基础是什么
  • 课程建设网站设计源码爱站网反链查询
  • 安徽省建设业协会网站个人网页制作教程
  • 好的摄影网站推荐福州seo顾问
  • html做的好看的网站如何宣传推广产品
  • 微信手机网站制作怎么引流客源最好的方法
  • 宿州建设网站公司前端seo搜索引擎优化
  • 做王境泽表情的网站百度seo关键词优化排名
  • 怎么选择无锡网站建设虚拟主机搭建网站
  • 做原油期货关注什么网站搜索引擎优化是做什么
  • 微信小程序怎么制作游戏安卓优化清理大师
  • 胶南做网站初学者做电商怎么入手
  • 网站为什么要维护佛山网络营销推广
  • 国企网站建设报告怎么建造自己的网站
  • 免费做司考真题的网站余姚网站如何进行优化
  • 如何网站开发1688网站
  • 丽水专业网站建设价格青岛网站优化
  • 网站开发专业培训学校百度推广登录官网入口
  • 贵阳做网站公司网站热度查询