ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
带账号密码的, 需要elasticsearch 设置, 也可以不用账号密码, 但是注意公网时, elasticsearch 端口不对外开放或者指定访问ip # yml 的配置 ``` elasticsearch: cluster-name: elasticsearch cluster-nodes: ip:9200 check-enabled: true #账号 username: elastic #你的elasticsearch密码 password: password ``` # ElasticSearchConfig ``` import org.elasticsearch.client.RestHighLevelClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.elasticsearch.client.ClientConfiguration; import org.springframework.data.elasticsearch.client.RestClients; @Configuration public class ElasticSearchConfig { /** elasticsearch 地址 **/ @Value("${jeecg.elasticsearch.cluster-nodes}") private String esUrl; @Value("${jeecg.elasticsearch.username}") private String username; @Value("${jeecg.elasticsearch.password}") private String password; @Bean RestHighLevelClient client() { ClientConfiguration clientConfiguration = ClientConfiguration.builder() .connectedTo(esUrl) .withConnectTimeout(200000) .withSocketTimeout(200000) // 账号密码, 不加就注释掉 .withBasicAuth(username, password) .build(); return RestClients.create(clientConfiguration).rest(); } } ```