Skip to content

Commit ecb2f26

Browse files
committed
Catch additional errors
1 parent dd3db4d commit ecb2f26

File tree

1 file changed

+17
-4
lines changed
  • server/src/main/java/org/elasticsearch/index/analysis

1 file changed

+17
-4
lines changed

server/src/main/java/org/elasticsearch/index/analysis/Analysis.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import org.apache.lucene.analysis.th.ThaiAnalyzer;
4949
import org.apache.lucene.analysis.tr.TurkishAnalyzer;
5050
import org.apache.lucene.analysis.util.CSVUtil;
51+
import org.elasticsearch.ElasticsearchException;
5152
import org.elasticsearch.ResourceNotFoundException;
5253
import org.elasticsearch.action.support.PlainActionFuture;
5354
import org.elasticsearch.common.Strings;
@@ -363,16 +364,28 @@ public static Reader getReaderFromIndex(
363364
synonymsManagementAPIService.getSynonymSetRules(synonymsSet, synonymsLoadingFuture);
364365

365366
PagedResult<SynonymRule> results;
367+
366368
try {
367369
results = synonymsLoadingFuture.actionGet();
368-
} catch (ResourceNotFoundException e) {
370+
} catch (ElasticsearchException e) {
369371
if (ignoreMissing == false) {
370372
throw e;
371373
}
372-
logger.warn(
373-
"Synonyms set {} not found - synonyms will not be applied to search results on indices that use this synonym set",
374-
synonymsSet
374+
375+
boolean notFound = e instanceof ResourceNotFoundException;
376+
String message = String.format(
377+
Locale.ROOT,
378+
"Synonyms set %s %s." + " synonyms will not be applied to search results on indices that use this synonym set",
379+
synonymsSet,
380+
notFound ? "not found" : "could not be loaded"
375381
);
382+
383+
if (notFound) {
384+
logger.warn(message);
385+
} else {
386+
logger.error(message, e);
387+
}
388+
376389
results = new PagedResult<>(0, new SynonymRule[0]);
377390
}
378391

0 commit comments

Comments
 (0)