Authored by 胡古飞

fix

@@ -167,9 +167,12 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent @@ -167,9 +167,12 @@ public class YohoIndexServiceImpl implements IYohoIndexService, ApplicationEvent
167 if (oldRealIndexName != null) { 167 if (oldRealIndexName != null) {
168 client.removeAlias(oldRealIndexName, alias); 168 client.removeAlias(oldRealIndexName, alias);
169 } 169 }
170 - // 5、添加新索引别名 170 + // 5、添加新索引别名【如果存在一个名字为alias的真实索引,则直接删除】
  171 + if(client.indexExists(alias)){
  172 + client.deleteIndex(alias);
  173 + }
171 client.addAlias(newRealIndexName, alias); 174 client.addAlias(newRealIndexName, alias);
172 - // 6、删除旧索引 175 + // 7、删除旧索引
173 if (oldRealIndexName != null) { 176 if (oldRealIndexName != null) {
174 client.deleteIndex(oldRealIndexName); 177 client.deleteIndex(oldRealIndexName);
175 } 178 }