给我写一段包含springboot+两个Elasticsearch数据源 的配置文件以及实体类的代码
时间: 2023-06-03 07:07:19 浏览: 112
下面是您所要求的代码:
配置文件:
```
# Spring Boot Elasticsearch Configuration
spring.elasticsearch.jest.uris=http://localhost:9200
spring.elasticsearch.jest.username=user
spring.elasticsearch.jest.password=password
# First Elasticsearch datasource configuration
spring.data.elasticsearch.cluster-name=cluster-1
spring.data.elasticsearch.cluster-nodes=localhost:9300
spring.data.elasticsearch.repositories.enabled=true
# Second Elasticsearch datasource configuration
elasticsearch2.host=127.0.0.1
elasticsearch2.port=9301
elasticsearch2.cluster-name=cluster-2
elasticsearch2.scheme=http
elasticsearch2.username=user
elasticsearch2.password=password
elasticsearch2.repositories.enabled=true
```
实体类:
```
@Document(indexName = "my_index", type = "my_type")
public class Person {
@Id
private String id;
private String firstName;
private String lastName;
private Integer age;
private String city;
// getters and setters
}
```
阅读全文