...
|
...
|
@@ -96,7 +96,7 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent |
|
|
IElasticsearchClient client = indexClientFactory.createIndexClient(clusterName, servers, "consumer");
|
|
|
for (IndexConfig indexConfig : clientConfig.getIndexConfigs()) {
|
|
|
Map<String, String> indexSettings = indexConfig.getProperties();
|
|
|
IYohoIndex index = new YohoIndexImpl(indexConfig.getName(), client, indexConfig.getProperties());
|
|
|
IYohoIndex index = new YohoIndexImpl(indexConfig.getName(), client, indexSettings);
|
|
|
// 构造数据提供者
|
|
|
index.setIndexBuilderClassName(indexConfig.getBuilderClass());
|
|
|
// 设置mapping
|
...
|
...
|
@@ -129,7 +129,7 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 每次重建索引时,根据集群状态决定分支分片数
|
|
|
* 每次重建索引时,根据节点数和主分片数自动生成复制分片数
|
|
|
*
|
|
|
* @param client
|
|
|
* @param indexSettings
|
...
|
...
|
@@ -186,7 +186,7 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent |
|
|
indexSettings.putAll(index.getIndexSettings());
|
|
|
indexSettings.putAll(index.getAnalysisSettings());//设置分词器信息
|
|
|
indexSettings.put("max_result_window", "100000000");
|
|
|
indexSettings.put("number_of_replicas", this.genNumberOfReplicas(client,index.getIndexSettings()));//处理复制分片
|
|
|
indexSettings.put("number_of_replicas", this.genNumberOfReplicas(client, index.getIndexSettings()));//处理复制分片
|
|
|
|
|
|
client.createIndex(newRealIndexName, type, indexSettings, mappingContent);
|
|
|
// 5、删除旧索引别名
|
...
|
...
|
|