elasticsearch配置注入索引
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "#{appConfig.trial}", type = "trialData")
public class EsTrialData {
@Id
String id;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
Date updateTime;
}
@Data
@Configuration
public class AppConfig {
@Value("${mongo.address}")
private String mongoDbAddress;
@Value("${mongo.database}")
private String mongoDbDatabase;
@Value("${es.address}")
private String esAddress;
@Value("${es.port}")
private Integer esPort;
@Value("${entity.es.doctor}")
private String doctor;
@Value("${entity.es.hospital}")
private String hospital;
@Value("${entity.es.site}")
private String site;
@Value("${entity.es.trial}")
private String trial;
public @Bean
MongoClient mongoClient() {
return new MongoClient(mongoDbAddress);
}
public @Bean
MongoTemplate mongoTemplate() {
return new MongoTemplate(mongoClient(), mongoDbDatabase);
}
@SneakyThrows
@Bean
Client client() {
Settings settings = Settings.builder()
.put("cluster.name", "elasticsearch")
.build();
TransportClient client = new PreBuiltTransportClient(settings);
client.addTransportAddress(new TransportAddress(InetAddress.getByName(esAddress)
, esPort));
return client;
}
}
相關文章
- Elasticsearch 索引的對映配置詳解Elasticsearch索引
- 【Elasticsearch】Elasticsearch 索引模板Elasticsearch索引
- Elasticsearch索引。Elasticsearch索引
- ElasticSearch 索引 VS MySQL 索引Elasticsearch索引MySql
- ElasticSearch生命週期管理-索引策略配置與操作Elasticsearch索引
- elasticsearch索引原理Elasticsearch索引
- ElasticSearch建立索引Elasticsearch索引
- Elasticsearch 學習索引Elasticsearch索引
- 剖析 Elasticsearch 的索引原理Elasticsearch索引
- elasticsearch之多索引查詢Elasticsearch索引
- elasticsearch如何設計索引Elasticsearch索引
- Elasticsearch(三):索引查詢Elasticsearch索引
- Elasticsearch 索引容量管理實踐Elasticsearch索引
- ElasticSearch 倒排索引(Inverted Index)| 什麼是倒排索引?Elasticsearch索引Index
- 使用Elasticsearch的動態索引和索引優化Elasticsearch索引優化
- elasticsearch 配置篇Elasticsearch
- Spring注入:配置注入(set注入和構造器注入)與註解注入Spring
- ElasticSearch分片互動過程(建立索引、刪除索引、查詢索引)Elasticsearch索引
- Elasticsearch 7.x:2、索引管理Elasticsearch索引
- Elasticsearch索引生命週期管理方案Elasticsearch索引
- elasticsearch(三)----索引建立與刪除Elasticsearch索引
- 教你如何在 elasticsearch 中重建索引Elasticsearch索引
- Elasticsearch5.x建立索引(Java)ElasticsearchH5索引Java
- Spring配置注入Spring
- Debezium kafka elasticsearch 配置KafkaElasticsearch
- Elasticsearch之索引模板index template與索引別名index aliasElasticsearch索引Index
- python建立elasticsearch索引的探討PythonElasticsearch索引
- Elasticsearch核心技術(四):索引原理分析Elasticsearch索引
- Elasticsearch ILM DSL 索引生命週期管理Elasticsearch索引
- ElasticSearch 獲取es資訊以及索引操作Elasticsearch索引
- Docker Elasticsearch 叢集配置DockerElasticsearch
- ElasticSearch之網路配置Elasticsearch
- 使用ELASTICSEARCH進行近實時索引 - bozhoElasticsearch索引
- Elasticsearch系列---生產叢集的索引管理Elasticsearch索引
- Elasticsearch 6.x 倒排索引與分詞Elasticsearch索引分詞
- elasticsearch按照日期定時批量刪除索引Elasticsearch索引
- 《Elasticsearch技術解析與實戰》Chapter 2.1 Elasticsearch索引增刪改查ElasticsearchAPT索引
- 《Elasticsearch技術解析與實戰》Chapter 1.1:Elasticsearch入門和倒排索引ElasticsearchAPT索引