mirror of
https://gitee.com/dromara/easy-es.git
synced 2025-12-06 17:18:57 +08:00
feat: 优化代码
This commit is contained in:
parent
2533cb4014
commit
2e85c8e4de
@ -154,6 +154,7 @@ public class MapperScannerRegister implements BeanBuilder<EsMapperScan> {
|
|||||||
.map(EsDS::value).orElse(DEFAULT_DS);
|
.map(EsDS::value).orElse(DEFAULT_DS);
|
||||||
ElasticsearchClient client = esClientUtils.getClient(restHighLevelClientId);
|
ElasticsearchClient client = esClientUtils.getClient(restHighLevelClientId);
|
||||||
|
|
||||||
|
// 初始化mapper
|
||||||
BaseCache.initMapperCache(clazz, entityClass, client);
|
BaseCache.initMapperCache(clazz, entityClass, client);
|
||||||
|
|
||||||
// 创建代理
|
// 创建代理
|
||||||
|
|||||||
@ -116,7 +116,7 @@ public class IndexTest {
|
|||||||
// 演示通过自定义map创建索引,最为灵活,若我提供的创建索引API不能满足时可用此方法
|
// 演示通过自定义map创建索引,最为灵活,若我提供的创建索引API不能满足时可用此方法
|
||||||
LambdaEsIndexWrapper<Document> wrapper = new LambdaEsIndexWrapper<>();
|
LambdaEsIndexWrapper<Document> wrapper = new LambdaEsIndexWrapper<>();
|
||||||
wrapper.indexName(Document.class.getSimpleName().toLowerCase());
|
wrapper.indexName(Document.class.getSimpleName().toLowerCase());
|
||||||
wrapper.settings(3, 2, 10000);
|
wrapper.settings(1, 1, 10000);
|
||||||
TypeMapping.Builder map = new TypeMapping.Builder();
|
TypeMapping.Builder map = new TypeMapping.Builder();
|
||||||
map.properties("this_is_field", a -> a.keyword(b -> b));
|
map.properties("this_is_field", a -> a.keyword(b -> b));
|
||||||
wrapper.mapping(map);
|
wrapper.mapping(map);
|
||||||
|
|||||||
@ -74,6 +74,8 @@ public class MapperFactoryBean<T> implements FactoryBean<T> {
|
|||||||
.map(EsDS::value).orElse(DEFAULT_DS);
|
.map(EsDS::value).orElse(DEFAULT_DS);
|
||||||
ElasticsearchClient client = this.applicationContext.getBean(EsClientUtils.class)
|
ElasticsearchClient client = this.applicationContext.getBean(EsClientUtils.class)
|
||||||
.getClient(restHighLevelClientId);
|
.getClient(restHighLevelClientId);
|
||||||
|
|
||||||
|
// 初始化mapper
|
||||||
BaseCache.initMapperCache(mapperInterface, entityClass, client);
|
BaseCache.initMapperCache(mapperInterface, entityClass, client);
|
||||||
|
|
||||||
// 创建代理
|
// 创建代理
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user