首页 > 编程知识 正文

springboot整合jwt,springboot整合websocket

时间:2023-05-05 01:56:08 阅读:263321 作者:330

依赖增加:

<dependency> <groupId>com.bbossgroups.plugins</groupId> <artifactId>bboss-elasticsearch-rest-jdbc</artifactId> <version>6.2.8</version></dependency><dependency> <groupId>com.bbossgroups.plugins</groupId> <artifactId>bboss-elasticsearch-spring-boot-starter</artifactId> <version>6.2.8</version></dependency>

yml配置

spring: elasticsearch: bboss: #elasticUser: username #elasticPassword: password elasticsearch: rest: hostNames: localhost:9200 #hostNames: ip1:9200,ip2:9200,ip3:9200 ##集群地址配置 #https配置,添加https://协议头 #hostNames: https://ip1:9200,https://ip2:9200,https://ip3:9200 dateFormat: yyyy-MM-dd ##日期格式 timeZone: Asia/Shanghai ##时区 #在控制台输出脚本调试开关showTemplate,false关闭,true打开 showTemplate: true discoverHost: false #dsl配置文件热加载扫描时间间隔,毫秒为单位,默认5秒扫描一次,<= 0时关闭扫描机制 dslfile: refreshInterval: -1 ##es client http连接池配置 http: #建立连接超时时间,单位:毫秒 timeoutConnection: 5000 #socket通讯超时时间,如果在通讯过程中出现sockertimeout异常,可以适当调整timeoutSocket参数值,单位:毫秒 timeoutSocket: 5000 #申请连接超时时间,设置为0不超时,单位:毫秒 connectionRequestTimeout: 5000 ##连接失败重试次数,默认-1,小于等于0时不重试 retryTime: 1 maxLineLength: -1 maxHeaderCount: 200 ## 总共允许的最大连接数:节点数n x defaultMaxPerRoute maxTotal: 400 ## 每个地址允许的最大连接数 defaultMaxPerRoute: 200 soReuseAddress: false soKeepAlive: false timeToLive: 3600000 keepAlive: 3600000 keystore: keyPassword: # ssl 主机名称校验,是否采用default配置, # 如果指定为default,就采用DefaultHostnameVerifier,否则采用 SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER hostnameVerifier:

 使用Bboss

@Autowiredprivate BBossESStarter bbossESStarter;//加载配置文件,创建es客户端工具包,在默认es数据源操作ClientInterface clientUtil = bbossESStarter.getConfigRestClient(mappath);或ClientInterface clientUtil = bbossESStarter.getRestClient(); ESDatas<Demo> esDatas =clientUtil.searchList("demo/_search",//demo为索引表,_search为检索操作action queryAll,//queryAll变量对应的dsl语句 Demo.class);//获取结果对象列表List<Demo> demos = esDatas.getDatas();

配置查询的dsl

resource下创建esmapper/deomo.xml,配置脚本

<properties> <property name="queryAll"> <![CDATA[ { "query": { "match_all": {} } } ]]> </property></properties>

简单查询完成。

文档链接ElasticsearchBboss

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。