File tree Expand file tree Collapse file tree 1 file changed +17
-4
lines changed
server/src/main/java/org/elasticsearch/index/analysis Expand file tree Collapse file tree 1 file changed +17
-4
lines changed Original file line number Diff line number Diff line change 4848import org .apache .lucene .analysis .th .ThaiAnalyzer ;
4949import org .apache .lucene .analysis .tr .TurkishAnalyzer ;
5050import org .apache .lucene .analysis .util .CSVUtil ;
51+ import org .elasticsearch .ElasticsearchException ;
5152import org .elasticsearch .ResourceNotFoundException ;
5253import org .elasticsearch .action .support .PlainActionFuture ;
5354import 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
You can’t perform that action at this time.
0 commit comments