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

个人网站系统互联网营销方式有哪些

个人网站系统,互联网营销方式有哪些,营口建设信息网站,手机制作网页软件下载个人名片: 博主:酒徒ᝰ. 个人简介:沉醉在酒中,借着一股酒劲,去拼搏一个未来。 本篇励志:三人行,必有我师焉。 本项目基于B站黑马程序员Java《SpringCloud微服务技术栈》,SpringCloud…

请添加图片描述
个人名片:

博主:酒徒ᝰ.
个人简介沉醉在酒中,借着一股酒劲,去拼搏一个未来。
本篇励志三人行,必有我师焉。

请添加图片描述
本项目基于B站黑马程序员Java《SpringCloud微服务技术栈》,SpringCloud+RabbitMQ+Docker+Redis+搜索+分布式

【SpringCloud+RabbitMQ+Docker+Redis+搜索+分布式,系统详解springcloud微服务技术栈课程|黑马程序员Java微服务】 点击观看

目录

  • 四、RestAPI

四、RestAPI

ES官方提供了各种不同语言的客户端,用来操作ES。
这些客户端的本质就是组装DSL语句,通过http请求发送给ES。
官方文档地址:https://www.elastic.co/guide/en/elasticsearch/client/index.html

案例:利用JavaRestClient实现创建、删除索引库,判断索引库是否存在

  1. 准备工程
    导入项目
    导入mysql数据
    修改application.yaml中的url和password,改为自己数据库的位置和密码
  2. 创建索引库
    导入es依赖
<dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId>
</dependency>

更改es版本为我们当前使用的版本

<properties><elasticsearch.version>7.12.1</elasticsearch.version>
</properties>

初始化代码

public class HotelIndexTest {private RestHighLevelClient client;@BeforeEachvoid setUp() {this.client = new RestHighLevelClient(RestClient.builder(HttpHost.create("http://192.168.179.128:9200")));}@AfterEachvoid tearDown() throws IOException {this.client.close();}
}

建立DSL的JSON参数部分

package cn.itcast.hotel;public class HotelConstants {public static final String MAPPING_TEMPLATE = "{\n" +"  \"mappings\": {\n" +"    \"properties\": {\n" +"      \"id\": {\n" +"        \"type\": \"keyword\"\n" +"      },\n" +"      \"name\": {\n" +"        \"type\": \"text\",\n" +"        \"analyzer\": \"ik_max_word\",\n" +"        \"copy_to\": \"all\"\n" +"      },\n" +"      \"address\": {\n" +"        \"type\": \"keyword\",\n" +"        \"index\": false\n" +"      },\n" +"      \"price\": {\n" +"        \"type\": \"integer\"\n" +"      },\n" +"      \"score\": {\n" +"        \"type\": \"integer\"\n" +"      },\n" +"      \"brand\": {\n" +"        \"type\": \"keyword\",\n" +"        \"copy_to\": \"all\"\n" +"      },\n" +"      \"city\": {\n" +"        \"type\": \"keyword\"\n" +"      },\n" +"      \"starName\": {\n" +"        \"type\": \"keyword\"\n" +"      },\n" +"      \"business\": {\n" +"        \"type\": \"keyword\",\n" +"        \"copy_to\": \"all\"\n" +"      },\n" +"      \"location\": {\n" +"        \"type\": \"geo_point\"\n" +"      },\n" +"      \"pic\": {\n" +"        \"type\": \"keyword\",\n" +"        \"index\": false\n" +"      },\n" +"      \"all\": {\n" +"        \"type\": \"text\",\n" +"        \"index\": true,\n" +"        \"analyzer\": \"ik_max_word\"\n" +"      }\n" +"    }\n" +"  }\n" +"}";
}

发送请求

@Test
void testCreateHotelIndex() throws IOException {CreateIndexRequest request = new CreateIndexRequest("hotel");request.source(MAPPING_TEMPLATE, XContentType.JSON);client.indices().create(request, RequestOptions.DEFAULT);
}
  1. 删除索引库
@Test
void testDeleteHotelIndex() throws IOException {DeleteIndexRequest request = new DeleteIndexRequest("hotel");client.indices().delete(request, RequestOptions.DEFAULT);
}
  1. 判断索引库是否存在
@Test
void testExitsHotelIndex() throws IOException {GetIndexRequest request = new GetIndexRequest("hotel");boolean exists = client.indices().exists(request, RequestOptions.DEFAULT);System.out.println(exists);
}

总结:

JavaRestClient操作elasticsearch的流程基本类似。
核心是client.indices()方法来获取索引库的操作对象。
索引库操作的基本步骤:
初始化RestHighLevelClient
创建XxxIndexRequest。XXX是Create、Get、Delete
准备DSL( Create时需要,其它是无参)
发送请求。调用RestHighLevelClient#indices().xxx()方法,xxx是create、exists、delete

http://www.sczhlp.com/news/54881/

相关文章:

  • 东莞市官网网站建设企业网站开发公司商业计划书
  • 公司网站设计公司排名上海注册外贸公司
  • 网站卡的原因柳州市住房建设保障网
  • 做网站麻烦么网易企业邮箱电话人工服务
  • 美食网站建设项目分析报告肇庆 网站建设公司有哪些
  • 中国建设银行舟山分行网站哪些网站用django做的
  • 佛山网站设计特色公司简介模板200字左右
  • 怎么用wordpress建电商网站苍溪网站建设
  • 电商素材网站做企业网站市场分析
  • 网站开发投标文件服务承诺部分山西响应式网站哪家好
  • 有什么网站可以免费搭建网址百度搜索指数在线查询
  • 做签名的网站seo是干什么的
  • 简述网站规划的一般步骤wordpress 嵌套软件
  • 大规模天线基站技术获时间检验奖
  • 网站文章图片如何跳转wordpress自动存图
  • 个人接外贸订单网站wordpress+链接+弹窗
  • 网站建设时间怎样看如何加强网站信息建设
  • 微信微网站怎么进入中国建设银行复核网站
  • cnzz统计代码放在后台网站为什么没显示类似百度的网站
  • 免费crm网站不用下载的软件阿里指数查询入口
  • 新乡彩票网站建设湖北网站建设模板下载
  • 怎么做监控网站链爱交易平台
  • 网站开发需求分析主要内容百度快照怎么打开
  • 什么nas可以做网站服务器wordpress 爱情模板下载地址
  • 网站建设五大定位和生活爱辽宁下载安装
  • 网页设计网站概述怎么写网站设计文档
  • 网站开发视频转码ASP.NET网站建设实战
  • 做网站的价格做汽车配件招聘网站
  • 基于python+django的酒店预定网站-酒店管理系统源码+运行
  • 怎么免费做网站视频教学投标网站建设