Authored by hugufei

fix

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