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

网站建设公司推广方式如何网站托管

网站建设公司推广方式,如何网站托管,搭建淘宝客网站源码,沈阳关键词推广文章目录 三、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.yayakq.cn/news/583933/

相关文章:

  • 微软雅黑适合于做网站吗汕头网站制作电话
  • 珠海十大网站建设公司排名做投票网站
  • 服装公司网站网页设计嘉兴网站排名优化报
  • 局域网站建设银行信用卡招聘小程序源码
  • 交易网站开发合同范本公众号运营策划方案模板
  • 建立企业网站地址佛山市官网网站建设公司
  • 上海网站设计 企业门户网站模板下载
  • 济南网站优化收费标准网站建设如何找本地客户
  • 南京网站设计课程景德镇建设网站
  • 英文旅游网站建设合肥响应式网站建设费用
  • 外贸建站与推广wordpress更改图片大小
  • 旅游电子商务网站建设在重庆找做网站的技术人员
  • 旅游网站建设的目的与意义是什么意思个人主页网站建设
  • 百度网做网站吗廊坊百度优化
  • 郴州建设网站wordpress更改地址后404.3
  • 怎么管理网站的内容开发工具是什么
  • 金坛常州做网站建立网站就可以赚钱了吗
  • 住房和城乡建设部网站建筑电工cookies因预料之外的输出被阻止 wordpress
  • 微信开发者模式在哪打开上海网站优化案例
  • 苏州市网站wordpress4.9怎么安装
  • 域名拦截检测网站安徽省建设工程协会网站
  • 微商城网站开发wordpress验证登录
  • 网站外链坏处广州有网站建设学校
  • 手机网页版网站开发网站开发维护岗位职责
  • 沛县网站建设xlec陇西网站建设公司
  • 好习惯网站网站和微信订阅号优势
  • 网站建设中网站需求分析的理解网站开发需求分析报告
  • 建设外贸产品展示网站市场监督管理局电话
  • 企业网站设计注意临沂法律网站开发公司
  • 企业网站四种类型徐州建站公司哪家好