Skip to content
Snippets Groups Projects
Commit 3fba4a08 authored by Shinsuke Sugaya's avatar Shinsuke Sugaya
Browse files

fix #1152 create renamed indices

parent 497c3a6d
Branches
Tags
No related merge requests found
...@@ -315,14 +315,26 @@ public class FessEsClient implements Client { ...@@ -315,14 +315,26 @@ public class FessEsClient implements Client {
} else { } else {
indexName = configIndex; indexName = configIndex;
} }
final boolean exists = existsIndex(indexName);
if (!exists) {
final String createdIndexName; final String createdIndexName;
if (isFessIndex) { if (isFessIndex) {
createdIndexName = generateNewIndexName(configIndex); createdIndexName = generateNewIndexName(configIndex);
} else { } else {
createdIndexName = configIndex; switch (configIndex) {
case ".fess_config":
createdIndexName = fessConfig.getIndexConfigIndex();
break;
case ".fess_user":
createdIndexName = fessConfig.getIndexUserIndex();
break;
case "fess_log":
createdIndexName = fessConfig.getIndexLogIndex();
break;
default:
throw new FessSystemException("Unknown config index: " + configIndex);
} }
}
final boolean exists = existsIndex(createdIndexName);
if (!exists) {
createIndex(configIndex, configType, createdIndexName); createIndex(configIndex, configType, createdIndexName);
createAlias(configIndex, createdIndexName); createAlias(configIndex, createdIndexName);
} }
...@@ -341,7 +353,7 @@ public class FessEsClient implements Client { ...@@ -341,7 +353,7 @@ public class FessEsClient implements Client {
updatedIndexName = configIndex; updatedIndexName = configIndex;
} }
} else { } else {
updatedIndexName = configIndex; updatedIndexName = createdIndexName;
} }
addMapping(configIndex, configType, updatedIndexName); addMapping(configIndex, configType, updatedIndexName);
} else { } else {
...@@ -434,7 +446,7 @@ public class FessEsClient implements Client { ...@@ -434,7 +446,7 @@ public class FessEsClient implements Client {
final String dataPath = indexConfigPath + "/" + index + "/" + docType + ".bulk"; final String dataPath = indexConfigPath + "/" + index + "/" + docType + ".bulk";
if (ResourceUtil.isExist(dataPath)) { if (ResourceUtil.isExist(dataPath)) {
insertBulkData(fessConfig, index, docType, dataPath); insertBulkData(fessConfig, indexName, docType, dataPath);
} }
} catch (final Exception e) { } catch (final Exception e) {
logger.warn("Failed to create " + indexName + "/" + docType + " mapping.", e); logger.warn("Failed to create " + indexName + "/" + docType + " mapping.", e);
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment