In no-init mode, should only check the index existence. (#4929)

This commit is contained in:
吴晟 Wu Sheng 2020-06-16 08:06:02 +08:00 committed by GitHub
parent 164124fc22
commit d305efcb52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -53,11 +53,12 @@ public class StorageEsInstaller extends ModelInstaller {
protected boolean isExists(Model model) throws StorageException {
ElasticSearchClient esClient = (ElasticSearchClient) client;
try {
String timeSeriesIndexName =
model.isTimeSeries() ?
TimeSeriesUtils.latestWriteIndexName(model) :
model.getName();
return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex(timeSeriesIndexName);
if (model.isTimeSeries()) {
return esClient.isExistsTemplate(model.getName()) && esClient.isExistsIndex(
TimeSeriesUtils.latestWriteIndexName(model));
} else {
return esClient.isExistsIndex(model.getName());
}
} catch (IOException e) {
throw new StorageException(e.getMessage());
}