Sidan " common-data-es使用说明"
kommer tas bort. Se till att du är säker.
es 版本: 2.4.4
<dependency>
<groupId>com.yihu.base</groupId>
<artifactId>common-data-es </artifactId>
<version>${版本以项目中最新的版本为主}</version>
</dependency>
spring:
data:
elasticsearch: #ElasticsearchProperties
cluster-name: jkzl #默认即为elasticsearch 集群名
cluster-nodes: 120.25.194.233:9300,120.25.194.233:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
# JEST (Elasticsearch HTTP client) (JestProperties)
elasticsearch:
jest:
uris: http://192.168.226.133:9200
connection-timeout: # Connection timeout in milliseconds.
multi-threaded: true # Enable connection requests from multiple execution threads.
@Autowired
private ElastricSearchHelper elastricSearchHelper
#spring提供的工具类
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
实体类要继承 SaveModel
/**
* 新增
*/
public Boolean save(String index, String type, List<SaveModel> sms) {
}
/**
* 修改
* 需要先等到ID在更新ID更新
*/
public Boolean update(String index, String type, List<SaveModel> sms) {
}
/**
* 删除
* 需要先等到ID在更新ID删除
*/
private void deleteData(String index, String type, List<SaveModel> saveModels) {
}
Sidan " common-data-es使用说明"
kommer tas bort. Se till att du är säker.