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

网站开发语言是什么制作营销网站模板下载

网站开发语言是什么,制作营销网站模板下载,定制电商平台,建设公司大还是建筑公司大这里写自定义目录标题 版本说明spring boot POM依赖application.yml配置新建模型映射Repository简单测试完整项目文件目录结构windows下elasticsearch安装配置 版本说明 官网说明 本文使用最新的版本 springboot: 3.2.3 spring-data elasticsearch: 5.2.3 elasticsearch: 8.1… 这里写自定义目录标题 版本说明spring boot POM依赖application.yml配置新建模型映射Repository简单测试完整项目文件目录结构windows下elasticsearch安装配置 版本说明 官网说明 本文使用最新的版本 springboot: 3.2.3 spring-data elasticsearch: 5.2.3 elasticsearch: 8.11.4 elasticsearch下载链接https://www.elastic.co/cn/downloads/past-releases#elasticsearch 最新版可能不兼容以spring官网为准 spring boot POM依赖 ?xml version1.0 encodingUTF-8? project xmlnshttp://maven.apache.org/POM/4.0.0 xmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsdmodelVersion4.0.0/modelVersionparentgroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-parent/artifactIdversion3.2.3/versionrelativePath/ !-- lookup parent from repository --/parentgroupIdcom.example/groupIdartifactIddemo-es/artifactIdversion0.0.1-SNAPSHOT/versionnamedemo-es/namedescriptiondemo-es/descriptionpropertiesjava.version17/java.version/propertiesdependenciesdependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-data-elasticsearch/artifactId/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-web/artifactId/dependencydependencygroupIdorg.projectlombok/groupIdartifactIdlombok/artifactIdoptionaltrue/optional/dependencydependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-test/artifactIdscopetest/scope/dependency/dependenciesbuildpluginsplugingroupIdorg.springframework.boot/groupIdartifactIdspring-boot-maven-plugin/artifactIdconfigurationexcludesexcludegroupIdorg.projectlombok/groupIdartifactIdlombok/artifactId/exclude/excludes/configuration/plugin/plugins/build /projectapplication.yml配置 使用https必须配置username 和 password spring:elasticsearch:uris: https://localhost:9200username: elasticpassword: 123456新建模型映射 package com.example.demoes.es.model;import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.data.annotation.Id; import org.springframework.data.elasticsearch.annotations.Document; import org.springframework.data.elasticsearch.annotations.Field; import org.springframework.data.elasticsearch.annotations.FieldType;Data AllArgsConstructor NoArgsConstructor Document(indexName user) // user 是elasticsearch的索引名称新版本的elasticsearch没有了type的概念 public class UserModel { // 每一个UserModel对应一个elasticsearch的文档IdField(name id, type FieldType.Integer)Integer id;// FieldType.Keyword 不可分词Field(name name, type FieldType.Keyword)String name;// index false 不建立索引Field(name age, type FieldType.Integer, index false)Integer age;// FieldType.Text 可分词ik_smartik_max_word 是ik分词器对中文分词友好需要另外安装Field(name address, type FieldType.Text, searchAnalyzer ik_smart, analyzer ik_max_word)String address;} Repository spring data的repository方便操作类似jpa的操作 继承ElasticsearchRepository自带一些基础的操作方法 package com.example.demoes.es.repo;import com.example.demoes.es.model.UserModel; import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;// UserModel 模型映射 Integer ID的类型 public interface ESUserRepository extends ElasticsearchRepositoryUserModel, Integer {}简单测试 package com.example.demoes;import com.example.demoes.es.model.UserModel; import com.example.demoes.es.repo.ESUserRepository; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.elasticsearch.core.*; import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; import org.springframework.data.elasticsearch.core.query.Criteria; import org.springframework.data.elasticsearch.core.query.CriteriaQuery;SpringBootTest class DemoEsApplicationTests {AutowiredESUserRepository esUserRepository;// 以下三个是 spring-boot-starter-data-elasticsearch 自动配置的 elasticsearch 操作 Bean// 1. DocumentOperations 文档操作AutowiredDocumentOperations documentOperations;// 2. SearchOperations 查询操作AutowiredSearchOperations searchOperations;// 3. ElasticsearchOperations elasticsearch 通用的操作,包括DocumentOperations和SearchOperationsAutowiredElasticsearchOperations elasticsearchOperations;Testvoid contextLoads() {}Testpublic void testIndex() {// 获取索引操作IndexOperations indexOperations elasticsearchOperations.indexOps(UserModel.class);// 查看索引映射关系System.out.println(indexOperations.getMapping());// 输出索引名称System.out.println(indexOperations.getIndexCoordinates().getIndexName());}/*** 添加文档*/Testpublic void testAdd() {esUserRepository.save(new UserModel(1, 张三, 18, 北京朝阳));esUserRepository.save(new UserModel(2, 李四, 19, 北京朝阳));esUserRepository.save(new UserModel(3, 王五, 20, 北京朝阳));esUserRepository.save(new UserModel(4, 赵六, 21, 北京朝阳));esUserRepository.save(new UserModel(5, 马六, 22, 北京朝阳));esUserRepository.save(new UserModel(6, 孙七, 23, 北京朝阳));esUserRepository.save(new UserModel(7, 吴八, 24, 北京朝阳));esUserRepository.save(new UserModel(8, 郑九, 25, 北京朝阳));// 查询所有esUserRepository.findAll().forEach(System.out::println);}/*** 更新文档*/Testpublic void testUpdate() {// 按id更新IndexCoordinates indexCoordinates elasticsearchOperations.indexOps(UserModel.class).getIndexCoordinates();documentOperations.update(new UserModel(1, 张三, 60, 北京朝阳), indexCoordinates);}/*** 删除文档*/Testpublic void testDelete() {documentOperations.delete(String.valueOf(8), UserModel.class);}/*** 查询文档*/Testpublic void testSearch() {CriteriaQuery query new CriteriaQuery(new Criteria(id).is(2));SearchHitsUserModel searchHits searchOperations.search(query, UserModel.class);for (SearchHit searchHit : searchHits.getSearchHits()){UserModel user (UserModel) searchHit.getContent();System.out.println(user);}}}完整项目文件目录结构 windows下elasticsearch安装配置 直接解压修改配置文件解压目录/config/elasticsearch.yml # 集群名称 cluster.name: el-cluster # # ------------------------------------ Node ------------------------------------ # # Use a descriptive name for the node: # #node.name: node-1 # 节点名称 node.name: el-node-1# 数据和日志存储路径默认安装位置path.data: D:/module/elasticsearch-8.11.4/datapath.logs: D:/module/elasticsearch-8.11.4/logs# 访问限制0.0.0.0代表所有IP都可以访问localhost也可以 network.host: 0.0.0.0 # 访问端口 默认9200 http.port: 9200# 安全配置以下的配置第一次启动时自动生成也可以不配置 #----------------------- BEGIN SECURITY AUTO CONFIGURATION ----------------------- # # The following settings, TLS certificates, and keys have been automatically # generated to configure Elasticsearch security features on 21-03-2024 01:32:15 # # --------------------------------------------------------------------------------# Enable security features 不使用https时设为false xpack.security.enabled: truexpack.security.enrollment.enabled: true# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents 不使用https时设为false xpack.security.http.ssl:enabled: truekeystore.path: certs/http.p12# Enable encryption and mutual authentication between cluster nodes xpack.security.transport.ssl:enabled: trueverification_mode: certificatekeystore.path: certs/transport.p12truststore.path: certs/transport.p12 # Create a new cluster with the current node only # Additional nodes can still join the cluster later cluster.initial_master_nodes: [el-node-1]#----------------------- END SECURITY AUTO CONFIGURATION ------------------------- 第一次启动会在控制台打印密码用户名默认elastic 修改密码的话不要关闭控制台另外开启一个控制台进入elastic search安装目录下的bin目录使用以下命令修改 -i 是交互式的意思没有的话会随机生成密码无法自定义。 输入命令回车然后输入两次密码就行了 elasticsearch-reset-password --username elastic -i使用keytool工具将ca证书导入到jdk。 keytool是jdk自带的工具使用以下命令 keytool -importcert -cacerts -alias es_http_ca -file elasticsearch安装路径\config\certs\http_ca.crtes_http_ca 是证书别名
http://www.dnsts.com.cn/news/51656.html

相关文章:

  • 太仓建设工程网站百度推广管家
  • 免费自己建网站个人学做网站
  • 网站建站建设上海黔文信息科技有限公司30优化大师是什么意思
  • 北京赛车网站开发网站开发策划方案知乎
  • 网站导航设计法则怎么做一个网站怎么样
  • 如何创建网站难吗配置安装环境 wordpress 阿里云
  • 做服装搭配图的网站有哪些陕西网
  • 阿里云网站建设官方自营店wordpress怎么采集
  • 大学生做网上英语翻译兼职网站交互设计师网站
  • 网站页面策划用dw制作公司网站
  • asp.net网站搬迁到移动终端4399看片手机在线高清动画
  • 北京网站优化经理wordpress 会员发帖
  • html项目案例实战淘宝关键词优化技巧教程
  • 泊头网站制作我们做的网站是优化型结构
  • 建设银行春招报名网站装修公司网站建设设计作品
  • 做网站公司 深圳信科怎么自己做网站的步骤
  • 高中信息技术网站建设万维网申请网站域名
  • 网站建设项目计划书如何写江苏省建设网站
  • wordpress搭建vip下载站宿迁做网站哪家好
  • 九江网站网站建设怀化招标网站
  • 不花钱的网站怎么做江门网站免费制作
  • 网站设计制作工作室网站建设项目的预表
  • 黄页网站软件下载免费app网站主机在哪里注册呢
  • 太原企业网站模板建站电子商城网站开发文档
  • 怎么做网页设计的页面百家号关键词排名优化
  • dede程序网站如何查看百度蜘蛛wordpress评论
  • 书籍管理网站建设需求文档深圳景观设计公司10强
  • 临沂建设局官方网站广东网页设计培训
  • 网站建设行业论坛wordpress 下载远程图片大小
  • 什么网站可以制作套餐商城开发建设